Skip to main content

Infeasibility due to modelling the constraints

Answered

Comments

3 comments

  • Simranjit Kaur
    Gurobi Staff Gurobi Staff

    Hi Priya,

    Variables in Gurobi, by default, take a lower bound of zero. If you expect a variable to take a negative value, please set its lower bound to an appropriate negative value.

    Best regards,
    Simran

    0
  • V priya
    Gurobi-versary
    First Comment
    First Question

    Thank you for the response.I uncommented the following also :

    mdl.addConstrs( U_a1[i,j]  >= U_lower_bar_a1[i,j] for i in range(0,n) for j in range(0,n))

     But I am getting an infeasible model. Could you please help?

    0
  • Simranjit Kaur
    Gurobi Staff Gurobi Staff

    Hi Priya,

    Uncommenting the following constraint will not help since the variable lower bound is still set to 0 by default.

    mdl.addConstrs( U_a1[i,j]  >= U_lower_bar_a1[i,j] for i in range(0,n) for j in range(0,n))

    You can define the lower bound and upper bound of your MVar variable U_a1 to the arrays U_lower_bar_a1 and U_upper_bar_a1 as follows:

    U_a1 = mdl.addMVar((n, n), lb=U_lower_bar_a1, ub=U_upper_bar_a1,  vtype=GRB.CONTINUOUS, name='U_a1')
    I hope this helps.
     
    Cheers,
    Simran
     
     
    0

Please sign in to leave a comment.