|
Full 1/2 Empty Son 1 3 1 3 Son 2 2 3 2 Son 3 2 3 2 Xpress-Mosel Model
model 'honey'
! Description : Honey division puzzle
! Source : H E Dudeney - Amusements in Mathematics
! Date written : MAGIC 27/11/92, Xpress-MP 16/6/98, Mosel 16/4/03
! Written by : M J Chlond
uses 'mmxprs'
parameters
son = 3
cap = 3
end-parameters
declarations
S = 1..son
C = 1..cap
howfull: array(C) of real
x: array(S,C) of mpvar
end-declarations
howfull:= [1,.5,0]
any:= x(1,1)
! each son gets 7 barrels
forall(i in S)
nocon(i):= sum(j in C) x(i,j) = 7
! each son gets 3.5 units
forall(i in S)
amcon(i):= sum(j in C) howfull(j)*x(i,j) = 3.5
! use 7 of each barrel capacity
forall(j in C)
nccon(j):= sum(i in S) x(i,j) = 7
forall(i in S, j in C) do
x(i,j) is_integer
x(i,j) <= 4
end-do
maximise(any)
forall(i in S) do
forall(j in C)
write(getsol(x(i,j)),' ')
writeln
end-do
end-model
|