Hi,
I have been reformulating an optimisation problem and used a dictionary of variables instead of several separate variables. By this, I mean the following.
Originally, I had the following two variables Mgplant0 and Mgplant1 (each with two dimensions, hence the trailing _0_1 and _1_1)
0 <= Mgplant0_0_1 <= 1 Integer
0 <= Mgplant0_1_1 <= 1 Integer
0 <= Mgplant1_0_1 <= 1 Integer
0 <= Mgplant1_1_1 <= 1 Integer
I reformulated this as the following, where the first dimension of Mg_plant replaces the two previous variables (so Mg_plant_(0,....) is equivalent to Mgplant0_... and Mg_plant_(1,....) is equivalent to Mgplant1_,....).
0 <= Mg_plant_(0,_0,_1) <= 1 Integer
0 <= Mg_plant_(0,_1,_1) <= 1 Integer
0 <= Mg_plant_(1,_0,_1) <= 1 Integer
0 <= Mg_plant_(1,_1,_1) <= 1 Integer
(the above only shows the first entries in these variables, the length
of the last direction is about 100, i.e. I've got Mgplant0_0_100, and
similarly for the other variables)
I have noticed that the solve time by doing so increases quite substantially (about one third increase). Nothing else has changed, i.e. the number of constraints and the number of variables are the same.
Does anybody have an explanation for this?
Kind regards
Camille