【发布时间】:2019-09-02 03:18:39
【问题描述】:
我正在尝试根据以下条件对树的每个部分[i][j] 的库存成本求和:
X={x[i][j]}
x[i][j] = 1 if has stock at ij
x[i][j] = 0 if has no stock at
库存取决于准备时间,他们自己取决于之前是否有库存如下:
a[i][j] = t[i][j] if it's the end node
= t[i][j] + max(s€sons of the brunch){ a[i+1][s] * (1 - x[i][s]}
代码编译时没有任何结构错误,但数组 a 和决策变量没有得到任何响应
//getting all the sons
range L=0..ligne;
range C=1..colone;
int sons[L][C][C];
int a[L][L];
execute
{
for (var i in Li){
for (var j in C){
for (var k in C){
if (parent[i+1][k] == j){
sons[i][j][k] = k;
}else
sons[i][j][k] = 0;
}
}
a[i][0]=0;
}
for (var j in C){
for (var k in C)
sons[ligne][j][k]=0;
}
}
//the variable and the objective function and constraints
dvar boolean x[L][Ci];
dexpr float TotalCost = aih_cost*adup*(1.5+var_factor)*lt_factor*sum(i in L,j in C)( unit_price[i][j]*rqtf[i][j]*x[i][j]*a[i][j] );
minimize TotalCost;
subject to {
forall(i in Li){
forall(j in C){
forall(k in C)
(1-x[i+1][sons[i][j][k]]) * a[i+1][sons[i][j][k]] + t_process[i][j] - a[i][j] >= 0;
}
}
a[0][1]<=service_t;
}
我希望至少有一个针对 x 的建议数组,以及一些准备时间“a”。
【问题讨论】:
标签: c recursion optimization boolean cplex