mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 09:28:51 -06:00
Restore add_constraint method
This commit is contained in:
@@ -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"],
|
||||||
|
|||||||
Reference in New Issue
Block a user