Answered question
This question has been answered.

Unanswered question
This question has not been answered yet.

Hi all,
I want to define an array such that its indexer size varies.
For example: Let x v in Vi in Nj in N is a binary variable which equals 1 if vehicle v goes from i to j; 0 otherwise.

In my case x[V][N][N] is a very sparse matrix. But i know that, i depends on v and j depends on i and j.
In other words, a vehicle v can visit only the set of N_v(v) and can proceed to only j's element of set N_iv(i,v).

Thus I wrote the following code:

x[v in V][i in N_v[v]][j in N_iv[i,v]]

But, OPL didn't allow this.

Do you know if it is possible to somehow code this in OPL.
If OPL doesn't support "variable indexer size" do you know if C++ or Java support .

Thank you for any help or tip.

Hi all,
I want to define an array such that its indexer size varies.
For example: Let x v in Vi in Nj in N is a binary variable which equals 1 if vehicle v goes from i to j; 0 otherwise.

In my case x[V][N][N] is a very sparse matrix. But i know that, i depends on v and j depends on i and j.
In other words, a vehicle v can visit only the set of N_v(v) and can proceed to only j's element of set N_iv(i,v).

Thus I wrote the following code:
<pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">x[v in V][i in N_v[v]][j in N_iv[i,v]]
</pre>

But, OPL didn't allow this.

Do you know if it is possible to somehow code this in OPL.
If OPL doesn't support "variable indexer size" do you know if C++ or Java support .

This is the accepted answer.
This is the accepted answer.

By the way,
I know one solution is using Tuple sets in OPL.
But I afraid it may create problem when I want to solve the model with "flow-control" using OPL script.
Also it would be difficult to write hundreds of lines to dictate each possibility.

By the way,
I know one solution is using Tuple sets in OPL.
But I afraid it may create problem when I want to solve the model with "flow-control" using OPL script.
Also it would be difficult to write hundreds of lines to dictate each possibility.

You don't have to read the data in tuples, you can generate them from arrays on the generation step. I am not familiar with problems with tuples and flow control.