Skip to content
Discussion options

You must be logged in to vote

See: https://github.com/google/or-tools/blob/stable/ortools/sat/doc/channeling.md
but basically:

model.Add(x <= 5).OnlyEnforceIf(var)
model.Add(x > 5).OnlyEnforceIf(var.Not())

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lperron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Needed Modeling/Usage problem Lang: Python Python wrapper issue Solver: CP-SAT Solver Relates to the CP-SAT solver
1 participant