mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 09:28:51 -06:00
Silence debug statements
This commit is contained in:
@@ -28,7 +28,7 @@ class InstanceIterator:
|
||||
result = self.instances[self.current]
|
||||
self.current += 1
|
||||
if isinstance(result, str):
|
||||
logger.info("Read: %s" % result)
|
||||
logger.debug("Read: %s" % result)
|
||||
if result.endswith(".gz"):
|
||||
with gzip.GzipFile(result, "rb") as file:
|
||||
result = pickle.load(file)
|
||||
|
||||
@@ -84,16 +84,17 @@ class GurobiSolver(InternalSolver):
|
||||
self._bin_vars[name] = {}
|
||||
self._bin_vars[name][idx] = var
|
||||
|
||||
def _apply_params(self):
|
||||
for (name, value) in self.params.items():
|
||||
self.model.setParam(name, value)
|
||||
def _apply_params(self, streams):
|
||||
with RedirectOutput(streams):
|
||||
for (name, value) in self.params.items():
|
||||
self.model.setParam(name, value)
|
||||
|
||||
def solve_lp(self, tee=False):
|
||||
self._raise_if_callback()
|
||||
self._apply_params()
|
||||
streams = [StringIO()]
|
||||
if tee:
|
||||
streams += [sys.stdout]
|
||||
self._apply_params(streams)
|
||||
for (varname, vardict) in self._bin_vars.items():
|
||||
for (idx, var) in vardict.items():
|
||||
var.vtype = self.GRB.CONTINUOUS
|
||||
@@ -122,12 +123,12 @@ class GurobiSolver(InternalSolver):
|
||||
|
||||
if lazy_cb:
|
||||
self.params["LazyConstraints"] = 1
|
||||
self._apply_params()
|
||||
total_wallclock_time = 0
|
||||
total_nodes = 0
|
||||
streams = [StringIO()]
|
||||
if tee:
|
||||
streams += [sys.stdout]
|
||||
self._apply_params(streams)
|
||||
if iteration_cb is None:
|
||||
iteration_cb = lambda: False
|
||||
while True:
|
||||
|
||||
@@ -12,6 +12,7 @@ from copy import deepcopy
|
||||
from typing import Optional, List
|
||||
from p_tqdm import p_map
|
||||
|
||||
from . import RedirectOutput
|
||||
from .. import (
|
||||
ObjectiveValueComponent,
|
||||
PrimalSolutionComponent,
|
||||
@@ -38,7 +39,6 @@ def _parallel_solve(idx):
|
||||
else:
|
||||
output = OUTPUTS[0][idx]
|
||||
instance = INSTANCES[0][idx]
|
||||
print(instance)
|
||||
stats = solver.solve(instance, output=output)
|
||||
return (stats, instance)
|
||||
|
||||
@@ -219,6 +219,7 @@ class LearningSolver:
|
||||
instance = pickle.load(file)
|
||||
|
||||
if model is None:
|
||||
with RedirectOutput([]):
|
||||
model = instance.to_model()
|
||||
|
||||
self.tee = tee
|
||||
|
||||
Reference in New Issue
Block a user