Skip to main content

Variate Piece-wise Linear Function

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • w sj
    • Gurobi-versary
    • First Question
    • First Comment

    If your function is continuous, perhaps you can first convert it into a linear function and then use addconstr

    0
  • Jaromił Najman
    • Gurobi Staff

    Hi Natalie,

    In your code snippet, the definition of \(x\) variables is missing.

    Note that the size of the \(\texttt{xpts}\) and \(\texttt{ypts}\) lists has to be the same, see addGenConstrPWL and the documentation on PWL.

    In your case, you want the \(\texttt{ypts}\) to hold the values at break points of you function, i.e.,

    xpts = [0, 4800, 15000, 30000 ]
    ypts = [0, 24960, 75960, 144960]

    With the \(x\) points and \(y\) points Gurobi is able to compute the PWL segments that you define via linear terms in your function.

    Best regards, 
    Jaromił

    0

Post is closed for comments.