I have the following array S of IntVar[]:
IntVar[] S = model.intVarArray("Flights Schedule", 18, 0, 19);
I also have the following ArrayList of Integer, called fromHome:
ArrayList<Integer> fromHome = [1, 2, 4];
fromHome is derived later in the program.
I want to constrain the domain of S[0] to contain only the values in fromHome and nothing else. How can I do that? Thanks!
I found a way to do this using the
memberconstraint as follows: