Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
memberdualmult = membersubprob.getDualMultiplier(subprobcons)
if dualmult != memberdualmult:
print("The dual multipliers between the two subproblems are not "\
"the same.")
assert False
coeffs = [subprob.getDualMultiplier(self.benders.capacity[j])*\
self.M[j] for j in self.J]
self.model.addCons(self.model.getBendersAuxiliaryVar(probnumber,
self.benders) -
quicksum(self.model.getBendersVar(self.benders.subprob.data[1][j],
self.benders)*coeffs[j] for j in self.J) >= lhs)
return {"result" : SCIP_RESULT.CONSADDED}
if dualmult != memberdualmult:
print("The dual multipliers between the two subproblems are not "\
"the same.")
assert False
print("storing coefficients")
coeffs = [subprob.getDualMultiplier(self.benders.capacity[j])*\
self.M[j] for j in self.J]
print("adding the Benders' cut to the problem")
self.model.addCons(self.model.getBendersAuxiliaryVar(probnumber,
self.benders) -
quicksum(self.model.getBendersVar(self.benders.subprob.data[1][j],
self.benders)*coeffs[j] for j in self.J) >= lhs)
return {"result" : SCIP_RESULT.CONSADDED}
def consenfolp(self, constraints, n_useful_conss, sol_infeasible):
subtours = self.find_subtours()
if subtours:
x = self.variables
for subset in subtours:
self.model.addCons(quicksum(x[i, j] for(i, j) in pairs(subset))
<= len(subset) - 1)
print("cut: len(%s) <= %s" % (subset, len(subset) - 1))
return {"result": SCIP_RESULT.CONSADDED}
else:
return {"result": SCIP_RESULT.FEASIBLE}
def consenfolp(self, constraints, nusefulconss, solinfeasible):
if self.addCuts(checkonly = False):
return {"result": SCIP_RESULT.CONSADDED}
else:
return {"result": SCIP_RESULT.FEASIBLE}
def consenfolp(self, constraints, nusefulconss, solinfeasible):
if self.addcut(checkonly = False):
return {"result": SCIP_RESULT.CONSADDED}
else:
return {"result": SCIP_RESULT.FEASIBLE}
def consenfolp(self, constraints, nusefulconss, solinfeasible):
if self.findSubtours(checkonly = False, sol = None):
return {"result": SCIP_RESULT.CONSADDED}
else:
return {"result": SCIP_RESULT.FEASIBLE}