Different answer for LpSolve and OR-Tools GLOP solver

54 views Asked by At

I wrote this code in C# using Or-tools for solve LP problem (LPSolve script down below)

 public static void test(ConvolutionData data)
    {
        Solver solver = Solver.CreateSolver("GLOP");
        if (solver is null)
        {
            return;
        }

        Variable x1 = solver.MakeNumVar(0.1, double.PositiveInfinity, "x1");
        Variable x2 = solver.MakeNumVar(0.1, double.PositiveInfinity, "x2");
        Variable x3 = solver.MakeNumVar(0.1, double.PositiveInfinity, "x3");
        Variable t1 = solver.MakeNumVar(0.0, double.PositiveInfinity, "t1");
        Variable t2 = solver.MakeNumVar(0.0, double.PositiveInfinity, "t2");
        Variable u1 = solver.MakeNumVar(0.0, double.PositiveInfinity, "u1");
        Variable v1 = solver.MakeNumVar(0.0, double.PositiveInfinity, "v1");

        Constraint c1 = solver.Add(202 * x1 + 61 * x2 + 4 * x3 + t1 >= 0);
        Constraint c2 = solver.Add(204 * x1 + 57 * x2 + 5 * x3 + t2 >= 0);
        Constraint c3 = solver.Add(-2 * x1 + 4 * x2 - x3 + u1 - v1 == 0);

        solver.Minimize(t1 + u1 + v1 + t2);
        Solver.ResultStatus resultStatus = solver.Solve();
    }

enter image description here

Why it is different from solution in LpSolve with this .lp script? Or it's just because different method to solve it?

/* Objective function */
min: t1 + t2 + u1 + v1;

202 x1 + 61 x2 + 4 x3 + t1 >= 0;
204 x1 + 57 x2 + 5 x3 + t2 >= 0;
-2 x1 + 4 x2 - x3 + u1 - v1 = 0;


x1 >= 0.1;
x2 >= 0.1;
x3 >= 0.1;

enter image description here

enter image description here

1

There are 1 answers

0
Laurent Perron On

yes, objective is the same. Nothing forces the solution to be equal.