[CP-SAT] add BoolVar class to the java modelling layer

This commit is contained in:
Laurent Perron
2022-01-03 18:57:09 +01:00
parent 9dfc47c364
commit 6144215236
27 changed files with 286 additions and 157 deletions

View File

@@ -14,6 +14,7 @@
package com.google.ortools.sat.samples;
import com.google.ortools.Loader;
import com.google.ortools.sat.BoolVar;
import com.google.ortools.sat.CpModel;
import com.google.ortools.sat.CpSolver;
import com.google.ortools.sat.CpSolverSolutionCallback;
@@ -33,7 +34,7 @@ public class ChannelingSampleSat {
IntVar[] vars = new IntVar[] {model.newIntVar(0, 10, "x"), model.newIntVar(0, 10, "y")};
// Declare our intermediate boolean variable.
IntVar b = model.newBoolVar("b");
BoolVar b = model.newBoolVar("b");
// Implement b == (x >= 5).
model.addGreaterOrEqual(vars[0], 5).onlyEnforceIf(b);