Skip to content

Commit

Permalink
fix: get rid of annoying "File already contains basis" warning in cpl…
Browse files Browse the repository at this point in the history
…ex_interface
  • Loading branch information
phantomas1234 committed Aug 31, 2016
1 parent ae74974 commit d2fc255
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions optlang/cplex_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,13 +602,14 @@ def __getstate__(self):
def __setstate__(self, repr_dict):
tmp_file = tempfile.mktemp(suffix=".sav")
open(tmp_file, 'wb').write(repr_dict['cplex_binary'])
problem = cplex.Cplex(tmp_file)
problem = cplex.Cplex()
# turn off logging completely, get's configured later
problem.set_error_stream(None)
problem.set_warning_stream(None)
problem.set_log_stream(None)
problem.set_results_stream(None)
problem.read(tmp_file)
if repr_dict['status'] == 'optimal':
# turn off logging completely, get's configured later
problem.set_error_stream(None)
problem.set_warning_stream(None)
problem.set_log_stream(None)
problem.set_results_stream(None)
problem.solve() # since the start is an optimal solution, nothing will happen here
self.__init__(problem=problem)
self.configuration = Configuration.clone(repr_dict['config'], problem=self)
Expand Down

0 comments on commit d2fc255

Please sign in to comment.