Skip to main content

Linear program with ceiling or floor functions (HOW?)

Answered

Comments

3 comments

  • 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

Please sign in to leave a comment.