Skip to main content

Migrating from CPLEX to Gurobi

Answered

Comments

2 comments

  • Maliheh Aramon
    Gurobi Staff 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

Please sign in to leave a comment.