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;
}
```

- Ternary operator vs if statement: compiler optimization
- Rectangular Nesting - Convergence to optimal solution using Simulated Annealing
- How to produce codes that always trigger signal SIGFPE (div by zero)?
- Is there a runtime cost of assigning variables in Rust?
- Rounding up to next power of 2
- What's the fastest way to check if a list contains an item in Go?
- How can I optimize the algorithm to find the longest common subsequence (LCS) between two strings?
- SCIP - stuck in clique table clean up
- Is it legal for a C++ optimizer to reorder calls to clock()?
- For loop is slowing down performance. Any alternatives?
- Looking to identify a "classic" problem and identify availble algorithms to solve it
- Unity keeps crashing on while loop (C#) (simplex method program)
- How to calculate a Kernel/Matrix efficiently
- Android M startActivity battery optimization
- Is there a way to further optimize this code?
- Getting adjoint state of solution in Gekko
- HALO support on recent compilers for C++ coroutines
- Which is faster php date functions or carbon?
- How to perform raster calculation (e.g. aspect) on subset of raster based on point intersection in R
- Fastest implementation of sine, cosine and square root in C++ (doesn't need to be much accurate)
- Print All JVM Flags
- Travelling Salesman in scipy
- Hyperopt set timeouts and modify space during execution
- Slow treeview in C#
- Identifying specific items in a df list field to update other fields, at scale
- Generating constraints with conditional summing over several pyomo subsets
- Optimizing for loop for using dictionary values to format new fasta files
- Runtime error when trying to find components in a graph
- performance of log10 function returning an int
- Replace punctuation with whitespace