|
After transaction coins are distributed as follows:
• Buyer has 1 crown and 1 threepence
• Shopkeeper has 1 half-sovereign, 1 half-crown, 1 sixpence and 1 fourpence
• Friend has 1 double-florin, one florin, 1 shilling and 1 penny
Xpress-Mosel Model
model 'lccoin'
! Description : Lewis Carroll coin puzzle
! Source : Wakeling, E., (1995), Rediscovered Lewis Carroll Puzzles, Dover.
! Date written : Xpress-MP 7/10/99, Mosel 17/4/03
! Written by : M J Chlond
uses 'mmxprs'
parameters
person = 3
coin = 10
end-parameters
declarations
P = 1..person
C = 1..coin
requ: array(P) of real
value: array(C) of real
x: array(C,P) of mpvar
end-declarations
requ:= [63,160,85]
value:= [120,60,48,30,24,12,6,4,3,1]
any:= x(1,1)
forall(j in P)
reqcon(j):= sum(i in C) value(i)*x(i,j) = requ(j)
forall(i in C)
useone(i):= sum(j in P) x(i,j) = 1
forall(i in C, j in P)
x(i,j) is_binary
minimise(any)
forall(i in C) do
forall(j in P)
write(getsol(x(i,j)),' ')
writeln
end-do
end-model
|