GLPK:默认情况下设置表达式必须具有维度2而不是1

时间:2017-04-16 01:55:07

标签: ampl glpk mathprog

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

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空集?

1 个答案:

答案 0 :(得分:0)

好吧,解决方案的黑客就是:

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

显然是假的。它具有您想要的维度,但仍然是空的。