Hi all.
I’m very confused and tired.
Could you help me to correct gams code?
My code as followed.
=============================================================
$title assigning rooms
$offsymxref
$offsymlist
set
i person /15/
j room /15/
k time slot “ex : 8~10am 10~12 12~14 14~16 16~18” /1*5/
j1(j) union of room1 /1,2/
j2(j) union of room1 /2,3/
j3(j) union of room1 /3,4/
j4(j) union of room1 /3,4,5/
alias(i,ip);
alias(j,jp);
alias(k,kp);
parameter
demand(i) demand for room in a day
/1 3, 2 4, 3 5, 4 2, 5 2/
dist(i) maximum distance to walk
/1 0.5, 2 0.8, 3 1, 4 0.5, 5 0.5/
demand_uni(i) demand for union-room at the same timeslot in a day
/1 1, 2 1, 3 1, 4 1, 5 1/
table
d(i,j)
1 2 3 4 5
1 0.2 0.5 0.6 0.8 0.1
2 1 0.9 0.4 0.6 0.7
3 0.3 0.9 0.4 0.2 0.5
4 0.6 0.5 0.1 0.8 0.9
5 0.2 0.6 0.7 0.9 0.3
variable z minimizing distance;
binary variable x 1 if x is asssigned otherwise 0;
equation
obj objective function(minimizing distance)
no_overlap(i,j,k) not allowed 1 more person in a room
demandfor(i) demand for room in a day
distance(i,j,k) maximum distance to walk
demandfor_uni(i) demand for union-room at the same timeslot in a day
;
obj… z =e= sum(i, sum(j, sum(k, d(i,j)*x(i,j,k))));
no_overlap(i,j,k)… sum(ip, x(ip,j,k)) =e= 1;
demandfor(i)… sum(jp, sum(kp, x(i,jp,kp))) =g= demand(i);
distance(i,j,k)… d(i,j)*x(i,j,k) =l= Dist(i);
demandfor_uni(i)… sum(jp, sum(kp, x(i,jp,kp))) =g= demand_uni(i);
model assign /all/;
solve assign using mip minimizing z;
display x.l, z.l;
option
mip=xa;
Thank you잘린 콘í…ì¸ í‘œì‹œ~!!!
안녕하세요.
ë‚´ê°€ 그리드를 ì •ì˜í•´ì•¼í•©ë‹ˆë‹¤. 그리드는 매ë“ì„ ê°€ì§€ê³ ìžˆìœ¼ë©°, ì¼ë¶€ knots.thereì—서 소비ë©ë‹ˆë‹¤.
매ë“으로 ì „ì†¡ë˜ëŠ” 것ì„ì˜ ê· í˜• 플러스 소비 (있는 경우) 멀리가는 무슨 같아야합니다.
내가 세트가
I / K1 / K2, K3, K4, K5
/ J / K1, K2, K3, K4, K5
ì–´ëŠë¡œë¶€í„° 매ë“ì„ ì˜ë¯¸í•©ë‹ˆë‹¤.
ë‚´ ë°©ì •ì‹ì€ 밸런스 ìž‘ì—…ì„ ì§„í–‰ :
EQ1 … 합계 (I, êµí†µ (I, J)) = E = SUM (J, êµí†µ) + 소비 (I, J)
í•˜ì§€ë§Œì´ ë‚ ìƒìˆ˜ ë˜ëŠ”ë¡œ ìž…ë ¥í•˜ê±°ë‚˜ í†µì œ ì§‘í•©ì„ ì œê³µí•©ë‹ˆë‹¤ … ì´ë¯¸ í†µì œí•˜ì—있다.
ë‹¹ì‹ ì€ correctely ê·¸ ë°©ì •ì‹ì„ ì •ì˜í•˜ëŠ” 나를 ë„울 수 있습니까?
ê°ì‚¬í•©ë‹ˆë‹¤
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.
\