mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 01:18:52 -06:00
BasicCollector: Make log file optional
This commit is contained in:
@@ -17,9 +17,15 @@ from ..parallel import p_umap
|
||||
|
||||
|
||||
class BasicCollector:
|
||||
def __init__(self, skip_lp: bool = False, write_mps: bool = True) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
skip_lp: bool = False,
|
||||
write_mps: bool = True,
|
||||
write_log: bool = True,
|
||||
) -> None:
|
||||
self.skip_lp = skip_lp
|
||||
self.write_mps = write_mps
|
||||
self.write_log = write_log
|
||||
|
||||
def collect(
|
||||
self,
|
||||
@@ -80,6 +86,7 @@ class BasicCollector:
|
||||
|
||||
log = streams[0].getvalue()
|
||||
h5.put_scalar("mip_log", log)
|
||||
if self.write_log:
|
||||
with open(log_filename, "w") as log_file:
|
||||
log_file.write(log)
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user