Hi ! I’m new on GAMs .
I try to modelling an undesirable facility location problem.
But I try to make a loop but I not.
sets
i müşteri /A,B,C,D/
j tesis /A,B,C,D/
M yakınlık derecesi /1*4/ ;
scalar
P açılacak tesis sayısı /2/ ;
parameters
h(i) i müşterisinin talebi
/
A 3
B 4
C 2
D 5
/ ;
table d(i,j) i müşterisinin j tesisine uzaklığı
A B C D
A 0 3 7 12
B 3 0 4 9
C 7 4 0 5
D 12 9 5 0 ;
table t(i,m )
1 2 3 4
A A B C D
B B A C D
C C B D A
D D C B A ;
binary variable
y(i,j)
x(j) ;
variable
z ;
equation
amac
k1
k2
k3
k4
;
amac…z=e=sum((i,j),h(i)*d(i,j)*y(i,j)) ;
k1(i)…sum(j,y(i,j))=e=1;
k2… sum(j,x(j))=e= P;
k3(i,j)…y(i,j)=l=x(j) ;
k4(i)…sum(M, y(i,t(i,m)))-x(i,m)=g=0;
model undesirable /all/;
scalar
minM /1/
maxM /4/;
for ( M=1 to 4 by 1 ;
x(i,m) =e= x(t);
solve undesirable using MIP maximizing z;
);
display z.l,x.l , y.l ;
there is error for table t(i,m) " real number expected " … how can I fix it?