Skip to content

Commit

Permalink
Merge 4c0c20e into 5d4a891
Browse files Browse the repository at this point in the history
  • Loading branch information
garrison committed May 3, 2023
2 parents 5d4a891 + 4c0c20e commit f3f13df
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,13 @@ def solve(self, min_postprocessing_cost: float) -> bool:
min_postprocessing_cost,
str(type(min_postprocessing_cost)),
)
self.model.export_as_lp(path="./docplex_cutter.lp")
try:
self.model.export_as_lp(path="./docplex_cutter.lp")
except RuntimeError:
print(
"The LP file export has failed. This is known to happen sometimes "
"when cplex is not installed. Now attempting to continue anyway."
)
try:
self.model.set_time_limit(300)
if min_postprocessing_cost != float("inf"):
Expand All @@ -504,12 +510,12 @@ def solve(self, min_postprocessing_cost: float) -> bool:

except DOcplexException as e:
print("Caught: " + e.message)
raise e

if self.model._has_solution:
my_solve_details = self.model.solve_details
self.objective = None
self.subcircuits = []
self.optimal = self.model.get_solve_status() == "optimal"
self.optimal = my_solve_details.status == "optimal"
self.runtime = my_solve_details.time
self.node_count = my_solve_details.nb_nodes_processed
self.mip_gap = my_solve_details.mip_relative_gap
Expand Down

0 comments on commit f3f13df

Please sign in to comment.