constraints - 放大的容量限制
问题描述
我正在构建一个模型,该模型需要我考虑各种船只的容量,但我不确定如何在 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.
我怎样才能解决这个问题?
解决方案
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;
问候!
推荐阅读
- python - 在 Airflow2.0 中自动 Log cleanup dag 不起作用
- twisted - 在“Big Sur”下安装 Twisted 失败
- javascript - ReactJS输入范围错误无法阻止被动事件侦听器调用中的默认值
- java - 为什么 lambda 表达式的参数包含对象?
- binary - Java:二进制形式表示
- react-native - 如何再次更新 redux 状态?
- python - 相对于没有重复列的列转置数据框
- react-native - React Native fontWeight 在 iOS 中不起作用
- neo4j - 如何组合两个或多个 neo4j 密码结果列
- rust - Rust“太多列表”自引用?