Skip to main content

Conditional addGenConstrLogA for pH calculation

Awaiting user input


1 comment

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Tim,

    You could introduce 5 auxiliary binary variables \(b_i\) and a constraint stating that exactly \(1\) of these binaries is \(>0\).

    \sum_i b_i &= 1\\
    b_i &\in \{0,1\}

    You can then use these binary variables in indicator constraints to model

    b_i = 1 &\rightarrow y_i = \log(x)\\
    b_i = 0 &\rightarrow y_i = 0

    You can then get the final value by adding all \(y_i\) variables.

    In your constraints, you always use the same argument variable


    This makes 4 out of the 5 constraints redundant. Is this a typo or is some piece of information missing?

    Best regards, 


Please sign in to leave a comment.