transport modell with gams Topic is solved

Problems with modeling
Post Reply
Someone
User
User
Posts: 4
Joined: 2 months ago

transport modell with gams

Post by Someone » 2 months ago

hello.
the code i wrote is below i have mistakes error 149,409,140,812 it is a transport model problem i'm a student and i'm trying to learn GAMS how can i fix that? please contact me if you think i have another fault
sets
i truck type /1,2,3/

j dealer/1*8/;

parameters
m(i) 'i the cost of carrying 1 ton of cement carried by the truck '
/1 0.0353
2 0.0432
3 0.0520/

y(j) 'distance between factory and dealer '
/1 370
2 592
3 156
4 60
5 110
6 160
7 330
8 444/

t(j) 'amount of demand '
/ 1 4936
2 4126
3 2428
4 7497
5 5920
6 5748
7 1470
8 3490/

a(i) 'load capacity of the truck i '
/1 24
2 16
3 10/;
;

variables
z
x(i,j) 'the nuber of trips the truck i will make to its dealer '
;



equations
cost
restriction1 'prevents the amount of cement from exceeding the demand'
restriction2 'prevents the load carried by the 24 ton truck from exceeding the dealer'demand j '
restriction3 'prevents the load carried by the 16 ton truck from exceeding the dealer'demand j '
restriction4 'prevents the load carried by the 10 ton truck from exceeding the dealer'demand j '
restriction5 ;

cost.. z=e=sum((i,j),[m(i)*x(i,j)]*y(j)) ;
restriction1.. (24*x(i,j))+(16*x(i,j))+(10*x(i,j)) =e= t(j) ; * error 149,409 409 Unrecognizable item - skip to find a new statement
**** looking for a ';' or a key word to get started again
restriction2x(i,j).. 24*x(i,j)=l= t(j); *error 140
restriction3x(i,j).. 16*x(i,j)=l= t(j); *error 140
restriction4x(i,j).. 10*x(i,j)=l= t(j); *error 140
restriction5x(i,j).. x(i,j)=g=0;

model number of trips /all/;
solve number of trips using mip minimizing z; *error 812

abhosekar
Moderator
Moderator
Posts: 190
Joined: 10 months ago

Re: transport modell with gams

Post by abhosekar » 2 months ago

In the following constraint

restriction1.. (24*x(i,j))+(16*x(i,j))+(10*x(i,j)) =e= t(j) ;

The model does not know what is i and j
you have to define restriction1(i, j)

Hope this helps.

- Atharv

Someone
User
User
Posts: 4
Joined: 2 months ago

Re: transport modell with gams

Post by Someone » 2 months ago

Thank you so much I fixed the problem

Post Reply