Mathematical Modeling with LPL : Explain and run a Model
Problem Statement
Modeling Description
||
Back to MatMod
model jug "The 3-Jug Problem"; set i,j:=1..16; k:=1..3; e{i,j}; p{i,j}; parameter X:=8; Y:=5; Z:=3; x{i}:=[8 3 3 6 6 1 1 4 4 7 7 2 2 5 0 5]; y{i}:=[0 5 2 2 0 5 4 4 1 1 0 5 3 3 5 0]; z{i}:=[0 0 3 0 2 2 3 0 3 0 1 1 3 0 3 3]; string S{i}:='('&x&','&y&','&z&')';; e{i,j}:= z[i]=z[j] and (x[j]=X or y[j]=0) or z[i]=z[j] and (x[j]=0 or y[j]=Y) or y[i]=y[j] and (x[j]=X or z[j]=0) or y[i]=y[j] and (x[j]=0 or z[j]=Z) or x[i]=x[j] and (y[j]=Y or z[j]=0) or x[i]=x[j] and (y[j]=0 or z[j]=Z); Graph.SPath(e,p,1,8); parameter PI:=3.14159; xa{i}:=15*Sin(PI/#i+2*PI*(i-1)/#i); ya{i}:=15*Cos(PI/#i+2*PI*(i-1)/#i); Draw.Scale(15,15); Draw.DefFont('Verdana',10); {e[i,j]} Draw.Arrow(xa[i],ya[i],xa[j],ya[j],2); {p[i,j]} Draw.Arrow(xa[j],ya[j],xa[i],ya[i],2,3,3); {i}Draw.Ellipse(S,xa,ya,2,1,1,0); end
Problem Statement
Modeling Description
Back to model
The solution is as follows:
The LOG-File output of LPL is as follows: