Skip to content

Instantly share code, notes, and snippets.

@dboyliao
Created March 22, 2020 12:53
Show Gist options
  • Save dboyliao/f62359c4ac0ba244263f9027d037cc27 to your computer and use it in GitHub Desktop.
Save dboyliao/f62359c4ac0ba244263f9027d037cc27 to your computer and use it in GitHub Desktop.
from ortools.sat.python import cp_model
model = cp_model.CpModel()
model.NewIntVar # declare a variable of type int
model.NewBoolVar # declare a variable of type bool
model.NewIntervalVar # declare an inclusive interval [a, b]
model.Add # add constraint, such as x < 1
model.AddNoOverlap # add constraint for non overlapping intervals
# and more...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment