如何在Zimpl中定义边缘切割


  • 考虑一个有向图的G=(V, A),其中V = V_1 cup V_2是一组顶点,A是一组定向弧。
  • alpha(W, W') = {(u,v) | u in W land v in W'}。那是从WW'的一组弧线。
  • 对于每个ARC (u,v) in A,都有一个关联的变量x_{(u,v)}
  • 现在,我想创建一个约束:forall S subset V: sum_{(u,v) in alpha(V_1, V_2)} x_{(u,v)} geq 2.

我的问题是如何在Zimpl中定义alpha功能?从其文档(在http://zimpl.zib.de/download/zimpl.pdf(中,函数的参数只能是数字或字符串。

您可以将alpha定义为(w x w'(的交点。所有这些集合操作都在Zimpl中可用。

我已经弄清了解决方案,感谢莱昂的提示:

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]));

最新更新