【问题标题】:GLPK: set expression following default must have dimension 2 rather than 1GLPK:默认设置后的表达式必须具有维度 2 而不是 1
【发布时间】:2017-04-23 10:26:23
【问题描述】:

我有一个正在转换为 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 空集?

【问题讨论】:

    标签: ampl glpk mathprog


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-23
      • 2018-02-22
      • 2021-06-16
      • 2011-09-26
      • 1970-01-01
      • 2020-09-13
      • 2020-03-07
      相关资源
      最近更新 更多