I have an optimization problem of linear programming, to solve it I use LP Solve (two versions were tested: v-5.5.2.3, v-5.5.2.0). Recently, a problem appeared - in the IDE it gives one solution (I think that it is correct), and the software implementation - another (completely different, and I think it is wrong). As I checked: using software functions (set_upbo (lp, i, l); set_mat (lp, 0, i, 0);), referring to LP Solve created the problem in the solver object, and then started to solve

int result = solve(lp); 

and output a complete solution and a compiled objective function, equations and constraints in two files. Then the resulting equations in the LPSolve format were transferred to the LPSolve IDE and obtained the following results:
UPD
------------------------------------------------
For example:

 /* Objective function */ max: +y4 +y5 +y6; /* Constraints */ n1: +x4 -y4 -z4_5_4 -z4_6_5 +z5_4_8 +z6_4_9 = 0; n2: +x5 -y5 +z4_5_4 -z5_6_6 +z6_5_7 -z5_4_8 +z6_5_10 -z5_6_11 = 0; n3: +x6 -y6 +z4_6_5 +z5_6_6 -z6_5_7 -z6_4_9 -z6_5_10 +z5_6_11 = 0; /* Variable bounds */ x4 <= 15060; x5 <= 17550; x6 <= 17150; y4 <= 15000; y5 <= 15000; y6 <= 15000; z4_5_4 <= 2000; z4_6_5 <= 2000; z5_6_6 <= 1000; z6_5_7 <= 1000; z5_4_8 <= 2000; z6_4_9 <= 2000; z6_5_10 <= 1000; z5_6_11 <= 1000; 

The above equation gives the following result in LP Solve IDE:

 Var-s Result 45000 x5 15060 x4 17000 x6 12940 y4 15000 y5 15000 y6 15000 z4_5_4 0 z4_6_5 60 z5_4_8 0 z5_6_11 1000 z5_6_6 1000 z6_4_9 0 z6_5_10 0 z6_5_7 0 


------------------------------------------------

Further, using the function get_variables (lp, var); in Debug mode, looked at the solution obtained:

 Var-s Result 45000 x4 15000 x5 15000 x6 15000 y4 15000 y5 15000 y6 15000 z4_5_4 0 z4_6_5 0 z5_4_8 0 z5_6_11 0 z5_6_6 0 z6_4_9 0 z6_5_10 0 z6_5_7 0 

After that, I changed the input parameters of the restrictions (the objective function and equations do not change), however, the IDE gave me about the same values ​​or slightly changed, and the program always 15000 and 0. At some forum I read that you can replace the values "1E-5" instead of " 0 " and " 1000 " instead of" 1.0 ", the objective function changed, it turned out that the minima of all values ​​are used, the solution changes, but it is not true. Thus, I need the software implementation to issue a solution identical to the IDE, if anyone has an idea of ​​what the error may be, I’ll be happy to hear and try all the ways to solve the problem.

  • It is not entirely clear: if the objective functions are equal in both solutions, how was it possible to understand that one of them is wrong? You can check for correctness, for example, as follows: solve a dual problem, and if the objective function has the same value, then it is correct. There are other ways. Then substitute the variables in the task constraints: they must be satisfied. And the fact that an LP problem can have infinitely many solutions is so obvious. - Zealint
  • It was possible to understand as follows - indeed the value of the objective function is the same (45000), however, the values ​​of variables in the case of a solution are programmatically equal to only 15000 and 0, and this provided that the limited time changes a little by about 100. In my case, if variables marked with z are equal 0 then the problem is not solved. I understand that if the values ​​in IDE LPSolve and software implementation differed slightly, there would of course become clear that somewhere a more optimal solution was found. But in my case, the optimum seems to have been found, and the values ​​for which the statistics go, always Ja_Dim
  • You see, what's the matter, all these solvers seek to optimize the objective function under conditions of constraints. If the objective function takes the optimal value, then any of the appropriate values ​​of the variables can be returned. If it is necessary for the variables to have other values, then this can be achieved ONLY with new restrictions. For example, write z>=1 , then z will not be zero if it does not suit you. In short, it all depends on the task, so when you have such a problem, then this is the exact evidence of the incorrectly constructed model. - Zealint

0