Add Samples from g3

This commit is contained in:
Corentin Le Molgat
2018-11-26 17:30:10 +01:00
parent 9991c88819
commit 0f7551551f
21 changed files with 1065 additions and 7 deletions

View File

@@ -18,6 +18,7 @@ import com.google.ortools.linearsolver.MPObjective;
import com.google.ortools.linearsolver.MPSolver;
import com.google.ortools.linearsolver.MPVariable;
/** Minimal Linear Programming example to showcase calling the solver.*/
public class SimpleLpProgram {
static {
System.loadLibrary("jniortools");
@@ -25,8 +26,8 @@ public class SimpleLpProgram {
public static void main(String[] args) throws Exception {
// Create the linear solver with the GLOP backend.
MPSolver solver = new MPSolver(
"SimpleLpProgram", MPSolver.OptimizationProblemType.valueOf("GLOP_LINEAR_PROGRAMMING"));
MPSolver solver =
new MPSolver("SimpleLpProgram", MPSolver.OptimizationProblemType.GLOP_LINEAR_PROGRAMMING);
// Create the variables x and y.
MPVariable x = solver.makeNumVar(0.0, 1.0, "x");