メインコンテンツへスキップ

Network flow and Truck capacity

回答済み

コメント

2件のコメント

  • 正式なコメント
    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?.
  • Jaromił Najman
    • Gurobi Staff

    Hi Tim,

    There is no built in rounding function for mathematical programming. You can however, introduce auxiliary integer variables to force the cost of shipping to attain integer values, i.e., add constraints

    cost_of_shipping = auxiliary_integer_variable

    If your current model does not allow for integer value of \(\texttt{cost_of_shipping}\) you could introduce auxiliary continuous variables \(x \in [0,0.999]\) to represent the offset to the next integer value. Rounding up could then be modeled as

    cost_of_shipping + x = auxiliary_integer_variable

    In your example, when cost of shipping equals \(2.3\), \(x\) would be \(0.7\) and the auxiliary integer vairable then \(3\).

    Best regards,
    Jaromił

    Best regards,
    Jaromił

    0

投稿コメントは受け付けていません。