Skip to content

Commit

Permalink
catch ilpy v03 solution return type (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed May 3, 2023
1 parent 8f0a2f3 commit 8f19c55
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion motile/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .ssvm import fit_weights

logger = logging.getLogger(__name__)
ILPY_V03 = ilpy.__version__.split(".")[:2] >= ["0", "3"]

if TYPE_CHECKING:
from motile.costs import Costs
Expand Down Expand Up @@ -152,7 +153,12 @@ def solve(self, timeout: float = 0.0, num_threads: int = 1) -> ilpy.Solution:

self.ilp_solver.set_verbose(False)

self.solution, message = self.ilp_solver.solve()
solution = self.ilp_solver.solve()

if ILPY_V03:
self.solution, message = solution, solution.get_status()
else:
self.solution, message = solution
if message:
logger.info("ILP solver returned with: %s", message)

Expand Down

0 comments on commit 8f19c55

Please sign in to comment.