Restore add_constraint method

This commit is contained in:
2020-03-05 16:15:11 -06:00
parent 19453f5ee5
commit 303750a7dd

View File

@@ -127,7 +127,10 @@ class InternalSolver:
self.solver.update_var(var[index]) self.solver.update_var(var[index])
logger.info("Fixing values for %d variables (out of %d)" % logger.info("Fixing values for %d variables (out of %d)" %
(count_fixed, count_total)) (count_fixed, count_total))
def add_constraint(self, cut):
self.solver.add_constraint(cut)
def solve(self, tee=False): def solve(self, tee=False):
total_wallclock_time = 0 total_wallclock_time = 0
self.instance.found_violations = [] self.instance.found_violations = []
@@ -145,7 +148,7 @@ class InternalSolver:
logger.debug(" %d violations found" % len(violations)) logger.debug(" %d violations found" % len(violations))
for v in violations: for v in violations:
cut = self.instance.build_lazy_constraint(self.model, v) cut = self.instance.build_lazy_constraint(self.model, v)
self.solver.add_constraint(cut) self.add_constraint(cut)
return { return {
"Lower bound": results["Problem"][0]["Lower bound"], "Lower bound": results["Problem"][0]["Lower bound"],