Skip to main content

Linear program with ceiling or floor functions (HOW?)

Answered

Comments

4 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff Gurobi Staff
    This post is more than three 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 why not try our AI Gurobot?.
  • Silke Horn
    Gurobi Staff Gurobi Staff

    You could model the expression \(\lfloor x\rfloor\) for a decision variable \(x\) by introducing a new integer variable \(y\) and adding the constraints

    $$y <= x$$

    $$y + 1 >= x + \epsilon$$

    where \(\epsilon\) should a little bigger than the feasibility tolerance and the integer feasibility tolerance.

    Of course, \(\lceil x\rceil\) can be modeled similarly.

    Silke

    1
  • zakarya guettatfi
    Gurobi-versary
    Curious
    First Comment

    Thank you this help me a lot

    0
  • Sebastian Meza
    Gurobi-versary
    First Comment
    First Question

    This is the best article I could have found in Gurobi! Thank you!

    0

Post is closed for comments.