Skip to main content

how to rislove non linear error of my code, it is min flow but with linear function in 3 pieces

Answered

Comments

3 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    You have terms vbk[i,j,0]*(c[i,j,1] * x[i,j]) where vbk and x are both optimization variables. Thus, you have a nonlinear term vbk * x.

    1
  • BASSEMBISKHAYROUN BASHIR KEDIS
    Gurobi-versary
    First Comment
    First Question

    i thought if i do multiply a binary variable that is 0 or 1 with another variable shouldn't give me non linear equation. i delete it and now it works correctly and i can now finish my project, thank you sir a lot.

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    i thought if i do multiply a binary variable that is 0 or 1 with another variable shouldn't give me non linear equation. i delete it and now it works correctly and i can now finish my project, thank you sir a lot.

    A linearization of a product of a binary variable with an integer variable is not easily possible due to the discrete nature of the integer variable. You could represent the integer variable in terms of multiple binary variables but this trade-off is not always good.

     

    You can linearize binary * binary or binary * continuous if finite bounds are given.

    1

Please sign in to leave a comment.