I can't understand the three lines of code in your latest post. The first line is an if statement that does nothing even if the condition is true. Line 2 has the symbol "Or", which I don't recognize as a Java keyword. Line 3 seems to make a copy of part of an array but then does not assign it to anything.
At any rate, the methods CPLEX provides in its Java API for constructing linear expressions (such as IloCplexModeler.sum() IloCplexModeler.scalProd()) typically have two variants. One takes a single variable (such as x[i][j][k] in your case). The other takes a one-dimensional array of variables. The key here is that the variables are stored in consecutive locations within that array. For any three-dimensional array x[][][], regardless of type (IloNumVar or String or int ...), x[i][j] is a one-dimensional array of consecutive entries of that type. Similarly, x[i] is a one-dimensional array of two-dimensional arrays.
So if you want to work with x[i][j][0], x[i][j][1], ..., you can use the vector version of a modeling function and feed it x[i][j]. If you want to work with x[i][0][k], x[i][1][k], x[i][2][k], ...., you have to create a new vector with those entries scored consecutively. Daniel showed you how to do that using streams. You can also do it by declaring a new IloNumVar[] array and then filling it with a loop. So your code would have a shape like this:
for i= ...
for k = ...
declare IloNumVar[] vector xx
for j = ...
put x[i][j][k] in j-th slot of xxx
end for j
use xx in a modeling expression
end for k
end for i
Because x[i][0][k], x[i][1][k] ... are not stored in consecutive locations of the x matrix, you have to do some reshaping if you want to use "type 1" notation.
#CPLEXOptimizers#DecisionOptimization