Hi,
I getting an error that says " Repeated index 1. Index sets must have unique elements."
My problem has to be the following structure:
x(1,0,0)+x(1,0,4)+x(1,4,0)+x(1,4,4)+x(2,0,0)+x(2,4,0)+x(2,6,0) Max
I reduced one dimesion by concatenating the two last variables (eg. 0_0,0_4), as it is just coordinates in a 2D field.
So I have the following matix:
0 0 “0_0” 1
0 4 “0_4” 1
4 0 “4_0” 1
4 4 “4_4” 1
0 0 “0_0” 2
4 0 “4_0” 2
6 0 “6_0” 2
I was expecting to use the following code lines to make the OF:
But I get the the error of the repeated index. For this case in particular I can work around with concatenating again (1_0_0, 1_0_4…), but if I end up having diffenrent restrictions that migth not be the case.
Am I missing something? As I am new to JuMP and Julia that migth be the case.
Thank you for the help!
Cheers!
Hi @odow,
This last explanation really helped me.
Your second example is what I was looking for. The way I was viewing the creation of the variables was not related with a matrix but with the mathematical problem (basically sum of two indexes “i” and “X_X”).
If I got it right, for JuMP you create an empty matrix to be filled by the optimization so as I was creating a 7x7 matrix it wold not work. I tried a few examples and that seems to be the case.
Just for the record I have this model in Python and was trying to replicate on Julia as training, it is a Pallet Loading problem bottom left one pallet one box maximize. So the “0_0” are viable grid coordinates and the “i” is vertical or horizontal boxes.
Really appreciate the help!