Skip to content

Commit 90bd24a

Browse files
committed
linear_solver: don't make samples crash if solver are unavailable
1 parent cde75c0 commit 90bd24a

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

ortools/linear_solver/samples/java/IntegerProgramming.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public class IntegerProgramming {
2424
private static void runIntegerProgrammingExample(String solverType) {
2525
MPSolver solver = MPSolver.createSolver(solverType);
2626
if (solver == null) {
27-
throw new AssertionError("Could not create solver " + solverType);
27+
System.out.println("Could not create solver " + solverType);
28+
return;
2829
}
2930
double infinity = Double.POSITIVE_INFINITY;
3031
// x1 and x2 are integer non-negative variables.

ortools/linear_solver/samples/java/LinearProgramming.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public class LinearProgramming {
2626
private static void runLinearProgrammingExample(String solverType, boolean printModel) {
2727
MPSolver solver = MPSolver.createSolver(solverType);
2828
if (solver == null) {
29-
throw new AssertionError("Could not create solver " + solverType);
29+
System.out.println("Could not create solver " + solverType);
30+
return;
3031
}
3132
double infinity = Double.POSITIVE_INFINITY;
3233
// x1, x2 and x3 are continuous non-negative variables.

0 commit comments

Comments
 (0)