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 /1*5/
j room /1*5/

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.

\