Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cplex编码。(有向图)_Cplex_Directed Acyclic Graphs - Fatal编程技术网

Cplex编码。(有向图)

Cplex编码。(有向图),cplex,directed-acyclic-graphs,Cplex,Directed Acyclic Graphs,你好。先生 我用Cplex编写有向图时遇到了一些问题 示例图片如下所示。。 所以,现在我试着做一组弧,比如 集合弧的弧=[(1,2)、(1,3)、(2,5)、(4,5)] 这意味着节点1和2通过弧(1,2)连接,节点1和3通过弧(1,3)连接,以此类推 然后我会做一些约束,比如(node2-node1=weight12) 通过使用Cplex。。我不能代表我想做什么 如果你给我答案,那将对我很有帮助。多谢各位 tuple edge { key int o; key int d; fl

你好。先生

我用Cplex编写有向图时遇到了一些问题

示例图片如下所示。。

所以,现在我试着做一组弧,比如 集合弧的弧=[(1,2)、(1,3)、(2,5)、(4,5)]

这意味着节点1和2通过弧(1,2)连接,节点1和3通过弧(1,3)连接,以此类推

然后我会做一些约束,比如(node2-node1=weight12)

通过使用Cplex。。我不能代表我想做什么

如果你给我答案,那将对我很有帮助。多谢各位

tuple edge
{
  key int o;
  key int d;
  float weight;
}

{edge} edges =
{
  <1,2,12>,
  <1,3,23>,
  <2,5,34>,
  <3,4,45>,
  <4,5,56>
};

float w45=item(edges,<4,5>).weight;

execute
{
  writeln("w45=",w45);
}
56