Skip to main content

Re-optimizing using Gurobi Callback

Answered

Comments

2 comments

  • Official comment
    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?.
  • Tobias Achterberg
    • Gurobi Staff

    I don't understand why you want to use a callback function here. Inside a callback, you cannot modify or extend the model that you are currently solving. It sounds more like you want to have an outer loop around optimize() calls like this (pseudo code):

    1. Create model for 1 vehicle
    2. Solve model
    3. For i = 2,...,n:
       (a) Get solution for previous solve for i-1 vehicles
       (b) Add variables and constraints to model to extend model to i vehicles
       (c) Construct a MIP start for new model based on solution for i-1 vehicles
       (d) Solve model

    Best regards,

    Tobias

    0

Post is closed for comments.