【问题标题】:LP / MILP (CPLEX) difficultiesLP / MILP (CPLEX) 困难
【发布时间】:2020-02-29 04:12:24
【问题描述】:

我正在尝试使用 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; 

谢谢,

【问题讨论】:

    标签: linear-programming cplex nonlinear-optimization mixed-integer-programming


    【解决方案1】:

    你可以使用逻辑约束:

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

    【讨论】:

      猜你喜欢
      • 2021-06-01
      • 2020-03-07
      • 2017-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多