首页 > 解决方案 > 放大的容量限制

问题描述

我正在构建一个模型,该模型需要我考虑各种船只的容量,但我不确定如何在 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.

我怎样才能解决这个问题?

标签: constraintsamplmixed-integer-programmingoperations-research

解决方案


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;

问候!


推荐阅读