Skip to main content

Accessing optimization variables during optimization

Answered

Comments

3 comments

  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Daniel,

    It's certainly not an obvious question!

    We don't have the ability to embed simulation models in the optimization process, but as of Gurobi 10 we do have the ability to incorporate a different type of model from the predictive analytics space into Gurobi models - a machine learning (ML) model.

    You could take an approach called surrogate modeling, where you use a ML model to approximate a function, or indeed another model like a simulation.  Why?  Because ML models are fast to turn inputs into outputs.  The idea would be to use your simulation model to generate a very large dataset which maps input values for your objective function, to the objective function value.  You would then choose a ML model type that is both supported by gurobi-machinelearning and a good choice for your type of problem.  The ML model can then be linked with variables in your Gurobi optimization model - including a variable representing the desired value of the objective function.

    There are a couple of obstacles here though:

    1) Note making a good choice of ML model, creating an appropriate and balanced dataset, and training the ML model to provide a good surrogate model is not a trivial task for those not experienced in machine learning.

    2) The ML model will only approximate the simulation model/objective function.  You may be able to get a very close approximation, but unlikely to be able to replicate it with 100% fidelity.

    If you go down this route, please publish your project to a github account and share a link with us, I'm sure we'd love to see it in action.

    - Riley

     

     

     

    0
  • Daniel Johnson
    Gurobi-versary
    First Comment
    First Question

    Hi Riley,

    Thanks so much for your response! It was very thorough and helpful! 

    I am unsure if I should go down that route at this stage as I have no experience with ML methods and this sounds like it would be a significant undertaking. However, I am glad to know that this option is on the table as it's something I may come back to in the future if I need to optimise the execution time of my algorithms.

    Thanks for your help!

    0
  • Riley Clement
    Gurobi Staff Gurobi Staff

    No worries Daniel, perhaps a simple metaheuristic such as simulated annealing would be better in this case as the objective function can be a "black box".  You may find a handy python framework if you search, but it is also not too hard to code this yourself.

    - Riley

    0

Please sign in to leave a comment.