Skip to main content

Modeling trigonometric constraints

Answered

Comments

3 comments

  • Maliheh Aramon
    • Gurobi Staff Gurobi Staff

    Hi Victor, 

    You can take advantage of auxiliary variables:

    1. Define an auxiliary variable \(z\) and add the constraint \(z = d_1 - d_2\). 
    2. Define another auxiliary variable \(y\) and add the constraint \(y = \cos(x)\) using the Model.addGenConstrCos() method
    3. Add the constraint \(p_l = k y\) 

    An alternative to step 2) and 3) is to use the Model.addGenConstrPWL() method and implement \(p_l = k \cos(z)\) using supporting points for \(z\) and \(p_l\).

    Best regards,

    Maliheh

    0
  • Victor Hinojosa
    • Gurobi-versary
    • First Comment
    • First Question

    Thank you so much for your message and support.

     

    Best Regards,

    Victor

    0
  • Muhammad Dzulqarnain Firdausi
    • Gurobi-versary
    • First Comment
    • First Question

    Isn't it y = cos(z) ?

    0

Please sign in to leave a comment.