add C# samples to the SAT md doc

This commit is contained in:
Laurent Perron
2018-05-30 14:31:59 -07:00
parent 70dfbbfe46
commit e198505927
5 changed files with 148 additions and 8 deletions

View File

@@ -21,15 +21,15 @@ from ortools.sat.python import cp_model
def MinimalCpSat():
# Creates the model.
model = cp_model.CpModel()
# Creates the variables.
# Creates the variables.
num_vals = 3
x = model.NewIntVar(0, num_vals - 1, "x")
y = model.NewIntVar(0, num_vals - 1, "y")
z = model.NewIntVar(0, num_vals - 1, "z")
# Create the constraints.
# Creates the constraints.
model.Add(x != y)
# Create a solver and solve.
# Creates a solver and solves the model.
solver = cp_model.CpSolver()
status = solver.Solve(model)
@@ -59,7 +59,7 @@ class VarArraySolutionPrinter(cp_model.CpSolverSolutionCallback):
def MinimalCpSatAllSolutions():
# Creates the model.
model = cp_model.CpModel()
# Creates the variables.
# Creates the variables.
num_vals = 3
x = model.NewIntVar(0, num_vals - 1, "x")
y = model.NewIntVar(0, num_vals - 1, "y")