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

How to set a constraint which needs the value of variables to calculate

回答済み

コメント

3件のコメント

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

    Hi Hanxiong,

    You have to write the model in a form that Gurobi can solve. You won't be able to define your own black-box function and add it to a constraint.

    If your constraint isn't in a form supported by Gurobi (e.g., has some non-quadratic nonlinear relationships), you can try building a piecewise-linear approximation of the function. In the Python API, you can do this with Model.addGenConstrPWL().

    Does this answer your question?

    Eli

    0
  • Hanxiong Chen
    • Gurobi-versary
    • First Question
    • First Comment

    Thank you

    0

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