Mathematical Modeling with LPL : Explain and run a Model
Problem Statement
Modeling Description
||
Back to MatMod
model math09 "Wine Cask Puzzle"; set n,m:=[nephew1 nephew2 nephew3 nephew4 nephew5]; c:=['Empty' '1/4' '1/2' '3/4' 'Full']; parameter h{c} := [0 0.25 0.5 0.75 1]; p{c} := 10^(#c-c); //[10000,1000,100,10,1]; integer variable x{n,c} [1..9] "number of casks"; y{n} "5-digit assigned to each nephew"; constraint A{n}: sum{c} x = 9 "Each nephew gets 9 casks"; B{c}: sum{n} x = 9 "Same number of casks"; C{n}: sum{c} h*x = 4.5 "Same amount of wine"; D{n}: sum{c} p*x = y "A 5-digit for each n"; E{n|n>1}: y[n-1] > y[n] "Each different"; solve; Writep(x); end
Problem Statement
Modeling Description
Back to model
The solution is as follows:
The LOG-File output of LPL is as follows: