我有多个错误,其中一个说:"Exception from IBM ILOG CPLEX: CPLEX Error 5002: 'q1' is not convex.->."

I'm having multi errors, one of them saying: "Exception from IBM ILOG CPLEX: CPLEX Error 5002: 'q1' is not convex.->."

我试图在 CPLEX 中 运行 这个模型,但我遇到了一些错误。

  1. 我的 objective 函数 e2 出现错误提示:“无法提取表达式:(q[i][j]*n[i][j])*m[i] [j]

  2. 我正在尝试使用“最小化 staticLex(e1, e2)”来解决这个 2 objectives 问题,但它说:“无法提取表达式:最小化 nulti crit [2 ] {-> e1-> e2->}->”。我认为这与上面声称的函数e2的错误有关。

  3. 当我尝试 运行 仅最小化函数 e1 时,它说:“IBM ILOG Concert 异常:内存不足。”,我的笔记本电脑有 8Gb 内存,intel i7 -7700HQ,GTX 1050 4GB(我 运行我的 NVIDIA 处理器正在运行)

这是我在 CPLEX 中的模型:

int NumbDay =...;
int NumbTask =...;


range Day = 1 .. NumbDay;
range Task = 1 .. NumbTask;

int maxRepetition = NumbDay;
dvar int F [Task] in 1..maxRepetition;
range Repetition = 1 .. maxRepetition;


float h [Day]=...;
float R [Task]=...;
float c [Day]=...;
float E [Task]=...;
float d [Day]=...;
float O [Task]=...;
float t [Task]=...;
float T = NumbDay;
float P [Task] =...;


dvar float+ r [Task][Repetition];
dvar float+ e [Task][Repetition];
dvar float+ o [Task][Repetition];
dvar float+ q [Task][Repetition];
dvar float+ n [Task][Repetition];
dvar float+ m [Task][Repetition];
dvar float+ W [Day];
dvar boolean X [Day][Task][Repetition];


execute PRE_PROCESSING {
  cplex.epgap = 0.1;
  cplex.tilim = 100;
}


dexpr float e1 = sum(k in Day)(((sum(k in Day, i in Task, j in Repetition) t[i]*X[k][i][j])/30) - W [k])^2; //error: out of memory (I use 8GB of RAM laptop)

dexpr float e2 = sum(i in Task, j in Repetition) q [i][j] * n [i][j] * m [i][j]; //error: CPLEX(default) cannot extract expression: (q[i][j]*n[i][j])*m[i][j].

minimize staticLex(e1, e2); //error: CPLEX(default) cannot extract expression: minimize nulti crit [2] {->  e1->  e2->}->.

subject to 
{
    constraint_1:
        forall (i in Task){
            F [i] >= P [i];
    }

    constraint_2:
        forall (k in Day, j in Repetition){
            sum(i in Task) t [i]*X [k][i][j]*(j<=F[i]) == W [k];
    }  
  
    constraint_3:
        forall (i in Task, j in Repetition){
            sum(k in Day) X [k][i][j] == 1;
    }

    constraint_4:
        forall (i in Task, j in Repetition, k in Day){
            X [k][i][j] == 0 || X [k][i][j] == 1;
    }
  

//Constraints related to flight hour (FH):
    constraint_5:
        forall (i in Task, j in Repetition){
            sum(k in Day) X [k][i][j] * h [k] <= r [i][j];
    }

    constraint_6:
        forall (i in Task, j in Repetition){
            q [i][j] == r [i][j] - sum(k in Day) X [k][i][j] * h [k];
    }

    constraint_7:
        forall (i in Task, j in Repetition){
            r [i][j] <= 10 * T;
    }

    constraint_8:
        forall (i in Task){
            r [i][1] == R [i];
    }

    constraint_9:
        forall (i in Task, j in Repetition: (j + 1) in Repetition){
            r [i][j+1] == R [i] + sum(k in Day) X [k][i][j] * h [k];
    }
 
//Constraints related to flight cycle (FC):
    constraint_10:
        forall (i in Task, j in Repetition){
            sum(k in Day) X [k][i][j] * c [k] <= e [i][j];
    }

    constraint_11:
        forall (i in Task, j in Repetition){
            n [i][j] == e [i][j] - sum(k in Day) X [k][i][j] * c [k];
    }

    constraint_12:
        forall (i in Task, j in Repetition){
            e [i][j] <= 8 * T;
    }

    constraint_13:
        forall (i in Task){
            e [i][1] == E [i];
    }

    constraint_14:
        forall (i in Task, j in Repetition: (j + 1) in Repetition){
            e [i][j+1] == E [i] + sum(k in Day) X [k][i][j] * c [k];
    }

//Constraints related to day (DY):
    constraint_15:
        forall (i in Task, j in Repetition){
            sum(k in Day) X [k][i][j] * d [k] <= o [i][j];
    }

    constraint_16:
        forall (i in Task, j in Repetition){
            m [i][j] == o [i][j] - sum(k in Day) X [k][i][j] * d [k];
    }

    constraint_17:
        forall (i in Task, j in Repetition){
            o [i][j] <= 1 * T;
    }

    constraint_18:
        forall (i in Task){
            o [i][1] == O [i];
    }   

    constraint_19:
        forall (i in Task, j in Repetition: (j + 1) in Repetition){
            o [i][j+1] == O [i] + sum(k in Day) X [k][i][j] * d [k];
    }
}

收到这些错误后,我尝试将 objective 函数 e1 更改为:

dexpr float e1 = sum(k in Day)(W [k])^2;
minimize e1;

但是,我遇到错误“来自 IBM ILOG CPLEX 的异常:CPLEX 错误 5002:'q1' 不是凸的。->。”

你能帮我解决这些错误或给我一些建议,同时仍然使用这个多 objectives 问题模型吗?

在此先感谢您。

q [i][j] * n [i][j] * m [i][j]

不是线性的。

要解决这个问题,您可以尝试在 OPL CPLEX 中使用 CPOptimizer

对于 CPO,您可以使用十进制决策变量:CPO with decimal decision variables

使用CP;

int nbKids=310;
float costBus40=500;
float costBus30=400;
int scale=100;

 
dvar int+ scalenbBus40;
dvar int+ scalenbBus30;

dexpr float nbBus40=scalenbBus40/scale;
dexpr float nbBus30=scalenbBus30/scale;
 
minimize
 costBus40*nbBus40  +nbBus30*costBus30;
 
subject to
{
 40*nbBus40+nbBus30*30>=nbKids;
}

execute
{
  writeln("nbBus40 = ",nbBus40);
  writeln("nbBus30 = ",nbBus30);
}