Skip to main content
added 102 characters in body
Source Link
F_G
  • 837
  • 5
  • 7

You can use the following modelling trick to transform you problem in a integer linear program: for each constraint of the type $$ Q_i = 0 \text{ or } L_i \le Q_i \le M_i$$ (on an integer variable $Q_i$) introduce a new binary variable $B_i$ and write $$ L_i B_i \le Q_i \le M_i B_i $$ If, as in your example, you have no explicit value for $M_i$, simply use a large upper bound on the values of $Q_i$ (for example $50$ in your situation). Also, the constraint $Q_i = 0 \text{ or } Q_i \ge 1$ is redundant. You can then solve the resulting program with any integer programming solver, such as lp_solve or glpk.

By the way, the solution to your example is easily seen to be obtained with $Q_4=30$ and $Q_8=20$.

You can use the following modelling trick to transform you problem in a integer linear program: for each constraint of the type $$ Q_i = 0 \text{ or } L_i \le Q_i \le M_i$$ (on an integer variable $Q_i$) introduce a new binary variable $B_i$ and write $$ L_i B_i \le Q_i \le M_i B_i $$ If, as in your example, you have no explicit value for $M_i$, simply use a large upper bound on the values of $Q_i$ (for example $50$ in your situation). Also, the constraint $Q_i = 0 \text{ or } Q_i \ge 1$ is redundant. You can then solve the resulting program with any integer programming solver, such as lp_solve or glpk.

You can use the following modelling trick to transform you problem in a integer linear program: for each constraint of the type $$ Q_i = 0 \text{ or } L_i \le Q_i \le M_i$$ (on an integer variable $Q_i$) introduce a new binary variable $B_i$ and write $$ L_i B_i \le Q_i \le M_i B_i $$ If, as in your example, you have no explicit value for $M_i$, simply use a large upper bound on the values of $Q_i$ (for example $50$ in your situation). Also, the constraint $Q_i = 0 \text{ or } Q_i \ge 1$ is redundant. You can then solve the resulting program with any integer programming solver, such as lp_solve or glpk.

By the way, the solution to your example is easily seen to be obtained with $Q_4=30$ and $Q_8=20$.

Source Link
F_G
  • 837
  • 5
  • 7

You can use the following modelling trick to transform you problem in a integer linear program: for each constraint of the type $$ Q_i = 0 \text{ or } L_i \le Q_i \le M_i$$ (on an integer variable $Q_i$) introduce a new binary variable $B_i$ and write $$ L_i B_i \le Q_i \le M_i B_i $$ If, as in your example, you have no explicit value for $M_i$, simply use a large upper bound on the values of $Q_i$ (for example $50$ in your situation). Also, the constraint $Q_i = 0 \text{ or } Q_i \ge 1$ is redundant. You can then solve the resulting program with any integer programming solver, such as lp_solve or glpk.