0
  • Consider a directed graph G=(V, A), where V = V_1 \cup V_2 is the set of vertices and A is the set of directed arcs.
  • Let \alpha(W, W') = {(u,v) | u \in W \land v \in W'}. That is the set of arcs leaving from W to W'.
  • For each arc (u,v) \in A, there is an associated variable x_{(u,v)}
  • Now, I want to create a constraint that: \forall S \subset V: \sum_{(u,v) \in \alpha(V_1, V_2)} x_{(u,v)} \geq 2.

My question is how can I define the \alpha function in Zimpl? From its document (at http://zimpl.zib.de/download/zimpl.pdf), an argument of a function can only be a number or a string.

vad
  • 344
  • 2
  • 12

2 Answers2

1

You can define alpha as the intersection of A with (W x W'). All of these set operations are available in ZIMPL.

Leon
  • 26
  • 2
0

I have figure out the solution thank to Leon's hint:

set PV[] := powerset(V);
set KV   := indexset(PV);
# print out all arcs in \alpha
do forall <k> in KV with card(PV[k]) > 0 do
    print (A inter ((V - PV[k]) * PV[k]));
vad
  • 344
  • 2
  • 12