Gurobi.GRBException:“Element 0 of a double array is Nan.”
Awaiting user inputHi,
I have a problem when I try to solve a nonlinear mixed integer problem in Gurobi and its nonlinearity is due to the existence of Napierian Logarithm. But this Gurobi.GRBException:“Element 0 of a double array is Nan.” occur in the following constraint:
model.AddConstr(StaticData.GraShare[t, h, i, j] * Share[t, h, i, j] - StaticData.GraShare[t, h, i, j] * StaticData.LowerShare[t, h, i, j] + StaticData.LnLowerShare[t, h, i, j] - LnTUtility[t, i, j] - StaticData.Alpha[h, i, j] >= Price[t, h, i, j] * StaticData.Beta[h, i, j], "c4");
Can someone help me?
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Can you please post a minimal, self-contained code example that reproduces the issue?
How are you modeling the Napierian logarithm? Note that Gurobi can handle general quadratic constraints, but it is not a general nonlinear solver (see What types of models can Gurobi solve?). However, Gurobi supports modeling certain nonlinear functions, which are then translated internally to piecewise-linear approximations of these functions. So, you could model the Napierian logarithm using GRBModel.AddGenConstrLog() as a starting point. Alternatively, you could build your own piecewise-linear approximation of the Napierian logarithm.
0
Post is closed for comments.
Comments
2 comments