SOS2 in convex piecewise linear constraint
AnsweredHello!
In my model, I use a convex piecewise linear function in a constraint with mod.addGenConstrPWL. Due to the function's convexity, the SOS2 constraints are not needed, and I would like my model to be solved without the SOS2 constraints as I predict that the computation time will be smaller without these extra constraints that are not necessary. How can I avoid the inclusion of the SOS2 constraints when I use mod.addGenConstrPWL?
Further, are there benefits in using Gurobis mod.addGenConstrPWL compared to modelling the piecewise linear constraints "by hand"?
Happy for any insights :)
-
Official comment
This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Christin,
How can I avoid the inclusion of the SOS2 constraints when I use mod.addGenConstrPWL?
Currently, there is no way to avoid the introduction of the SOS2 constraint as it is added by default. You are right that due to the convexity of the PWL function, it would not be needed. This case is on our radar and part of the future roadmap. For now, if you know that your PWL constraint is convex, you should implement it "by hand".
Further, are there benefits in using Gurobis mod.addGenConstrPWL compared to modelling the piecewise linear constraints "by hand"?
The main benefit is the convenience factor. There are also other smaller benefits like possible better presolve reductions but these rarely have a huge impact on the solution process. In general, you could implement the PWL function yourself and the solver behavior should be more or less the same.
Best regards,
Jaromił0
Post is closed for comments.
Comments
2 comments