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

About the gap does not decrease after optimization

回答済み

コメント

4件のコメント

  • 正式なコメント
    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?.
  • Yanbo Fan
    • Gurobi-versary
    • Investigator
    • Thought Leader

    At the same time, I also feel that my code is complex. What can be simplified?

    0
  • Jaromił Najman
    • Gurobi Staff

    Hi Yanbo,

    It is necessary to provide tight valid lower and upper bounds when working with nonlinear terms. In your particular case, it is enough to provide lower and upper bounds for the \(\texttt{l,h}\) variables, e.g.,

    h = model.addVars(4, lb=1e-4, ub=10000, vtype=GRB.CONTINUOUS, name='h')
    l = model.addVars(4, lb=1e-4, ub=10000, vtype=GRB.CONTINUOUS, name='l')

    This already solves the problem, however with rather large constraint violations. This may happen with highly nonlinear expression which are reformulated as piecewise linear by Gurobi. Lowering the FeasibilityTol

    model.setParam("FeasibilityTol", 1e-7) 

    to \(\texttt{1e-7}\) seems to be enough in this case.

    Best regards,
    Jaromił

    0
  • Yanbo Fan
    • Gurobi-versary
    • Investigator
    • Thought Leader

    Hi,

    Thank you for your reply, I was too anxious to cause my problem. My problem has now been successfully solved, the optimal solution is obtained after running for 600 seconds, and the source code can be successfully solved. Thanks to the powerful function of gurobi, we can solve this nonconvex problem.

    Best regards,

    Yanbo

    0

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