[Python] Is there any benefit of choosing to formulate constraints in a way or another in...

Discussão em 'Python' iniciado por Stack, Março 2, 2025.

  1. Stack

    Stack Membro Participativo

    I have an MINLP problem and let's say the continuous variable Q can only be 0 when the binary variable z is 0. Two ways to formulate this would be:

    m.Equation(Q*(1-z) == 0) (1)

    or

    m.Equation(Q < z*10000) (2)

    whereby 10000 would be the upper bound to the continuous variable Q. Does (1) or (2) have any benefits over the other?

    I've used (1) in my model for heat exchanger network synthesis and I got a good solution pretty quickly. Using (2) takes around 100x longer and it gives worse solution than the one given using (1).

    From what I can see, the MINLP relaxation to (1) would still require z to be exactly 1 for Q to take on non-zero values. Does this have any effect on how APOPT solve the problem?

    Continue reading...

Compartilhe esta Página