1

I am developing a production simulation using OpenSolver in Excel. I know that I cannot use if, or, and statements to constrain a solver.

I need a constraint that says:

X has to be within the range of 150 - 250, or X can equal 0.

I have read about different ways to substitute binary constraints for conditional formulas, but I am not sure how to make it work exactly.

Any help is greatly appreciated.

1 Answers1

0
150 d <= x <= 250 d 
d in {0,1}

or make x a semi-continuous variable with lower bound 150 and upper bound 250. I am not sure but I believe OpenSolver does not support semi-continuous variables so you need to use the first formulation using an extra binary variable.

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39
  • 1
    I have tried this using a single binary variable d as you explained, and I get an error message that says Open Solver cannot find a feasible solution. Can you explain what you mean by using an extra binary variable in the first formulation? – tdanner1993 Jul 21 '16 at 12:54
  • `x semi-continuous between [150,250]` uses zero extra binary variables while `150 d <= x <= 250 d` uses one extra binary variable. – Erwin Kalvelagen Jul 21 '16 at 13:17
  • Using the constraint 150d <= x <= 250d, where x and d are both decision variables & d is binary. I am getting an error message saying there is no feasible solution and it does not appear to allow x to run over 150 – tdanner1993 Jul 21 '16 at 13:42
  • So, the model is likely to be infeasible. – Erwin Kalvelagen Jul 21 '16 at 13:48
  • Any idea what some common causes are that make the model infeasible? Does this type of constraint normally work in a solver? Perhaps there are other reasons my solver is infeasible. – tdanner1993 Jul 21 '16 at 13:56
  • Most common causes are errors in the model or the data. – Erwin Kalvelagen Jul 21 '16 at 14:10