在CPLEX中求和

时间:2018-07-07 22:43:31

标签: cplex opl

我想在IBM cplex中划分两个dvar cplex:

dvar int BP_i_j [r_i][r_j]; 

dvar int Q_i_j_t [r_i][r_j][r_t];

 dexpr float cost = p_n * sum(t in r_t , j in r_j) ( 

      sum(i in r_i )  c_i_j_t [i][j][t] *  x_i_j_t [i][j][t]  + 

      sum(i in r_i )  BP_i_j[i][j] * x_i_j_t [i][j][t]  /   Q_i_j_t [i][j][t] 

)

我明白了

  

函数运算符/(dvar float +,dvar float +)在上下文CPLEX中不可用

要解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

using CP;
dvar int x;
dvar int y in 1..10;

dexpr float z=x/y;

subject to
{
z==0.5;
}

execute
{
writeln(x,"/",y);
}

有效