After running through the tutorials, thinking I got the concepts, I set about creating my own model and immediately ran into problems. Better to get stuck in asap to realise just how little you actually know, imo.
In this example I would simply like to get an output where classes consist of students that want them, i.e. true
, as represented by my array (not every student is able to attend on every day).
There could be all sorts of badness in the way the model was written...
Needless to say, I get the error WARNING: model inconsistency detected
enum Students = { Mark, Bart, Mary, Anne, Sue };
enum Classes = { Mon, Tue, Wed};
array[Students, Classes] of bool: pref =
[| true, true, false,
| false, true, true,
| true, false, true,
| true, false, false,
| false, false, true |];
constraint forall (i in Students, j in Classes)(pref[i,j]=true);
solve satisfy;
output [ " \(pref[Students,Classes]);\n" ]
Bonus would be limiting it so each Student
only appears once...
Perfect outcome would be something like a list of all the combinations where students preferences are satisfied and they are in 1 class.
[Mark, Anne | Bart | Mary, Sue]
Thank you for helping me along my way!