Increase solve time when using a dictionary of variables instead of several variables

31 views
Skip to first unread message

Camille Hamon

unread,
May 5, 2020, 8:24:53 AM5/5/20
to pulp-or-discuss
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


 

Stuart Mitchell

unread,
May 5, 2020, 6:48:17 PM5/5/20
to pulp-or...@googlegroups.com
How long is the solve time?

If the solve time is over 5 minutes this is strange.

If the solve time is very short I wouldn't worry about it. 
The ordering of variables sent to the solver can make surprising differences in solce time

Stu
Stuart Mitchell
PhD Engineering Science
Extraordinary Freelance Programmer and Optimisation Guru


--
New posters to this group are moderated which can take up to 48 hours, so please be patient if your first post takes a while to turn up.
---
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/dd451bb0-e5bc-4669-b1fe-00a85096ee78%40googlegroups.com.

Camille Hamon

unread,
May 6, 2020, 2:10:36 AM5/6/20
to pulp-or-discuss
We have a solve time of a few hours. So any increase of solve time is of concern. Is there a way to control the ordering of variables sent to the solver?
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or...@googlegroups.com.

Camille Hamon

unread,
May 6, 2020, 7:26:07 AM5/6/20
to pulp-or-discuss
On second thoughts, it is not feasible to order variables in an optimal way in large problems, but still good to know that the ordering can have such an impact.

Stuart Mitchell

unread,
May 6, 2020, 5:48:02 PM5/6/20
to pulp-or...@googlegroups.com
Well if your solve takes that long. I would suspect that maybe the formulation has changed a little. 

If it is a mip perhaps you now have a looser formulation that takes longer to solve. 

Stu

To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/8bc9eb3f-b7d3-4578-b898-dcc57e558888%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages