mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 17:38:51 -06:00
Add option to solve root relaxation only
This commit is contained in:
@@ -176,7 +176,12 @@ class LearningSolver:
|
|||||||
solver.set_gap_tolerance(self.gap_tolerance)
|
solver.set_gap_tolerance(self.gap_tolerance)
|
||||||
return solver
|
return solver
|
||||||
|
|
||||||
def solve(self, instance, model=None, tee=False):
|
def solve(self,
|
||||||
|
instance,
|
||||||
|
model=None,
|
||||||
|
tee=False,
|
||||||
|
relaxation_only=False,
|
||||||
|
):
|
||||||
if model is None:
|
if model is None:
|
||||||
model = instance.to_model()
|
model = instance.to_model()
|
||||||
|
|
||||||
@@ -187,6 +192,8 @@ class LearningSolver:
|
|||||||
results = self.internal_solver.solve_lp(model, tee=tee)
|
results = self.internal_solver.solve_lp(model, tee=tee)
|
||||||
instance.lp_solution = self.internal_solver.get_solution(model)
|
instance.lp_solution = self.internal_solver.get_solution(model)
|
||||||
instance.lp_value = results["Optimal value"]
|
instance.lp_value = results["Optimal value"]
|
||||||
|
if relaxation_only:
|
||||||
|
return results
|
||||||
|
|
||||||
# Invoke before_solve callbacks
|
# Invoke before_solve callbacks
|
||||||
for component in self.components.values():
|
for component in self.components.values():
|
||||||
|
|||||||
Reference in New Issue
Block a user