Using "addGenConstrPow" but model is infeasible
AnsweredHello together,
I am trying to solve an easy power function for "x = 20 + A" with A=200, but it is infeasible. I do not understand why. If I set my variable A = 0 it is feasible. Thank you.
Here is my example:
model = gp.Model("test")
A = 200
x0 = model.addVar(vtype=GRB.CONTINUOUS, name="x0")
x = model.addVar(vtype=GRB.CONTINUOUS, name="x")
x_pow4 = model.addVar(vtype=GRB.CONTINUOUS, name="x_pow4")
model.addConstr(x0 == 20)
model.addConstr(x == x0 + A)
model.addGenConstrPow(x,x_pow4,4)
model.optimize()-
Hi Jack,
The issue is caused by the default value of the FuncMaxVal parameter which is 1e+6. This limits the bounds on variables participating in general constraints, but \(220^4 > 10^6\). Thus, your model is declared as infeasible.
To avoid this, you have to set the parameter to a larger value, e.g.,
model.setParam("FuncMaxVal",10e+20)Please note that working with such large values is not recommended. So, if you want to extend your model and indeed work with the value of \(\texttt{x_pow4}\) in an extension of your model, then this might very likely lead to numerical issues.
Best regards,
Jaromił0 -
Hi Jaromil,
thank you very much for your advice!
Unfortunately, we have this big values in thermodynamics when working with absolute temperatures.. Is there a suggestion to reduce the possibility of numerical issues? I was thinking of a way to limit the value range of the function.. or is it done when defining upper and lower bounds to the variables?
0 -
Hi Jack,
Unfortunately, we have this big values in thermodynamics when working with absolute temperatures.. Is there a suggestion to reduce the possibility of numerical issues? I was thinking of a way to limit the value range of the function.. or is it done when defining upper and lower bounds to the variables?
I understand. You could re-scale the orders of magnitude, e.g., say that 1 unit for some variable equals 1000 degrees instead of 1. This would already scale the values by 4 orders of magnitude. For more detailed tips, please have a look at our Guidelines for Numerical Issues.
0
Please sign in to leave a comment.
Comments
3 comments