Hi,
I’m trying to write a code to calculate the flow of a snippet.
The section should receive the flow of the previous sections.
But my problem is the matrix “q(n,np)” depends on itself.
Set n nodes / n1 * n48 /
a(n,n) arcos / n1.(n2,n9), n2.(n1,n3), n3.(n2,n4), n4.(n3,n5,n10),
n5.(n4,n6,n11), n6.(n5,n7), n7.(n6,n8), n8.(n7,n17),
n9.(n1,n13), n10.(n4,n14), n11.(n5,n15), n12.(n8,n16),
n13.(n9,n17), n14.(n10,n20), n15.(n11,n21),
n16.(n12,n24), n17.(n13,n18,n25), n18.(n17,n19),
n19.(n18,n20), n20.(n14,n19,n21,n28),
n21.(n15,n20,n22,n29), n22.(n21,n23), n23.(n22,n24),
n24.(n16,n23,n33), n25.(n17,n26,n33), n26.(n25,n27),
n27.(n26,n28), n28.(n20,n27,n29,n34),
n29.(n21,n28,n30,n35), n30.(n29,n31), n31.(n30,n32),
n32.(n24,n31,n36), n33.(n25,n37), n34.(n28,n38),
n35.(n29,n39), n36.(n32,n40), n37.(n33,n41),
n38.(n34,n44), n39.(n35,n45), n40.(n36,n48),
n41.(n37,n42), n42.(n41,n43), n43.(n42,n44),
n44.(n38,n43,n45), n45.(n39,n44,n46),
n46.(n45,n47), n47.(n46,n48), n48.(n40,n47)/
si(n) saida /n48/
cont(n) contribution; cont(n)=yes; cont(si)=no; display cont;
alias(n,np);
Scalar q /10/;
Variables ar(n,np)
qn(n,np)
xq;
binary variable ar(n,np);
Equation flow
qalter;
qalter(n,np).. xq(n,np) =l= qn(n,np);
flow(n,np)$ar(n,np).. qn(n,np) =e= sum(np,xq(n,np)) + q;
Gams Show the Error…
vazao(n,np)$ar(n,np).. qn(n,np) =e= sum(np,xq(n,np)) + q;
$125
125 Set is under control already
**** 1 ERROR(S) 0 WARNING(S)
I tried to use the equation to maintain the linear equation
qalter(n,np).. xq(n,np) =l= qn(n,np);
Please could someone give me some idea