Resource Path Location Type CPLEX(default) cannot extract expression

492 views Asked by At

I get this error,"CPLEX(default) cannot extract expression",but when I delete the log function in object function, the error is solved. My code is as follow :

range k=1..4;
range n=1..4;
//inputs
float p[n][k]=...;
float M=...;
float B=...;


//variables
dvar boolean w[n];
//objective



maximize  (sum(k in  k) log(sum(n in n)(w[n]*exp((-1*p[n][k]))))) ;

//constraints
subject to
{   
  sum (n in n) w[n]<= 2 ;
}

It is confusing; I do not know what the problem is. Does anyone know the solution?

2

There are 2 answers

0
Alex Fleischer On

Indeed log is not supported by CPLEX but CP can handle that. Can you add

using CP;

at the beginning of your model?

0
Arlita Nurmaya Asri On

you should have different name for the loop, i.e sum(k in k) should replace the first k with another name because you already declare the second k as a range. for example: sum(l in k)