LP / MILP (CPLEX) 困难

LP / MILP (CPLEX) difficulties

我正在尝试使用 CPLEX 解决优化问题。

//Variables 

int n = ...;
range time =1..n; //n definido em data

dvar float+ c[time] in 0..0.9;
dvar float+ d[time] in 0..0.9;
dvar float+ x[time];

int beta[time]=...;
float pc[time]=...;
float pd[time]=...;

//Expressions

dexpr float objective = sum(t in time) (d[t]*pd[t]-c[t]*pc[t]); 

//Model

maximize objective;

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] - beta[t]*d[t]);             
 }

谁能告诉我如何防止 d[t] 和 c[t] 同时大于 0?

基本上我想这样写:

if( d[t] > 0) c[t] = 0; 

谢谢,

您可以使用逻辑约束:

( d[t] <= 0) || (c[t] <= 0);