资源路径位置:类型 CPLEX(默认)无法提取表达式
Resource Path Location : Type CPLEX(default) cannot extract expression
我遇到错误:
CPLEX(default) cannot extract expression
关于表达式
"minimize (1 / 2)*(sum(i in 923..931, j in 1..18, k in 923..931, l in 1..18) (((f[i]*s[i][k])*d[j][l])*x[i][j])*x[k][l])+(1 / 2)*(sum(i in 1..922, j in 1..18, k in 923..931, l in 1..18) (((f[i]*s[i][k])*d[j][l])*y[i][j])*x[k][l])+(1 / 2)*(sum(i in 923..931, j in 1..18, k in 1..922, l in 1..18) (((f[i]*s[i][k])*d[j][l])*x[i][j])*y[k][l])+sum(i in 923..931, j in 1..18) (f[i]*rs[j])*x"[i][j]."
谁能帮帮我?我已经尝试使用 "using CP;" 但它没有用。
我的代码如下:
// Indices, Parameters and variables
int Nbeitems=...;
int Nbnitems=...;
int Nbcorridors=...;
range nitems = Nbeitems+1..Nbeitems+Nbnitems;
range eitems = 1..Nbeitems;
range corridors = 1..Nbcorridors;
dvar boolean x[nitems][corridors];
float y[eitems][corridors]=...;
float f[nitems]=...;
float s[nitems][nitems]=...;
float d[corridors][corridors]=...;
float rs[corridors]=...;
float S[nitems]=...;
// objective funtion
minimize 1/2*sum(i in nitems,j in corridors, k in nitems,l in corridors) f[i]*s[i][k]*d[j][l]*x[i][j]*x[k][l]+1/2*sum(i in eitems,j in corridors,k in nitems,l in corridors) f[i]*s[i][k]*d[j][l]*y[i][j]*x[k][l]+1/2*sum(i in nitems,j in corridors,k in eitems,l in corridors) f[i]*s[i][k]*d[j][l]*x[i][j]*y[k][l] + sum(i in nitems, j in corridors) f[i]*rs[j]*x[i][j];
// constraints
subject to
{ forall (j in corridors)
ctEachitemhasoneslot:
sum (i in eitems) y[i][j] + sum (i in nitems) x[i][j] <= 90;
forall (i in nitems)
ctEachitemhasstorenecessities:
sum(j in corridors) x[i][j]==S[i];
}
在您的 objective 中,您超出了范围。但是如果你写
minimize 1/2*sum(i in nitems,j in corridors, k in nitems,l in corridors)
f[i]*s[i][k]*d[j][l]*x[i][j]*x[k][l]+1/2*
sum(i in eitems,j in corridors,k in nitems,l in corridors:i in nitems)
f[i]*s[i][k]*d[j][l]*y[i][j]*x[k][l]+
1/2*sum(i in nitems,j in corridors,k in eitems,l in corridors:k in nitems) f[i]*s[i][k]*d[j][l]*x[i][j]*y[k][l] +
sum(i in nitems, j in corridors) f[i]*rs[j]*x[i][j];
然后他们就走了
我遇到错误:
CPLEX(default) cannot extract expression
关于表达式
"minimize (1 / 2)*(sum(i in 923..931, j in 1..18, k in 923..931, l in 1..18) (((f[i]*s[i][k])*d[j][l])*x[i][j])*x[k][l])+(1 / 2)*(sum(i in 1..922, j in 1..18, k in 923..931, l in 1..18) (((f[i]*s[i][k])*d[j][l])*y[i][j])*x[k][l])+(1 / 2)*(sum(i in 923..931, j in 1..18, k in 1..922, l in 1..18) (((f[i]*s[i][k])*d[j][l])*x[i][j])*y[k][l])+sum(i in 923..931, j in 1..18) (f[i]*rs[j])*x"[i][j]."
谁能帮帮我?我已经尝试使用 "using CP;" 但它没有用。
我的代码如下:
// Indices, Parameters and variables
int Nbeitems=...;
int Nbnitems=...;
int Nbcorridors=...;
range nitems = Nbeitems+1..Nbeitems+Nbnitems;
range eitems = 1..Nbeitems;
range corridors = 1..Nbcorridors;
dvar boolean x[nitems][corridors];
float y[eitems][corridors]=...;
float f[nitems]=...;
float s[nitems][nitems]=...;
float d[corridors][corridors]=...;
float rs[corridors]=...;
float S[nitems]=...;
// objective funtion
minimize 1/2*sum(i in nitems,j in corridors, k in nitems,l in corridors) f[i]*s[i][k]*d[j][l]*x[i][j]*x[k][l]+1/2*sum(i in eitems,j in corridors,k in nitems,l in corridors) f[i]*s[i][k]*d[j][l]*y[i][j]*x[k][l]+1/2*sum(i in nitems,j in corridors,k in eitems,l in corridors) f[i]*s[i][k]*d[j][l]*x[i][j]*y[k][l] + sum(i in nitems, j in corridors) f[i]*rs[j]*x[i][j];
// constraints
subject to
{ forall (j in corridors)
ctEachitemhasoneslot:
sum (i in eitems) y[i][j] + sum (i in nitems) x[i][j] <= 90;
forall (i in nitems)
ctEachitemhasstorenecessities:
sum(j in corridors) x[i][j]==S[i];
}
在您的 objective 中,您超出了范围。但是如果你写
minimize 1/2*sum(i in nitems,j in corridors, k in nitems,l in corridors)
f[i]*s[i][k]*d[j][l]*x[i][j]*x[k][l]+1/2*
sum(i in eitems,j in corridors,k in nitems,l in corridors:i in nitems)
f[i]*s[i][k]*d[j][l]*y[i][j]*x[k][l]+
1/2*sum(i in nitems,j in corridors,k in eitems,l in corridors:k in nitems) f[i]*s[i][k]*d[j][l]*x[i][j]*y[k][l] +
sum(i in nitems, j in corridors) f[i]*rs[j]*x[i][j];
然后他们就走了