Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def conscheck(self, constraints, solution, check_integrality,
check_lp_rows, print_reason, completely, **results):
if self.find_subtours(solution):
return {"result": SCIP_RESULT.INFEASIBLE}
else:
return {"result": SCIP_RESULT.FEASIBLE}
self.model.setupBendersSubproblem(probnumber, self, solution)
self.subprob.solveProbingLP()
subprob = self.model.getBendersSubproblem(probnumber, self)
assert self.subprob.getObjVal() == subprob.getObjVal()
result_dict = {}
objective = subprob.infinity()
result = SCIP_RESULT.DIDNOTRUN
lpsolstat = self.subprob.getLPSolstat()
if lpsolstat == SCIP_LPSOLSTAT.OPTIMAL:
objective = self.subprob.getObjVal()
result = SCIP_RESULT.FEASIBLE
elif lpsolstat == SCIP_LPSOLSTAT.INFEASIBLE:
objective = self.subprob.infinity()
result = SCIP_RESULT.INFEASIBLE
elif lpsolstat == SCIP_LPSOLSTAT.UNBOUNDEDRAY:
objective = self.subprob.infinity()
result = SCIP_RESULT.UNBOUNDED
result_dict["objective"] = objective
result_dict["result"] = result
return result_dict
def conscheck(self, constraints, solution, check_integrality, check_lp_rows, print_reason, completely):
for cons in constraints:
if not self.is_cons_feasible(cons, solution):
return {"result": SCIP_RESULT.INFEASIBLE}
return {"result": SCIP_RESULT.FEASIBLE}
self.model.setupBendersSubproblem(probnumber, self, solution)
self.subprob.solveProbingLP()
subprob = self.model.getBendersSubproblem(probnumber, self)
assert self.subprob.getObjVal() == subprob.getObjVal()
result_dict = {}
objective = subprob.infinity()
result = SCIP_RESULT.DIDNOTRUN
lpsolstat = self.subprob.getLPSolstat()
if lpsolstat == SCIP_LPSOLSTAT.OPTIMAL:
objective = self.subprob.getObjVal()
result = SCIP_RESULT.FEASIBLE
elif lpsolstat == SCIP_LPSOLSTAT.INFEASIBLE:
objective = self.subprob.infinity()
result = SCIP_RESULT.INFEASIBLE
elif lpsolstat == SCIP_LPSOLSTAT.UNBOUNDEDRAY:
objective = self.subprob.infinity()
result = SCIP_RESULT.UNBOUNDED
result_dict["objective"] = objective
result_dict["result"] = result
return result_dict
def conscheck(self, constraints, solution, checkintegrality, checklprows, printreason):
if self.addCuts(checkonly = True):
return {"result": SCIP_RESULT.INFEASIBLE}
else:
return {"result": SCIP_RESULT.FEASIBLE}
def conscheck(self, constraints, solution, checkintegrality, checklprows, printreason):
if self.findSubtours(checkonly = True, sol = solution):
return {"result": SCIP_RESULT.INFEASIBLE}
else:
return {"result": SCIP_RESULT.FEASIBLE}
def conscheck(self, constraints, solution, checkintegrality, checklprows, printreason, completely):
if not self.addcut(checkonly = True, sol = solution):
return {"result": SCIP_RESULT.INFEASIBLE}
else:
return {"result": SCIP_RESULT.FEASIBLE}