Parameters

Problems with syntax of GAMS
Post Reply
jtayers
User
User
Posts: 6
Joined: 1 year ago

Parameters

Post by jtayers »

I want to make a profit parameter p(i,j) and another parameter y(i,j)

p(i,j) is equal to 2 if i + j is even, and is equal to 1 if i + j is even

y(i,j) is to 0 with probability 0.8 and 50 with probability 0.2

How do I write both parameters?
User avatar
bussieck
Moderator
Moderator
Posts: 1042
Joined: 7 years ago

Re: Parameters

Post by bussieck »

Code: Select all

set i /1*20/; alias (i,j);
parameter p(i,j), y(i,j);
p(i,j) = 2;
p(i,j)$mod(i.val+j.val,2) = 1;
y(i,j)$(uniform(0,1)<=0.2) = 50;
-Michael
Don
User
User
Posts: 11
Joined: 1 year ago

Re: Parameters

Post by Don »

Hi,

A parameter has population data from 2023 to 2050.

How do I display just the population in 2050 or reference just the 2050 population for my next code?

-Don
User avatar
bussieck
Moderator
Moderator
Posts: 1042
Joined: 7 years ago

Re: Parameters

Post by bussieck »

How is this related to this thread? Any how, here is some solution:

Code: Select all

set y / 2023*2050 /;
parameter pop(y);
pop(y) = uniformInt(10,100);
scalar pop2050; pop2050 = pop('2050'); display pop2050;
-Michael
Don
User
User
Posts: 11
Joined: 1 year ago

Re: Parameters

Post by Don »

Thank you
Post Reply