How to speed up a model with many binary variables and PWL constraints (including absolute values)?
Awaiting user inputHiya I'm now working on an MILP model which is running super slow (tried tuning the parameters but not good enough).
In the model there is a core variable h (range:10 to10) and also another variable abs_h representing the absolute value of h. I got two piecewise linear constraints that are built based on h or abs_h. Assumed p and q are two other continuous variables. a,b,m,n are all known parameters.
PWL constraints can be built based on abs_h
Or built using h directly, but of course more segments.
My model is a little bit big. It covers multiple time periods and nodes so there are hundreds of variables h and abs_h in the actual model. And the p and q variables are interacting with other constraints/variablesquite a complex one.
I'm wondering which approach takes longer time? 1: only using variable h and the two PWL constraints built using h, with six segments; 2: introducing the variable abs_h, and then building PWL constraints using abs_h, fewer segments but I need extra variables.
Also would it be faster if I write PWL constraints manually (like in the older versions)? I got binary variables indicating whether abs_h>1 or not somewhere else in this model.
I also got a bilinear term "integer var * continuous var" in my model. Would it seriously affect the convergence speed? My previous method is to introduce more binary variables and constraints to avoid it, and I think it should be another reason causing the slow speed. Any way to handle it?
Many thanks!

Hi Tong,
I'm wondering which approach takes longer time?
My guess would be that approach 2 would be faster. However, this is really just a gut feel so it might make sense to test both.
Also would it be faster if I write PWL constraints manually (like in the older versions)? I got binary variables indicating whether abs_h>1 or not somewhere else in this model.
Theoretically, there should be no difference. I would recommend using Gurobi's built in PWL feature just to save time and avoid possible mistakes.
I also got a bilinear term "integer var * continuous var" in my model. Would it seriously affect the convergence speed? My previous method is to introduce more binary variables and constraints to avoid it, and I think it should be another reason causing the slow speed. Any way to handle it?
It might seriously affect performance. However, before introducing multiple binaries, I would definitely just try implementing the bilinear terms. Often Gurobi can handle them very well.
Once you have a final model standing and the performance is still bad, you might want to share it so someone in the Gurobi Team would take a look. Note that uploading files in the Community Forum is not possible but we discuss an alternative in Posting to the Community Forum.Best regards,
Jaromił0
Please sign in to leave a comment.
Comments
1 comment