Skip to main content

How to speed up a model with many binary variables and PWL constraints (including absolute values)?

Awaiting user input


1 comment

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    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, 


Please sign in to leave a comment.