Soft constraints in gurobi

1.6k views Asked by At

I have a LP problem with some hard constraints and some soft constraints. I know slack variables can be used to emulate soft constraints (add slack variables in soft constraints and have a penalty to objective function). But this increases the number of variables in my LP.

Is there any other way to add soft-constraints in gurobi?

2

There are 2 answers

0
Greg Glockner On

Gurobi Optimizer has no special feature for soft constraints. You should add them via slack or surplus variables. And even if it did, it would simply add the slack or surplus variables to your model.

0
Ioannis On

Too long to fit as a comment so I post it here.

One thing you may want to try is multiple or hierarchical objectives, which Gurobi allows you to have (see here).

This can be similar to having soft constraints (this might be useful).

Do not worry too much about increasing the number of variables: in itself is not a problem in most cases.