Skip to main content

Infeasibility Relaxation with Gurobi

Answered

Comments

6 comments

  • Riley Clement
    • Gurobi Staff

    Hi Nitin,

    Note that in the documentation you linked it states the following for the vars parameter:

    vars: Variables whose bounds are allowed to be violated. 

    The function is expecting a collection of variables, such as a list, which is why vars=False is causing an error.

    - Riley

    0
  • Nitin Singh
    • Gurobi-versary
    • Conversationalist
    • First Question

    But what if I don't want the relaxation to play with the variable bounds, but only the RHS of the constraints? 

    0
  • Riley Clement
    • Gurobi Staff

    Passing an empty list as an argument is acceptable.

    - Riley

    1
  • Nitin Singh
    • Gurobi-versary
    • Conversationalist
    • First Question

    I just did that. Thanks.
    My bad that I thought it was a boolean.

    0
  • Nitin Singh
    • Gurobi-versary
    • Conversationalist
    • First Question

    Riley Clement
    I have a follow up question on this. For the same infeasible model (now I am not filtering down any constraint for this relaxation exercise):
    If I try model.feasRelax as follows:

    self.gurobi_model.feasRelax(
                  relaxobjtype=0, minrelax=False, vars=[], lbpen=None, ubpen=None,
                  constrs=self.gurobi_model.getConstrs(), rhspen=None
                )

    The model still remains infeasible, however if I use the model.feasRelaxS as:

    self.gurobi_model.feasRelaxS(
                  relaxobjtype=0, minrelax=False, vrelax=False, crelax=True
                )

    , I am able to arrive at a possible feasibility relaxation. 

    What is likely to cause this difference in the behavior?

    Thanks

    0
  • Riley Clement
    • Gurobi Staff

    Hi Nitin,

    The rhspen parameter needs values if you are providing constraints to be relaxed.

    rhspen: Penalty for violating a linear constraint. One entry for each constraint in argument constrs

    If you use

    rhspen=[1]*len(m.getConstrs())

    then you will get equivalent results to feasRelaxS.

    - Riley

    0

Please sign in to leave a comment.