Search code examples
pythonmathematical-optimizationlinear-programminggurobimathematical-expressions

How to find the non-zero minimum value in the objective function of a mathematical model


It is a mathematical model. x is the 0-1 decision variable, and c is Non-negative coefficients. The tricky problem I'm facing now is how to find that non-zero minimum value in a series of cx. The objective function is as follows.

enter image description here

Now, I want to find the minimum element in this equation which means the minimum number (c) selected by decision virables (x). However, when an element is not selected, cx for this element equals 0. Because c>0, then, the objective function equals 0. That's not what I want.

How to modify this objective function? Adding variables, non-linearity are allowed. I hope to solve this problem with gurobi. How to deal with the modified fuction for gurobi? (Linearization? Gurobi's built-in functions?)

Thanks!


Solution

  • You could introduce an auxiliary continuous variable Zi for every binary decision variable Xi.

    Then add constraints for all Zi:

    Zi = Xi * Ci + (1-Xi) * BIG_NUMBER
    

    Due to this constraint, Zi is either Ci or BIG_NUMBER. You can then take the minimum of all Zi as your objective.

    Have a look at this article about conditional statements and indicator constraints.