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.
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