Skip to main content

add constraints in callback

Answered

Comments

5 comments

  • Official comment
    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.
  • David Torres Sanchez
    • Gurobi Staff

    Hi Peilin,

    You can add some lazy cuts to achieve this.
    See our TSP example:

    Cheers, 
    David

    0
  • peilin chan
    • Gurobi-versary
    • First Comment
    • First Question

    Hi David,

    Thanks for your advices.

    Does lazy cuts be considered in the following solve? The cuts I want to add is to exclude some unpromising feasible solutions, which is different from that in TSP model to exclude infeasible solutions.

    Best regards,

    Peilin

    0
  • David Torres Sanchez
    • Gurobi Staff

    Hi Peilin,

    In that case you can use user cuts (instead of lazy cuts), however these will not remain for the next solve.
    One way to keep these would be to save them in a separate container and add them all after the solve.

    Cheers, 
    David

    0
  • peilin chan
    • Gurobi-versary
    • First Comment
    • First Question

    Get it. Thank you David

    0

Post is closed for comments.