您的解决方案制定得很好,并且 lpsolve 解决得很好。但结果可能不是你所期望的。例如,我得到:z = 0 和 x187 = 0 (A=B=0)。问题是 A 和 B 是仅取决于 x187 的表达式,因此您应该简化除法表达式!选的大M,应该小一点吧?
Model name: 'model build from GLP-Solve' - run #1
Objective: Minimize(R0)
SUBMITTED
Model size: 12 constraints, 53 variables, 311 non-zeros.
Sets: 0 GUB, 0 SOS.
Using DUAL simplex for phase 1 and PRIMAL simplex for phase 2.
The primal and dual simplex pricing strategy set to 'Devex'.
Relaxed solution 276710632.306 after 23 iter is B&B base.
Feasible solution 276710632.306 after 23 iter, 0 nodes (gap 0.0%)
Optimal solution 276710632.306 after 23 iter, 0 nodes (gap 0.0%).
Excellent numeric accuracy ||*|| = 0
MEMO: lp_solve version 5.5.2.0 for 64 bit OS, with 64 bit REAL variables.
In the total iteration count 23, 17 (73.9%) were bound flips.
There were 0 refactorizations, 0 triggered by time and 0 by density.
... on average 6.0 major pivots per refactorization.
The largest [LUSOL v2.2.1.0] fact(B) had 13 NZ entries, 1.0x largest basis.
The maximum B&B level was 1, 0.5x MIP order, 1 at the optimal solution.
The constraint matrix inf-norm is 1e+06, with a dynamic range of 6.39386e+08.
Time to load data was 0.001 seconds, presolve used 0.000 seconds,
... 0.000 seconds in simplex solver, in total 0.001 seconds.
如果我们移除 A、B 和 z 限制,我们会得到相同的结果:
Model name: 'model build from GLP-Solve' - run #1
Objective: Minimize(R0)
SUBMITTED
Model size: 6 constraints, 50 variables, 299 non-zeros.
Sets: 0 GUB, 0 SOS.
Using DUAL simplex for phase 1 and PRIMAL simplex for phase 2.
The primal and dual simplex pricing strategy set to 'Devex'.
Optimal solution 276710632.306 after 22 iter.
Excellent numeric accuracy ||*|| = 0
MEMO: lp_solve version 5.5.2.0 for 64 bit OS, with 64 bit REAL variables.
In the total iteration count 22, 17 (77.3%) were bound flips.
There were 0 refactorizations, 0 triggered by time and 0 by density.
... on average 5.0 major pivots per refactorization.
The largest [LUSOL v2.2.1.0] fact(B) had 7 NZ entries, 1.0x largest basis.
The constraint matrix inf-norm is 1, with a dynamic range of 639.386.
Time to load data was 0.002 seconds, presolve used 0.001 seconds,
... 0.001 seconds in simplex solver, in total 0.004 seconds.