Mathematical Modeling with LPL : Explain and run a Model
Problem Statement
Modeling Description
||
Back to MatMod
model wolves1 "Werewolves II"; set p := [A B C] "Persons"; binary variable x{p}; y{p}; constraint A: xor{p} y; B{p}: y -> x "The werewolf is a knight"; Asays: x[1] <-> or{p} ~x "At least one is a knave, says A"; Bsays: x[2] = x[3] "B says: C is a knight"; minimize any: y[1]; Write{p}('%s is a %5s\n', p, if (x,'knight','knave')); Write{p|y}('%s is a werewolf\n', p); end
Problem Statement
Modeling Description
Back to model
The solution is as follows:
The LOG-File output of LPL is as follows: