用于处理有向图中循环的多维决策变量

时间:2016-10-22 16:19:45

标签: graph mathematical-optimization shortest-path linear-programming cplex

我正在使用一个使用CPLEX的非定向图的steiner树变体。

在我的解决方案中,图表表示为有向图,我的一个desicion变量(称为 Yuijv )控制路径的方向,因此:

Yuijv = 1如果edge(i,j)用于从u到v的一条路径中,方向U-> i-> j - >诉
Yuijv = 0其他。

以下是 Yuijv 的声明方式(以及一些辅助代码):

//structure
tuple edge {
    int i; //node
    int j; //node
}

tuple path {
    int u;
    edge e;
    int v;
}

setof(path) paths= {<i,<k,l>,j> | i,j in nodes : i!=j, <k,l> in edges: k!=l};

//decicion variable
dvar boolean Yuijv[paths];

但是当我用这个sintax来访问它时:

Yuijv[u,<j,v>,v] = 0;

我收到了这个错误:

Can't use type int for <u:int,a:<i:int,j:int>,v:int>.

在官方文档中搜索,在本网站中,我找不到这个问题的帮助,我真的赞成一些,或者可能是重新定义这个变量的实现的建议。

感谢您的建议。

1 个答案:

答案 0 :(得分:0)

看起来您正在尝试将int值0分配给boolean类型的决策变量。尝试添加约束来修复该值。