set LENGTHS := { 20, 32, 45, 55 }; set BOXES := { 1 .. 3}; param lengths[LENGTHS] := <20> 20, <32> 32, <45> 45, <55> 55; param l := 100; param available := 15; param demands[LENGTHS*BOXES] := | 1,2,3| |20| 4,1,0| |32| 1,1,2| |45| 0,2,3| |55| 0,1,1|; param gains[BOXES] := <1> 112, <2>197,<3>199; param requests[BOXES] := <1> 6, <2>2,<3>2; ### Problem 1 set PLANK := { 1 .. available }; var assigned[LENGTHS*PLANK] integer >= 0; var boxes[BOXES] integer >= 0; subto avail: forall in LENGTHS: sum in LENGTHS*PLANK: assigned[k,i] >= sum in BOXES: demands[k,i] * boxes[i]; subto notlonger: forall in PLANK: sum in LENGTHS: assigned[k,i]*lengths[k] <= l; maximize gains: sum in BOXES: boxes[i] * gains[i]; ### End of problem 1 ### Problem 2 #set PLANK := { 1 .. 30 }; #var planks[PLANK] binary; #var assigned[LENGTHS*PLANK] integer >= 0; #var boxes[BOXES] integer >= 0; #minimize number_used: #sum in PLANK: planks[i]; #subto plank_const: #forall in LENGTHS*PLANK: #assigned[k,i] <= 5*planks[i]; #subto requests: #forall in BOXES: #boxes[i] >= requests[i]; ### End of problem 2