Making constraints non-binding
OngoingHi. I have a set of constraints that I want to active them dynamically, i.e., when a certain binary variable is for example 0, activates constraints which changes the values of variables, otherwise, don't change them by deactivating the constraint (or making it non-binding). This problem gets even more complex, if in some of these constraints we are trying to obtain another binary variable with big M method. I specifically mentioned this as we cannot easily use big M method for making the constraint non-binding, since we have already another binary variable to be determined in the constraint, which cancels the non-binding binary variable. to understand the problem better, take a look a the constraints written below. We have a binary variable 'BETA' for considering activation of the constraint; if 'BETA == 0', the constraint is binding, otherwise is non-binding. Further, the constraint written has binary variable 'gamma' to be determined. How we can manage this? Consider that there are a lot of these constraints that have the same issue. I have also tried indicator constraints but Gurobi cannot support for loops within the indicator constraint which brings more complexity in the case of constraint arrangement since some constraints require a combination of different for loops for indices and some other wouldn't.
self.model.addConstr(self.Q_prime[t, d, m, k] >= 1 - big_M * (1 - self.BETA[t, d, m, k]))
self.model.addConstr(self.Y[d, n, k] <= t + big_M * (1 - self.gama[t, d, n, k]))
-
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. -
The constraints
self.model.addConstr(self.Q_prime[t, d, m, k] >= 1 - big_M * (1 - self.BETA[t, d, m, k]))
self.model.addConstr(self.Y[d, n, k] <= t + big_M * (1 - self.gama[t, d, n, k]))will be "active" if the BETA and gama variables take the value 1, respectively.
These can be modelled by adding two indicator constraints:
self.model.addConstr( (self.BETA[t, d, m, k]==1) >> (self.Q_prime[t, d, m, k] >= 1) )
self.model.addConstr( (self.gama[t, d, n, k]==1) >> (self.Y[d, n, k] <= t) )Would this not work for your model?
0 -
Thank you for your response. I'm using Gurobi 13.0.0, and doesn't support this way. Eventually, I linearized the combination of these binary variables, and put the combination as the condition of indicator constraint instead of writing them in chain. Now I have another question. I want to make a new matrix of variables of matrix divided by the sum of all variables of that matrix. Since this not a linear operation, how can I linearize it?
0
Post is closed for comments.
Comments
3 comments