Update java samples
This commit is contained in:
committed by
Mizux Seiha
parent
105e1c3f26
commit
e8f6e86afd
@@ -22,9 +22,9 @@ import com.google.ortools.linearsolver.MPSolver;
|
||||
import com.google.ortools.linearsolver.MPVariable;
|
||||
// [END import]
|
||||
|
||||
/** Minimal Linear Programming example to showcase calling the solver.*/
|
||||
public class BasicExample {
|
||||
public static void main(String[] args) throws Exception {
|
||||
/** Minimal Linear Programming example to showcase calling the solver. */
|
||||
public final class BasicExample {
|
||||
public static void main(String[] args) {
|
||||
Loader.loadNativeLibraries();
|
||||
// [START solver]
|
||||
// Create the linear solver with the GLOP backend.
|
||||
@@ -67,5 +67,7 @@ public class BasicExample {
|
||||
System.out.println("y = " + y.solutionValue());
|
||||
// [END print_solution]
|
||||
}
|
||||
|
||||
private BasicExample() {}
|
||||
}
|
||||
// [END program]
|
||||
|
||||
@@ -21,9 +21,9 @@ import com.google.ortools.linearsolver.MPSolver;
|
||||
import com.google.ortools.linearsolver.MPVariable;
|
||||
// [END import]
|
||||
|
||||
/** Simple linear programming example.*/
|
||||
public class LinearProgrammingExample {
|
||||
public static void main(String[] args) throws Exception {
|
||||
/** Simple linear programming example. */
|
||||
public final class LinearProgrammingExample {
|
||||
public static void main(String[] args) {
|
||||
Loader.loadNativeLibraries();
|
||||
// [START solver]
|
||||
MPSolver solver = MPSolver.createSolver("GLOP");
|
||||
@@ -84,5 +84,7 @@ public class LinearProgrammingExample {
|
||||
System.out.println("Problem solved in " + solver.iterations() + " iterations");
|
||||
// [END advanced]
|
||||
}
|
||||
|
||||
private LinearProgrammingExample() {}
|
||||
}
|
||||
// [END program]
|
||||
|
||||
@@ -22,9 +22,9 @@ import com.google.ortools.linearsolver.MPSolver;
|
||||
import com.google.ortools.linearsolver.MPVariable;
|
||||
// [END import]
|
||||
|
||||
/** Minimal Linear Programming example to showcase calling the solver.*/
|
||||
public class SimpleLpProgram {
|
||||
public static void main(String[] args) throws Exception {
|
||||
/** Minimal Linear Programming example to showcase calling the solver. */
|
||||
public final class SimpleLpProgram {
|
||||
public static void main(String[] args) {
|
||||
Loader.loadNativeLibraries();
|
||||
// [START solver]
|
||||
// Create the linear solver with the GLOP backend.
|
||||
@@ -87,5 +87,7 @@ public class SimpleLpProgram {
|
||||
System.out.println("Problem solved in " + solver.iterations() + " iterations");
|
||||
// [END advanced]
|
||||
}
|
||||
|
||||
private SimpleLpProgram() {}
|
||||
}
|
||||
// [END program]
|
||||
|
||||
@@ -23,8 +23,8 @@ import com.google.ortools.linearsolver.MPVariable;
|
||||
// [END import]
|
||||
|
||||
/** Minimal Mixed Integer Programming example to showcase calling the solver. */
|
||||
public class SimpleMipProgram {
|
||||
public static void main(String[] args) throws Exception {
|
||||
public final class SimpleMipProgram {
|
||||
public static void main(String[] args) {
|
||||
Loader.loadNativeLibraries();
|
||||
// [START solver]
|
||||
// Create the linear solver with the SCIP backend.
|
||||
@@ -88,5 +88,7 @@ public class SimpleMipProgram {
|
||||
System.out.println("Problem solved in " + solver.nodes() + " branch-and-bound nodes");
|
||||
// [END advanced]
|
||||
}
|
||||
|
||||
private SimpleMipProgram() {}
|
||||
}
|
||||
// [END program]
|
||||
|
||||
Reference in New Issue
Block a user