Mathematical Modeling with LPL : Explain and run a Model
Problem Statement
Modeling Description
||
Back to MatMod
model triangle "Moving Coins"; set i,j:=[1..20]; parameter a{i,j}:=[(8,10)=1 (7,11)=1 (9,11)=1 (6,12)=1 (8,12)=1 (10,12)=1 (5,13)=1 (7,13)=1 (9,13)=1 (11,13)=1]; binary variable x{i,j}; constraint R: sum{i,j} x = sum{i,j} a; constraint S: or{i,j|j>=4 and i>=4} (x[i,j] and x[i-1,j-1] and x[i+1,j-1] and x[i-2,j-2] and x[i,j-2] and x[i+2,j-2] and x[i-3,j-3] and x[i-1,j-3] and x[i+1,j-3] and x[i+3,j-3]); maximize obj: sum{i,j|a} x; Draw.Scale(50,70); for{i,j|a} do Draw.Circle(i,j,.5,2,0,3); end for{i,j|a} do Draw.Circle('1$',i,j,.4,-1,0,1); end for{i,j|x and ~a} do Draw.Circle('1$',i,j,.4,Rgb(240,240,240),3,1); end for{i,j|~x and a} do Draw.Circle('$',i,j,.4,Rgb(240,240,240),3,1); end end
Problem Statement
Modeling Description
Back to model
The solution is as follows:
The LOG-File output of LPL is as follows: