ÐÏࡱá>þÿ  þÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 9 7 4 5 5 0; ! Arc limit; U = 0 2 3 2 1 20 0 0 2 8 3 9 3 0 0 1 3 9 5 4 6 0 5 9 1 0 2 7 0 9 9 9 9 9 9 0; ! Whether an arc exists or not; ! V = 0 if U = 0; ! v = 1 otherwise; V = 0 1 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0; ENDDATA MIN = @SUM(NET(I, J, K): C(I, J) * X(I, J, K)); ! This is the balance constraint. There are two cases: Either the node that needs to be balanced is not a supply, in which case the sum of incoming amounts minus the sum of outgoing amounts must equal the demand for that commodity for that city; !or where the node is a supply, the sum of incoming minus outgoing amounts must equal the negative of the sum of the demand for the commodity that the node supplies; @FOR(COMMO(K): @FOR(NODES(J)|J #NE# K: @SUM(NODES(I): V(I, J) * X(I, J, K) - V(J, I) * X(J, I, K)) = D(K, J)); @FOR(NODES(J)|J #EQ# K: @SUM(NODES(I): V(I, J) * X(I, J, K) - V(J, I) * X(J, I, K)) = -1 * @SUM(NODES(L): D(K, L)));); ! This is a capacity constraint; @FOR(EDGES(I, J)|I #NE# J: @SUM(COMMO(K): X(I, J, K)) <= U(I, J)); END MODEL: SETS: ! For each city; NODES/1..6/:; ! Sparse set definition for our "commodity" cities; COMMO(NODES)/1, 2, 5/:; EDGES(NODES, NODES): D, C, U, V; NET(EDGES, COMMO): X; ENDSETS DATA: ! Demand; D = 0 5 9 7 0 4 0 0 4 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 2 0 8 0 0 0 0 0 0; ! Cost; C = 0 4 5 8 9 9 3 0 3 2 4 6 5 3 0 2 3 5 7 3 3 0 5 6 8 5 3 6 0 3 þÿÿÿýÿÿÿþÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRoot EntryÿÿÿÿÿÿÿÿŠCONTENTSÿÿÿÿÿÿÿÿÿÿÿÿŠÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ þÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRoot Entryÿÿÿÿÿÿÿÿ*0_šîÏ»òÀð^0lvfþÄ € Contentsÿÿÿÿÿÿÿÿÿÿÿÿw ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿýÿÿÿþÿÿÿþÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  !"#$%þÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ)); \par \cf1 @FOR\cf2 (NODES(J)|J #EQ# K: \cf1 @SUM\cf2 (NODES(I): \par V(I, J) * X(I, J, K) - V(J, I) * X(J, I, K)) \par = -1 * \cf1 @SUM\cf2 (NODES(L): D(K, L)));); \par \cf3 ! This is a capacity constraint;\cf2 \par \cf1 @FOR\cf2 (EDGES(I, J)|I #NE# J: \cf1 @SUM\cf2 (COMMO(K): \par X(I, J, K)) <= U(I, J)); \par \cf1 END\cf2 \par \par } ì‹{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Courier New;}} {\colortbl ;\red0\green0\blue255;\red0\green0\blue0;\red0\green175\blue0;} \viewkind4\uc1\pard\cf1\f0\fs20 MODEL\cf2 : \par \cf1 SETS\cf2 : \par \cf3 ! For each city;\cf2 \par NODES/1..6/:; \par \cf3 ! Sparse set definition for our "commodity" cities;\cf2 \par COMMO(NODES)/1, 2, 5/:; \par EDGES(NODES, NODES): D, C, U, V; \par NET(EDGES, COMMO): X; \par \cf1 ENDSETS\cf2 \par \cf1 DATA\cf2 : \par \cf3 ! Demand;\cf2 \par D = 0 5 9 7 0 4 \par 0 0 4 0 1 0 \par 0 0 0 0 0 0 \par 0 0 0 0 0 0 \par 0 4 0 2 0 8 \par 0 0 0 0 0 0; \par \cf3 ! Cost;\cf2 \par C = 0 4 5 8 9 9 \par 3 0 3 2 4 6 \par 5 3 0 2 3 5 \par 7 3 3 0 5 6 \par 8 5 3 6 0 3 \par 9 7 4 5 5 0; \par \cf3 ! Arc limit;\cf2 \par U = 0 2 3 2 1 20 \par 0 0 2 8 3 9 \par 3 0 0 1 3 9 \par 5 4 6 0 5 9 \par 1 0 2 7 0 9 \par 9 9 9 9 9 0; \par \cf3 ! Whether an arc exists or not;\cf2 \par \cf3 ! V = 0 if U = 0;\cf2 \par \cf3 ! v = 1 otherwise;\cf2 \par V = 0 1 1 1 1 1 \par 0 0 1 1 1 1 \par 1 0 0 1 1 1 \par 1 1 1 0 1 1 \par 1 0 1 1 0 1 \par 1 1 1 1 1 0; \par \cf1 ENDDATA\cf2 \par \cf1 MIN\cf2 = \cf1 @SUM\cf2 (NET(I, J, K): C(I, J) * X(I, J, K)); \par \cf3 ! This is the balance constraint. There are two cases: Either the node that needs to be balanced is not a supply, in which case the sum of incoming amounts minus the sum of outgoing amounts must equal the demand for that commodity for that city;\cf2 \par \cf3 !or where the node is a supply, the sum of incoming minus outgoing amounts must equal the negative of the sum of the demand for the commodity that the node supplies;\cf2 \par \cf1 @FOR\cf2 (COMMO(K): \cf1 @FOR\cf2 (NODES(J)|J #NE# K: \par \cf1 @SUM\cf2 (NODES(I): \par V(I, J) * X(I, J, K) - V(J, I) * X(J, I, K)) \par = D(K, J