Mathematical Modeling with LPL : Explain and run a Model
Problem Statement
Modeling Description
||
Back to MatMod
model socialGolver; parameter nbGroups; groupSize; nbWeeks; Read('c_4_3_3.in', nbGroups, groupSize, nbWeeks); --Read('instances/c_10_8_4.in', nbGroups, groupSize, nbWeeks); parameter nbGolfers := nbGroups * groupSize; set w:=1..nbWeeks; set g:=1..nbGroups; set i,j:=1..nbGolfers; binary variable x{w,g,i}; constraint A{w,i}: sum{g} x[w,g,i] = 1; constraint B{w,g}: sum{i} x[w,g,i] = groupSize; expression meetings{w,g,i,j|j>i}: x[w,g,i] and x[w,g,j]; nbMeetings{i,j|j>i}: sum{w,g} meetings[w,g,i,j]; redundantMeetings{i,j|j>i}: Max(nbMeetings[i,j] -1, 0); minimize obj: sum{i,j|j>i} redundantMeetings[i,j]; Write('obj: %d\n', obj); Write('The group of players is as follows:\n\n'); Write(' %-14s\n',{w}('Week '&w)); Write{g}('Group %s %-14s\n',g, {w}Strreplace(Format('(%s)',{i|x}(i&',')),',)',')')); end
Problem Statement
Modeling Description
Back to model
The solution is as follows:
The LOG-File output of LPL is as follows: