I'm using the choco solver to solve my constraint problem. Is it possible in Choco to increment an IntVar after a condition like model.ifThen?
Asked
Active
Viewed 103 times
0
-
`x = x + 1` is a normal construct in programming but it is not a valid constraint. You can do something like `y = if condition then x+1 else x` – Erwin Kalvelagen May 31 '18 at 19:50
-
Does this increment my variable ? model.arithm(gisement_courant, "=", gisement_courant.getValue() +1) – Mathieu TSH Jun 07 '18 at 09:46
1 Answers
0
In constraint programming, you NEVER increment a variable. It is a declarative (not imperative) paradigm where instead of describing how to compute a solutions (operations on values), you just post constraint that must be satisfied. x=x+1 is a nonsense in constraint programming, leading to "no solution".

Jean-Guillaume Fages
- 239
- 1
- 7