Skip to main content

Create a variable which is rounding of another variable

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • 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?.
  • Juan Orozco
    • Gurobi Staff

    In addition to the real-valued variable flow_variable, you can define the integer-valued variable trucks (preferably with an upper bound based on the fleet).

    Let capacity=1500 be the capacity of a single truck. Then, you can define the following functional constraints:

    capacity * (trucks - 1) <= flow_variable <= capacity * trucks

    Note: depending on the formulation of your model and/or optimality conditions, you may actually only require the second constraint.

    With this in place, you can easily incorporate the decision variable trucks into the objective function.

    0
  • Saichand MVLN
    • Gurobi-versary
    • First Question
    • First Comment

    Thanks for the suggestion. Juan Orozco

    0

Post is closed for comments.