【发布时间】:2021-04-09 03:07:18
【问题描述】:
我目前正在 IBM ILOG Cplex 上进行项目编码。我一直在将数学模型转换为 CPLEX 中的约束。在这里,我想知道我们如何在 cplex 上编写这个约束,因为它有 3 个元素。我尝试了 OR 逻辑但结果似乎错误 enter image description here
【问题讨论】:
标签: cplex constraint-programming opl mathematical-expressions
我目前正在 IBM ILOG Cplex 上进行项目编码。我一直在将数学模型转换为 CPLEX 中的约束。在这里,我想知道我们如何在 cplex 上编写这个约束,因为它有 3 个元素。我尝试了 OR 逻辑但结果似乎错误 enter image description here
【问题讨论】:
标签: cplex constraint-programming opl mathematical-expressions
或者在 OPL 中可以正常工作,但您将其写为 ||
参见示例https://github.com/AlexFleischerParis/zooopl/blob/master/zoodisjunction.mod
int nbKids=300;
float costBus40=500;
float costBus30=400;
dvar int+ nbBus40;
dvar int+ nbBus30;
minimize
costBus40*nbBus40 +nbBus30*costBus30;
subject to
{
40*nbBus40+nbBus30*30>=nbKids;
//with nb buses 40 less than 3 or more than 7
(nbBus40<=3) || (nbBus40>=7);
}
【讨论】: