I have the following model, which is giving syntax errors. Any help greatly appreciated.
int: N = 8; % Number of participants
int: M = 2; % Team size
int: S = 4; % Number of sessions
int: A = 4; % Number of activities
% Define decision variables
array[1..N, 1..S] of var 1..A: team_assignment;
% Constraints
constraint
% Each team can only participate in one activity
forall(t in 1..N)
(sum(s in 1..S)(team_assignment[t, s] == 1)) == 1;
% No participant is assigned more than once in a session
forall(s in 1..S, p in 1..N)
(sum(t in 1..N)(team_assignment[p, s] == p)) == 1;
% No participant is in the same activity more than once
forall(p in 1..N, a in 1..A)
(sum(s in 1..S)(team_assignment[p, s] == a)) <= 1;
solve satisfy;
% Output the solution
output [show(team_assignment)];
These syntax errors continue?
SessionActivity8:17.52-53:
MiniZinc: syntax error: syntax error, unexpected =, expecting ++ or ':'
SessionActivity8:21.52-53:
MiniZinc: syntax error: syntax error, unexpected <=, expecting ++ or ':'
Process finished with non-zero exit code 1.
The syntax errors are because you are forgetting to repeat the constraint keyword before each constraint.
After fixing this issue there are various typing errors. Assuming you want to count the number of times the condition hold, the resulting model would look like: