Search code examples
optimizationmathematical-optimizationamplcost-based-optimizer

Constraints for Minimizing and their Bounds


I have a little confusion in the optimization model I trying to solve. Its a small model to minimize the cost of two units. I have just started with the optimization and I am not sure if I am interpreting the problem very well into AMPL. Especially regarding the minimization constraints and their bounds.

I have to two decision variables as Units in my models. Cost of u1 is 10 and u2 is 13. And the limit on the u1 is that you can not make more than 100 units and for u2 is 50 units. I got different results by reversing the bounds of this minimization problem. Can anyone help me interpret whats happening?


var u1 >=0; var u2 >=0;

minimize costofunits: 10*u1 +13*u2;

subject to unit1: 0 <= u1 <= 100; subject to unit2: 0 <= u2 <= 50;


With above constraints I have output as:

CPLEX 12.8.0.0: optimal solution; objective 0 0 dual simplex iterations (0 in phase I) Objective is: 0.000000 : _varname _var := 1 u1 0 2 u2 0 ;

: _objname _obj := 1 costofunits 0 ;

: _conname _con := 1 unit1 0 2 unit2 0

;

Reversing the Constraints:

subject to unit1: 100 <= u1 <= 0; subject to unit2: 50 <= u2 <= 0;

OUTPUT AS:

inconsistent bounds for constraint unit1: lower bound = 100 > upper bound = 0

inconsistent bounds for constraint unit2: lower bound = 50 > upper bound = 0 Infeasible constraints determined by presolve. Objective is: 825.000000 : _varname _var := 1 u1 50 2 u2 25 ;

: _objname _obj := 1 costofunits 825 ;

: _conname _con := 1 unit1 10 2 unit2 13 ;


Solution

  • For your first problem: as you've defined the problem, the objective is to minimize costs, and the easiest solution is simply to make zero of everything, for zero cost.

    For your second problem, the error message explains the problem. You have set a lower bound of 100 for u1 (100 <= u1) and also an upper bound of 0 (u1 <= 0). Obviously there is no possible number that would satisfy both of these requirements at once. Instead of "<=" in your constraints, you should be using ">=" here, assuming you want to bound u1 between 100 and 0.

    Same issue for unit2 constraint.