polish java reindent

This commit is contained in:
Laurent Perron
2018-11-10 23:56:52 +01:00
parent 837cdbbbc8
commit b24929a9ed
27 changed files with 245 additions and 264 deletions

View File

@@ -22,12 +22,14 @@ import com.google.ortools.linearsolver.MPVariable;
*/
public class IntegerProgramming {
static { System.loadLibrary("jniortools"); }
static {
System.loadLibrary("jniortools");
}
private static MPSolver createSolver(String solverType) {
try {
return new MPSolver("IntegerProgrammingExample",
MPSolver.OptimizationProblemType.valueOf(solverType));
return new MPSolver(
"IntegerProgrammingExample", MPSolver.OptimizationProblemType.valueOf(solverType));
} catch (java.lang.IllegalArgumentException e) {
System.err.println("Bad solver type: " + e);
return null;
@@ -67,29 +69,25 @@ public class IntegerProgramming {
// others than GLOP_LINEAR_PROGRAMMING, this is highly recommended!).
if (!solver.verifySolution(/*tolerance=*/1e-7, /*logErrors=*/true)) {
System.err.println("The solution returned by the solver violated the"
+ " problem constraints by at least 1e-7");
+ " problem constraints by at least 1e-7");
return;
}
System.out.println("Problem solved in " + solver.wallTime() +
" milliseconds");
System.out.println("Problem solved in " + solver.wallTime() + " milliseconds");
// The objective value of the solution.
System.out.println("Optimal objective value = " +
solver.objective().value());
System.out.println("Optimal objective value = " + solver.objective().value());
// The value of each variable in the solution.
System.out.println("x1 = " + x1.solutionValue());
System.out.println("x2 = " + x2.solutionValue());
System.out.println("Advanced usage:");
System.out.println("Problem solved in " + solver.nodes() +
" branch-and-bound nodes");
System.out.println("Problem solved in " + solver.nodes() + " branch-and-bound nodes");
}
public static void main(String[] args) throws Exception {
System.out.println(
"---- Integer programming example with SCIP (recommended) ----");
System.out.println("---- Integer programming example with SCIP (recommended) ----");
runIntegerProgrammingExample("SCIP_MIXED_INTEGER_PROGRAMMING");
System.out.println("---- Integer programming example with CBC ----");
runIntegerProgrammingExample("CBC_MIXED_INTEGER_PROGRAMMING");