【发布时间】:2020-03-07 05:06:47
【问题描述】:
我正在使用 ILOG CPLEX 解决 LP / MILP 问题。
int n = ...;
range time =1..n;
dvar float+ c[time] in 0..0.3;
dvar float+ d[time] in 0..0.3;
dvar float+ x[time];
int beta[time]=...;
float pc[time]=...;
float pd[time]=...;
//Expressions
dexpr float funtion = sum(t in time) (d[t]*pd[t]-c[t]*pc[t]);
//Model
maximize function;
subject to {
x[1] == 0.5;
c[1] == 0;
d[1] == 0;
forall(t in time)
const1:
x[t] <= 1;
forall(t in time: t!=1)
const2:
(x[t] == x[t-1] + c[t] - d[t]);
forall(t in time: t!=1)
const3:
( d[t] <= 0) || (c[t] <= 0);
如您所见,我已使用“const3”强制 c[t] 和 d[t] 永远不要大于 0。
我的问题是,如何在 LP/MILP 数学公式中表示此约束?
添加这个新变量是否足够? :
y[t]≤c[t]+d[t]
y[t]≥c[t]
y[t]≥d[t]
0≤y[t]≤M(M为c或d的最大值)
【问题讨论】:
标签: optimization mathematical-optimization linear-programming cplex mixed-integer-programming