0

我有一个正在转换为 GLPK 的 AMPL 模型文件。它始于:

param n;        # The number of nodes in the graph
set V := {1 .. n};  # The set of vertices in the graph
set E within V cross V; # The set of edges in the graph
set NE within V cross V := {i in V, j in V: i < j} diff E;
set FIXED within V cross V default {}; # The set of demand pairs with fixed flow

运行此程序时,我收到以下错误:

_test.mod:5: set expression following default must have dimension 2 rather than 1
Context:  : i < j } diff E ; set FIXED within V cross V default { } ;
MathProg model processing error

这一定是 MathProg 与其超集 AMPL 之间的句法差异——在 AMPL 中运行代码可以完美运行。如何在 MathProg 中表达一个 2D 空集?

4

1 回答 1

0

好吧,解决方案的技巧是这样的:

set FIXED within V cross V default {i in V, j in V: 1 < 0};

提出一个明显错误的条件。它将具有您想要的维度并且仍然是空的。

于 2017-04-23T02:26:23.623 回答