Cplex是否支持对决策变量使用ln或指数函数?

问题描述

我试图使用ln和exp函数编写约束,但收到一个错误,提示Cplex无法提取表达式。

forall (t in time)
   Gw_C["Mxr"] == 20523 + 17954 * ln(maxl(pbefore[t]));

  Ed_c ["RC"]== 0.0422* exp(0.1046* (maxl(pbefore[t])));
   
   Gw_C["RC"] == 3590* pow((maxl(pbefore[t]),0.6776);

还有没有其他方法可以在cplex上编码这些约束? 谢谢

解决方法

如果您依赖CPLEX中的约束编程,则可以使用exp和log:

using CP;

int scale=1000;

dvar int scalex in 1..10000;
dexpr float x=scalex/scale;

maximize x;

subject to
{
  exp(x)<=100;
}

execute
{
  writeln("x=",x);
}

工作正常,并给出:

x=4.605

但是在CPLEX中使用数学编程时,您不能像这样使用exp。

如果通过linearization,您可以做些什么。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...