Activating slack variables (and penalty costs) to exceed bounds on variables and constraints #4337
Replies: 1 comment
-
I would recommend doing this by hand. We generally try to not have primitives that the underlying solvers don't support, so that the translation from mathopt to each solver is predictable, and I don't think what you want is generally supported. You could try and partially model this using z = max(x, y) or z = abs(x), which some solvers support, but again I would not recommend this. What you really want to model is min z which is just two linear constraints when reformulated to LP. If you use the primitive for z = abs(x), then the solver might reformulate this as a MIP constraint, which will hurt performance. We have had some discussion about making an API like IIS that computes the minimum change in RHS to make the the problem feasible, which kind of related to what you are saying, but it is only at a prototype at the moment. |
Beta Was this translation helpful? Give feedback.
-
In Mathopt, is there an easy way to introduce slack variables with penalty on existing constraints and variables?
For example, if I have a variable bounded between lb and ub, is there a mathopt method that allows the solver to make the variable go below lb (or above ub) with a user-specified cost/penalty in the objective function?
I know I can introduce these slack variables and penalty costs myself, manually. But I think it would be much cleaner using a mathopt-based method if it exists.
Beta Was this translation helpful? Give feedback.
All reactions