How to define the way of go in a constraint? GLPK

261 Views Asked by At

I have the following constraint in the mathematical model

$$ \sum\limits_{j|(j,i)\in A}y_{ji} - \sum\limits_{j|(i, j)\in A}y_{ij} = \Bigg\{ \begin{matrix} d_iz_i & \mbox{ } \forall i \in C \\ \sum\limits_{i\in C}-d_iz_i & i = 0 \end{matrix} $$ How to implement this constraint in GLPK so that according to the value of i, the model behaves it correctly obeying the range of i?

Remembering that my difficulty is only in separate interactions

Somebody help me?

1

There are 1 best solutions below

0
On BEST ANSWER

Something like:

subject to
   e{i in I}: ... = if i=0 then sum{j in C} -p[j]*z[j] else p[i]*z[i];

I assume the set I is 0..n and C is 1..n.