Page 1 of 1

Initial Value - Condition

Posted: Sat Jun 25, 2022 9:29 pm
by Alexanre.ito
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 ;
 

Re: Initial Value - Condition

Posted: Sun Jun 26, 2022 7:40 am
by bussieck
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

Re: Initial Value - Condition

Posted: Wed Jun 29, 2022 2:12 pm
by Alexanre.ito
thank you very much.
bussieck wrote: 1 year 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