Hello,

is it possible to have a multi dimensional set in a variable? If I define the sets and the variable as below, the error 'one dimensional set expected' will appear. Is it possible to avoid this error?

Sets

i products /Product1, Product2 /

Copies possible number of copies /1,2,3,4/

k(i,Copies) copies for product i (multidimensional) /Product1.(1,2,3,4)

Product2.(1,2) /

h position /P1,P2,P3,P4,P5,P6/ ;

...

Binary Variable

y(i,k,h) 1 if and only if copy k of product i is placed in position h

## Multi dimensional Set in a Variable/ error: one dimensional set expected

### Re: Multi dimensional Set in a Variable/ error: one dimensional set expected

Hi Tolo,

At declaration you have to use the one dimensional (static) sets i.e. use sets i and Copies instead of two dimensional set k(i,Copies):

In your model you can then of course use multidimensional sets in the domain of a variable, as long as they match the sets used at declaration
I hope this helps!

Best,

Fred

At declaration you have to use the one dimensional (static) sets i.e. use sets i and Copies instead of two dimensional set k(i,Copies):

Code: Select all

`Binary Variable y(i,i,Copies,h) 1 if and only if copy k of product i is placed in position h `

Code: Select all

`[...] y(i,k,h) [...]`

Best,

Fred