optimizationschedulingcplex

CPLEX Error: operator not available for dexpr int + dvar float[][j][l]


I am writing a code for a goal programming problem in IBM CPLEX. It gives the following error code: "operator not available for dexpr int + dvar float[][j][l]"

Here is a part of my code:

int N=22; 
int M=30; 
int T=3; 
int P=3; 

range I=1..N; 
range J=1..M; 
range K=1..T; 

.... ....

dvar boolean x[I][J][K][L]; 

.... ....

dvar float d1minus[I][J][L]; dvar float d1plus[I][J][L];

..... .....

minimize objective;

subject to{

objective == sum(i in I, j in J, l in L)(d1minus[i][j][l]+d1plus[i][j][l])+sum(i in I). (d2minus[i]+d2plus[i]+d3minus[i]+d3plus[i]) ; 


forall(i in I, j in J, l in L){
  d1minus[i][j][l]>=0;
  d1plus[i][j][l]>=0;
} 

forall(i in I){
  d2minus[i]>=0;
  d2plus[i]>=0;
  d3minus[i]>=0;
  d3plus[i]>=0;
}


 //10 constraints 


//goal 1 

forall(i in I){
  sum(j in J,k in K,l in L)x[i][j][k][l]+d1minus[i][k][l]-d1plus[i][j][l]==24;
 }

 .............

I get the error code for goal 1 (given above).

Please help me to understand my mistake.

I tried several different ways to get rid of the error code, but I could not manage. I tried all the suggestion on Stack Overflow.


Solution

  • There is a missing parenthesis, try:

    forall(i in I){
      sum(j in J,k in K,l in L)(x[i][j][k][l]+d1minus[i][k][l]-d1plus[i][j][l])==24;
     }