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

Help translate mathematic model / optimization to Python

回答済み

コメント

2件のコメント

  • 正式なコメント
    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.
  • Riley Clement
    • Gurobi Staff

    Hi Nizar,

    Check out our Jupyter Notebook Modeling Example for an Intro to Mathematical Optimization Modeling.

    This will provide a good foundation for converting your mathematical formulation into python code using gurobipy.

    For handling overlaps note that for two jobs, k and p, they do not overlap if either start(p) >= end(k) or if start(k) >= end(p) - you should draw diagrams if it helps convince you.  Therefore (using De Morgan's Laws) they overlap if start(p) < end(k) and start(k) < end(p).  You can apply this condition to each pair of jobs before even starting to construct your model to create a list of incompatible pairs, or you could create a function which takes two jobs and returns whether they overlap and use that while constructing your model.  While it is not wrong to have both \(x_{k,m} + x_{p,m} \leq 1\) and \(x_{p,m} + x_{k,m} \leq 1\)  it would not be helpful either, so make sure what when you calculating incompatible jobs you only consider unique pairs.

    - Riley

    0

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