Is presolve is able to remove constraints like 1<=1

148 views
Skip to first unread message

Minh Vu Duc

unread,
Sep 23, 2015, 6:21:37 PM9/23/15
to Gurobi Optimization

Hello the community,

I have some always true constraints like 1<=1 after the modification of the model. I would like to know if presolve is able to remove these constraints in the model?

By the way, I add this line of code 

model = model.presolve(); 

and it gives me a crash of the application while running.

Thanks for your suggestion,


Sonja Mars

unread,
Sep 24, 2015, 3:28:05 AM9/24/15
to gur...@googlegroups.com
Hi,

> I have some always true constraints like 1<=1 after the modification of the model. I would like to know if presolve is able to remove these constraints in the model?
>
Yes, presolve will remove these constraints.

> By the way, I add this line of code
>
> model = model.presolve();
>
> and it gives me a crash of the application while running.
First question: Why do you want to call presolve directly? This routine is normally used for debugging, you don't have to call it in order to optimize your problem. If you just call model.optimize() Gurobi will automatically start the presolve routines (unless you have not turned them off). Additionally, please note that model.presolve() returns the presolved model. This is not the original model anymore, for example some variables and constraints could be removed. So you have to be very careful what you do with the model object after this call.

Second question: Can you give some more details of this "crash"? When I call this line on a model, everything seems to run normal. To be able to reproduce this, we definitely need more details.

Thanks and best regards,
Sonja

-----------------------------------------------------------------
Dr. Sonja Mars
Gurobi Optimization






>
> Thanks for your suggestion,
>
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "Gurobi Optimization" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gurobi+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Minh Vu Duc

unread,
Sep 24, 2015, 4:57:18 PM9/24/15
to Gurobi Optimization

Hi Dr. Sonia Mars,

First, thanks for your response of my question. 

For your question, because I just want to have a LP model without "1<=1" constraints when I call model.export() function. So I think model = model.presolve() will give me a more compact model without redundant constraints. I do not know if this code is correct or not. It gave me a crash immediately (that means it stop from the first iteration of the loop)

My code template:

build the model;
while not stop
{
model = model.presolve(); // it gave me a crash from the first iteration
model.optimization();
..
}



I attach the displayed errors in the png file so you can have a look.



Vào 02:28:05 UTC-5 Thứ Năm, ngày 24 tháng 9 năm 2015, Sonja Mars đã viết:
Capture.PNG

Sonja Mars

unread,
Sep 25, 2015, 3:06:08 AM9/25/15
to gur...@googlegroups.com
Hi,

Please note, in the presolved model there are a lot of things different. Gurobi will for example try to aggregate constraints and variables and it will try to re-scale your model. So you can end up with a completely different model, where the variables don't have the same meaning anymore. Additionally, if you are calling optimize() right after presolve() this will also do the presolving twice, as optimize() will presolve the new model again.

To just remove the redundant constraints the presolve() method is not the right one. I guess you will have to write your own routine.

Best regards,
> <Capture.PNG>

Minh Vu Duc

unread,
Sep 25, 2015, 5:28:43 PM9/25/15
to Gurobi Optimization

Thanks for your answer. Do you have any idea of the crash when I call the presolve function? Without it, my code works well.

Best,

Vào 17:21:37 UTC-5 Thứ Tư, ngày 23 tháng 9 năm 2015, Minh Vu Duc đã viết:

Sonja Mars

unread,
Sep 29, 2015, 1:29:06 AM9/29/15
to gur...@googlegroups.com
Hi,

Thanks for reporting this, we will address this issue in our next release. As a workaround you can just use a new GRBModel object for storing the presolved model instead of re-using the original model.

Best regards,
Sonja

Minh Vu Duc

unread,
Sep 29, 2015, 8:50:43 AM9/29/15
to gur...@googlegroups.com

Thanks, for your information, even I try with the new gorubi variable, it still crashes.

Best,

You received this message because you are subscribed to a topic in the Google Groups "Gurobi Optimization" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gurobi/FszoX0-Tx1I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gurobi+un...@googlegroups.com.

Sonja Mars

unread,
Sep 30, 2015, 2:34:53 AM9/30/15
to gur...@googlegroups.com
Hi,

Can you post some sample code of what exactly you are trying to do?

Thanks,
Sonja

Minh Vu Duc

unread,
Oct 2, 2015, 9:31:00 PM10/2/15
to Gurobi Optimization

I just call GRBModel tmpModel = model.presolve();


Vào 01:34:53 UTC-5 Thứ Tư, ngày 30 tháng 9 năm 2015, Sonja Mars đã viết:

Sonja Mars

unread,
Oct 5, 2015, 3:28:21 AM10/5/15
to gur...@googlegroups.com
Hi,

Sorry, but we cannot reproduce this. On our systems this call runs fine. We don't see a crash.

Can you please give us some more details about your system? Can you produce a minimal example of code that produces the crash on your system and post this code here? This would be very helpful for us to find out what is going on.

Thanks,
Sonja
Reply all
Reply to author
Forward
0 new messages