table into sets?

Problems with modeling
Post Reply
P.Ganss
User
User
Posts: 4
Joined: 5 years ago

table into sets?

Post by P.Ganss »

Hello everyone,

I want to alter a table format of:
C D E
A 1 2 3
B 4 5 -
(Imagine the transportation problem tale)

Into something like this:
a.c 1
A.D 2
a.e 3
b.c 4
b.d 5

To be able to create a much larger set of possible routes which arent all connected with each other.
Would this be correct?

Code: Select all

parameter d(i,j) 'distance in thousands of miles'
/
a.c 2.5
a.d 1.7
a.e 1.8
b.c 2.5
b.d 1.8
b.e 1.4
/;
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: table into sets?

Post by Renger »

Looks fine, supposing that the sets are given as follows:

Code: Select all

set i /a,b,c,d,e/;
alias(i,j);
Your code will then produce the following table:

Code: Select all

----     14 PARAMETER d  distance in thousands of miles

            c           d           e

a       2.500       1.700       1.800
b       2.500       1.800       1.400
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply