Skip to main content

Migrating from CPLEX to Gurobi

Answered

Comments

3 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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Maliheh Aramon
    • Gurobi Staff
    Hi Masoud, 
     
    To solve an optimization problem with CPLEX C++ API, we typically follow the steps below:
    # Create an environment
    IloEnv env;
    # Create an empty model
    IloModel model(env);
    ...
    # Create a solver object
    IloCplex cplex(model);
    # Optimize
    cplex.solve()
    In Gurobi C++ API, we follow similar steps with one difference where there is no need to create a solver object. The optimize() method is directly called on the model object.
    # Create an environment and start it
    GRBEnv
    env = GRBEnv(true);
    env.start();
    # Create an empty model
    GRBModel model = GRBModel(env);
    ...
    # Optimize
    model.optimize()
    Best regards,
    Maliheh
    0
  • Masoud Kavoosi
    • Gurobi-versary
    • Conversationalist
    • First Question

    Thank you, Maliheh!

    Your explanation clears up everything for me.

    Regards!

    Masoud

    0

Post is closed for comments.