Hi all,
There are times when I need to create another variable based on the shape of one variable. Since, I don’t know the dimension of the variable. Therefore, I usually write a lot of if-elseif-else-end
blocks to determine the dimension of the variable and then create a new variable based on its dimension.
I’m asking if there can all be a lazy way to achieve this, as follows:
x = @variable(model, [1:2, 1:3])
y = @variable(model, shape_like(x))
Thanks a lot!