large sync with main

This commit is contained in:
Laurent Perron
2025-03-07 10:33:36 +01:00
parent cf72696d00
commit a4b37b6465
82 changed files with 3362 additions and 2363 deletions

View File

@@ -19,10 +19,7 @@ import com.google.ortools.linearsolver.MPObjective;
import com.google.ortools.linearsolver.MPSolver;
import com.google.ortools.linearsolver.MPVariable;
/**
* Integer programming example that shows how to use the API.
*
*/
/** Integer programming example that shows how to use the API. */
public class IntegerProgramming {
private static void runIntegerProgrammingExample(String solverType) {
MPSolver solver = MPSolver.createSolver(solverType);
@@ -55,7 +52,7 @@ public class IntegerProgramming {
// Verify that the solution satisfies all constraints (when using solvers
// others than GLOP_LINEAR_PROGRAMMING, this is highly recommended!).
if (!solver.verifySolution(/*tolerance=*/1e-7, /* log_errors= */ true)) {
if (!solver.verifySolution(/* tolerance= */ 1e-7, /* log_errors= */ true)) {
System.err.println("The solution returned by the solver violated the"
+ " problem constraints by at least 1e-7");
return;

View File

@@ -30,7 +30,7 @@ public class LinearProgramming {
System.out.println("Could not create solver " + solverType);
return;
}
double infinity = java.lang.Double.POSITIVE_INFINITY;
double infinity = Double.POSITIVE_INFINITY;
// x1, x2 and x3 are continuous non-negative variables.
MPVariable x1 = solver.makeNumVar(0.0, infinity, "x1");
MPVariable x2 = solver.makeNumVar(0.0, infinity, "x2");
@@ -65,7 +65,7 @@ public class LinearProgramming {
System.out.println("Number of constraints = " + solver.numConstraints());
if (printModel) {
String model = solver.exportModelAsLpFormat(/* obfuscate = */false);
String model = solver.exportModelAsLpFormat(/* obfuscate= */ false);
System.out.println(model);
}
@@ -79,7 +79,7 @@ public class LinearProgramming {
// Verify that the solution satisfies all constraints (when using solvers
// others than GLOP_LINEAR_PROGRAMMING, this is highly recommended!).
if (!solver.verifySolution(/*tolerance=*/1e-7, /* log_errors= */ true)) {
if (!solver.verifySolution(/* tolerance= */ 1e-7, /* log_errors= */ true)) {
System.err.println("The solution returned by the solver violated the"
+ " problem constraints by at least 1e-7");
return;