Ваше решение хорошо сформулировано, и lpsolve решена отлично. Но результаты могут быть не такими, как вы ожидали бы. Например, я получил: z = 0 и x187 = 0 (A = B = 0). Дело в том, что A и B являются выражениями, зависящими только от x187, поэтому вы должны упростить это деление! Выбранный большой М должен быть меньше?
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.
Если мы удалим А, В и ограничении 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.
Здравствуйте josliber, спасибо за вашу помощь. У меня проблемы с запущенным примером. Я пробую это. [код] A = -0.275 y0 + 0.15 y1 + 0.15 y2 + 0.236 y3 + 0.14745 y4; B = -0,175 y0 + 0,05 y1 + 0,05 y2 + 0,136 y3 + 0.04745 y4; A <= Mz; B <= Mz; A> = M (z-1); B> = M (z-1); z двоичный; [/ code] Но я получаю ошибку синтаксического анализа. Я не понимаю логики в деталях ... – ABSimon
@ABSimon 'M' следует заменить большим числом, например 1000000. – josliber
Здравствуйте, josliber, мне также нужно поместить круглые скобки в« A> = 1000000 (z-1) "и" B> = 1000000 (z-1) ". Я думаю, что я получаю тогда «A> = 1000000 z - 1000000» и «B> = 1000000 z - 1000000». В общем случае у меня есть обходной путь «A <= 1000000 z; B <= 1000000 z; A> = 1000000 z - 1000000; B> = 1000000 z - 1000000; bin z;" вместо «A/B> = 0»? Спасибо! Я думаю, что это большая помощь любому начинающему lp_solve :) – ABSimon