Hi, I am writing a simple algorithm and I want to achieve the following. However, I got error message. I guess I use MIN function in a wrong way.

p=10

NODE=1..p

bottom:real

forall (i in NODE) cost(i):=random*16

forall (i in NODE) capacity(i)=random*10

bottom:=MIN(cost)

forall(i in NODE|cost(i)>bottom*1.5) capacity(i):=capacity(i)*1.2

How can I do it correctly?

Thanks in advance !

'min' (and 'max') are aggregate operators, they are used in the same way as any other aggregate operators (such as 'sum', 'prod', 'and', 'or', 'union') of the Mosel language. In your example this would be:

bottom:= min(i in NODE) cost(i)

To obtain the minimum value of a given list of values you could also use the 'minlist' function:

bottom:= minlist(cost(1),cost(2),cost(3))