Initial Value - Condition Topic is solved

Problems with syntax of GAMS
Post Reply
Alexanre.ito
User
User
Posts: 38
Joined: 3 years ago

Initial Value - Condition

Post by Alexanre.ito » 3 months ago

Dear,
I need to specify the initial value of a variable, but it should only apply to the conditions that are presented in the table.

Code: Select all

SET
n          / n1 * n20 /
nn (n,n)
alias(n,np)
TABLE  arc(n,n)  (GRAPH - ARCS and NODES)
    n1 n2 n3 n4 n5 n6 n7 n8 n9 n10 n11 n12 n13 n14 n15 n16 n17 n18 n19 n20 
n1
n2  1
n3     1
n4        1
n5          
.
.
.

POSITIVE VARIABLES  dr;
 dr.L (n,np)     = 0.1  ($????) ;
So, I need this situation:

dr(n1,n1) = 0,0
dr(n2,n1) = 0,1
...
Should I use the dollar condition?? How??

I tried, but not worked:

Code: Select all

 dr.L (n,np)     = 0.1  $ table (n,n)=1 ;
 

User avatar
bussieck
Moderator
Moderator
Posts: 832
Joined: 6 years ago

Re: Initial Value - Condition

Post by bussieck » 3 months ago

Read up on conditional assignment in the following section: https://www.gams.com/latest/docs/UG_Con ... rOnTheLeft

Code: Select all

dr.L (n,np)$arc(n,np)     = 0.1;
-Michael

Alexanre.ito
User
User
Posts: 38
Joined: 3 years ago

Re: Initial Value - Condition

Post by Alexanre.ito » 3 months ago

thank you very much.
bussieck wrote:
3 months ago
Read up on conditional assignment in the following section: https://www.gams.com/latest/docs/UG_Con ... rOnTheLeft

Code: Select all

dr.L (n,np)$arc(n,np)     = 0.1;
-Michael

Post Reply