I'm using the Python bindings...
I have an IntVar:
object_vars.append(solver.IntVar(0, num_positions-1, 'object[%i]' % object["id"]))
The value for most objects can range from 0 to the maximum number of positions - 1. However, some objects can take on only a discrete set of values within that range.
For example, if the range is 0-99, some of the objects can take on any value from 0-99, but some can only take on the values (5, 15, 25, 35, 45, 55, 65, 75, 85, 95).
I haven't been able to figure out how to constrain to a set like this (although I just started using the library yesterday). My first approach will be to do something like this:
for i in (all the numbers from 0-99 that aren't in the set of required values):
solver.Add(object_vars[idx] != i)
This seems less than optimal, however. What I was expecting was something like an InSetConstraint from python-constraint:
solver.Add(object_vars[idx] in (5, 15, 25, 35, 45, 55, 65, 75, 85, 95))
Any suggestions would be appreciated, or even just pointing out that one of the examples is doing this and I didn't recognize that fact.
A related question: is there a list of variable types and constraints with descriptions somewhere? I'm finding it rough going to figure out all the possible Things To Use, let along what the various Things are used for.
Regards,
-scott