2017-04-16 159 views
0

我有一個AMPL模型文件,我正在將其轉換爲GLPK。它開始:GLPK:下面的默認設置表達式必須具有2維而不是1

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

回答

0

好了,解決的黑客是這樣的:

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

把一個顯然是錯誤的條件。它會有你想要的維度,並且仍然是空的。

相關問題