Error 101

388 views
Skip to first unread message

spicy_sugar

unread,
May 17, 2007, 8:47:50 AM5/17/07
to Xpress-MP
hi, i have entered the following problem in xpress 2007 and i get an
error 101, incompatible types in assignment. any help

thx
model maxAlcohol
uses "mmxprs"; !gain access to the Xpress-Optimizer solver


declarations
DRINKS = 1..15
SPIRITS = 6..9

m:array(DRINKS)of real !Let m(j) be the cost of one glass of drink j
t:array(DRINKS)of real !Let t(j) be the time needed to consume one
glass of drink j
a:array(DRINKS)of real !Let a(j) be the units of alcohol in spirit j
l:array(DRINKS)of real !Let l(j) be the limit of one drink j
x:array(DRINKS)of mpvar !let x(j) be the no. of glasses of drink j
end-declarations

m :=[0.67, 0.61, 0.66, 0.66, 0.72, 1.10, 1.00, 1.30, 1.10, 0.85, 1.18,
1.24, 1.18, 1.25, 1.50]
t :=[8 , 6, 6, 6, 7, 4, 3, 3, 5, 7,
9, 8, 8, 9, 9]
a :=[ 1.2, 1.0,1.0,1.1,0.9,1.3,1.1,1.2,1.0,1.4,1.0,1.1,1.0,1.2,1.0]
l :=[999,3,4,999,999,999,999,2,999,4,999,999,999,999,999]

Alcohol:= sum(j in DRINKS) a(j)*x(j)

forall (j in DRINKS) limit(j):= x(j)<=l(j)
money:=sum(j in DRINKS) m(j)*x(j)<= 18.50 !pounds
Time :=sum(j in DRINKS) t(j)*x(j)<= 60! minutes
Unit :=sum(j in SPIRITS) x(j)<=5 !units

maximise(Alcohol)
writeln ("Number of glasses of alcohol = ",getobjval)

end-model

bobdaniel

unread,
May 18, 2007, 7:16:33 AM5/18/07
to Xpress-MP
I am sure I shouldn't be helping you in your quest for oblivion, but
one of the few changes between Mosel<2 and Mosel2 is that you must
use :: in place of := in table assignments e.g.
t ::[8 , 6, 6, 6, 7, 4, 3, 3, 5, 7,
etc.

BTW: you get a week's units of alcohol all in one go as the answer
(assuming a) you are in the UK, and b) your name implies you are
female)
Bob

spicy_sugar

unread,
May 23, 2007, 5:45:33 AM5/23/07
to Xpress-MP
thx but i figured it out myself.
Sophina

> > end-model- Hide quoted text -
>
> - Show quoted text -

Reply all
Reply to author
Forward
0 new messages