Skip to content

Commit

Permalink
Fix test with USE_SCIP=OFF
Browse files Browse the repository at this point in the history
  • Loading branch information
lperron committed Jul 21, 2023
1 parent ab287aa commit 3840120
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ortools/algorithms/python/knapsack_solver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ def SolveKnapsackProblem(self, profits, weights, capacities):
# KNAPSACK_MULTIDIMENSION_CBC_MIP_SOLVER)
# if cbc_profit != generic_profit:
# return self._invalid_solution

scip_profit = self.SolveKnapsackProblemUsingSpecificSolver(
profits,
weights,
capacities,
knapsack_solver.SolverType.KNAPSACK_MULTIDIMENSION_SCIP_MIP_SOLVER,
)
if scip_profit != generic_profit:
return self._invalid_solution
try:
scip_profit = self.SolveKnapsackProblemUsingSpecificSolver(
profits,
weights,
capacities,
knapsack_solver.SolverType.KNAPSACK_MULTIDIMENSION_SCIP_MIP_SOLVER,
)
if scip_profit != generic_profit:
return self._invalid_solution
except AttributeError:
print("SCIP support not compiled in")

if len(weights) > 1:
return generic_profit
Expand Down

0 comments on commit 3840120

Please sign in to comment.