Simulation

Problems with syntax of GAMS
Post Reply
chandelbs
User
User
Posts: 2
Joined: 4 years ago

Simulation

Post by chandelbs »

Hi,
I am learning to work using GAMS and I have licensed software comprising of base and path solvers.
In the process of learning, I formulated a small program and trying to simulate that if co(i,j) increase by 1.25 times, what is the value of total?
When I run this program, I got the changed value of c(i,j) but no change in value of total. I want to identify the mistake but not able to; please guide.

$title Exercise of sum

Set i /punjab, haryana, UP, Rajasthan/
j /wheat, barley, maize/;

Table co(i,j) quantity transported
wheat barley maize
punjab 25 15 10
haryana 20 25 15
UP 30 24 22
Rajasthan 24 23 18;

Parameter
totalo;
Totalo = sum((i,j),co(i,j));


Variables
total
c(i,j);

Equation
Equa;

Equa.. total =e= sum((i,j),c(i,j));

total.L = totalo;
c.L(i,j) = co(i,j);

*simmulate
Parameter
c1(i,j);
c1(i,j) = co(i,j)*1.25;
c.l(i,j) = c1(i,j);
co(i,j) = c1(i,j);

Display total.l, c.l;
User avatar
bussieck
Moderator
Moderator
Posts: 1038
Joined: 7 years ago

Re: Simulation

Post by bussieck »

In order to exercise/execute an equation (to calculate total) you need to solve a model with a solve statement. So an equation is not like an F9 button, i.e as soon as you change the values it recalculated other values. You need to trigger this action by a solve of a model. I suggest you study the tutorial (https://www.gams.com/latest/docs/UG_Tutorial.html) and other introductory chapters of the GAMS documentation and even perhaps take an (on-line) class.

-Michael
chandelbs
User
User
Posts: 2
Joined: 4 years ago

Re: Simulation

Post by chandelbs »

Thanks a lot. Also guide me when and where I can take on line classes.
User avatar
bussieck
Moderator
Moderator
Posts: 1038
Joined: 7 years ago

Re: Simulation

Post by bussieck »

The GAMS web site mentions some courses: https://www.gams.com/news-events/courses/.

-Michael
Post Reply