有没有办法在 CPLEX 中计算 multi objective?
Is there a way to calculate multi objective in CPLEX?
我的问题有 2 个 objective 函数,我尝试了“staticLex”,但它向我显示错误:“CPLEX(默认)无法提取表达式:最小化 nulti crit [2] {-> e1-> e2->}->."
dexpr float e1 = sum(k in Day)(W [k])^2;
dexpr float e2 = sum(i in Task) (q [i]*n[i]*m[i]);
minimize staticLex(e1, e2);
//Error:"CPLEX(default) cannot extract expression: minimize nulti crit [2] {-> e1-> e2->}->."
是否有任何方法可以修复此错误或任何其他方法来计算 CPLEX 中的多 objective 问题?
提前致谢!
我的完整代码:
int NumbDay =...;
int NumbTask =...;
range Day = 1 .. NumbDay;
range Task = 1 .. NumbTask;
float h [Day]=...;
float c [Day]=...;
float d [Day]=...;
float R [Task]=...;
float E [Task]=...;
float O [Task]=...;
float t [Task]=...;
dvar float+ q [Task];
dvar float+ n [Task];
dvar float+ m [Task];
dvar float+ W [Day];
dvar boolean X [Day][Task];
execute PRE_PROCESSING {
cplex.epgap = 0.1;
cplex.tilim = 100;
}
dexpr float e1 = sum(k in Day)(W [k])^2;
dexpr float e2 = sum(i in Task) (q [i]*n[i]*m[i]);
minimize staticLex(e1, e2);
subject to
{
constraint_1:
forall (k in Day){
sum(i in Task) t [i]*X [k][i] == W [k];
}
constraint_2:
forall (i in Task){
sum(k in Day) X [k][i] == 1;
}
constraint_3:
forall (k in Day, i in Task){
X [k][i] == 0 || X [k][i] == 1;
}
constraint_4:
forall (i in Task){
sum(k in Day) X [k][i] * h [k] <= R [i];
}
constraint_5:
forall (k in Day, i in Task){
q [i] == R [i] - sum(k in Day) X [k][i] * h [k];
}
constraint_6:
forall (i in Task){
sum(k in Day) X [k][i] * c [k] <= E [i];
}
constraint_7:
forall (k in Day, i in Task){
n [i] == E [i] - sum(k in Day) X [k][i] * c [k];
}
constraint_8:
forall (i in Task){
sum(k in Day) X [k][i] * d [k] <= O [i];
}
constraint_9:
forall (k in Day, i in Task){
m [i] == O [i] - sum(k in Day) X [k][i] * d [k];
}
}
q [i] * n [i]* m [i]
不是线性的。
您可以尝试使用线性表达式或使用 cpoptimizer 吗?
我的问题有 2 个 objective 函数,我尝试了“staticLex”,但它向我显示错误:“CPLEX(默认)无法提取表达式:最小化 nulti crit [2] {-> e1-> e2->}->."
dexpr float e1 = sum(k in Day)(W [k])^2;
dexpr float e2 = sum(i in Task) (q [i]*n[i]*m[i]);
minimize staticLex(e1, e2);
//Error:"CPLEX(default) cannot extract expression: minimize nulti crit [2] {-> e1-> e2->}->."
是否有任何方法可以修复此错误或任何其他方法来计算 CPLEX 中的多 objective 问题? 提前致谢!
我的完整代码:
int NumbDay =...;
int NumbTask =...;
range Day = 1 .. NumbDay;
range Task = 1 .. NumbTask;
float h [Day]=...;
float c [Day]=...;
float d [Day]=...;
float R [Task]=...;
float E [Task]=...;
float O [Task]=...;
float t [Task]=...;
dvar float+ q [Task];
dvar float+ n [Task];
dvar float+ m [Task];
dvar float+ W [Day];
dvar boolean X [Day][Task];
execute PRE_PROCESSING {
cplex.epgap = 0.1;
cplex.tilim = 100;
}
dexpr float e1 = sum(k in Day)(W [k])^2;
dexpr float e2 = sum(i in Task) (q [i]*n[i]*m[i]);
minimize staticLex(e1, e2);
subject to
{
constraint_1:
forall (k in Day){
sum(i in Task) t [i]*X [k][i] == W [k];
}
constraint_2:
forall (i in Task){
sum(k in Day) X [k][i] == 1;
}
constraint_3:
forall (k in Day, i in Task){
X [k][i] == 0 || X [k][i] == 1;
}
constraint_4:
forall (i in Task){
sum(k in Day) X [k][i] * h [k] <= R [i];
}
constraint_5:
forall (k in Day, i in Task){
q [i] == R [i] - sum(k in Day) X [k][i] * h [k];
}
constraint_6:
forall (i in Task){
sum(k in Day) X [k][i] * c [k] <= E [i];
}
constraint_7:
forall (k in Day, i in Task){
n [i] == E [i] - sum(k in Day) X [k][i] * c [k];
}
constraint_8:
forall (i in Task){
sum(k in Day) X [k][i] * d [k] <= O [i];
}
constraint_9:
forall (k in Day, i in Task){
m [i] == O [i] - sum(k in Day) X [k][i] * d [k];
}
}
q [i] * n [i]* m [i]
不是线性的。
您可以尝试使用线性表达式或使用 cpoptimizer 吗?