【问题标题】:Capacity constraints in ampl放大的容量限制
【发布时间】:2018-04-25 10:15:49
【问题描述】:

我正在构建一个模型,需要我考虑各种船只的容量,但我不知道如何在 ampl 中声明这一点。

目前,我有:

Cap1: forall {i in I, t in T} x[1,i] * people[1,t] <= 500;

其中 I 是路线集,T 是船只经过的行程集。 x[a,i] 是一个指示变量,当船只 a 行驶路线 i 时,它 =1,people[a,t] 是船只 a 在行程 t 上乘坐的人数。

ampl 对于这个约束总是抛出以下错误:

logical constraint _slogcon[1] is not an indicator constraint.

我该如何解决这个问题?

【问题讨论】:

    标签: constraints ampl mixed-integer-programming operations-research


    【解决方案1】:

    AMPL 中的语法与 CPLEX 不同。当你想声明一个“forall”时,你可以这样做:

    subject to constraint{index in set}: content of constraint
    

    所以,在你的情况下,这将是:

    subject to Cap1{i in I, t in T}: x[1,i] * people[1,t] <= 500;
    

    问候!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-04
      • 1970-01-01
      • 1970-01-01
      • 2020-02-07
      • 1970-01-01
      相关资源
      最近更新 更多