# How to progress with CPLEX/Gurobi

I've been learning and playing with CPLEX/Gurobi for a year using C++/Python API. I know some basic stuff like writing a model, callbacks, basic playing with solvers' parameters.

I am wondering what are the most important steps you recommend to learn more about those solvers. I mean the steps to go from apprenticeship to guru status.

The kind of answers I would enjoy (but feel free to suggest whatever you want ) :

• Read this (e.g. tutorial, source code)
• Pay attention to that kind of details
• Implement X
• ...

Edit : I would appreciate a structured step-by-step path.

Backgrounds : B.S. in pure mathematics, M.S. student in Applied mathematics (with O.R specialization)

You may be interest in the blog by @prubin, which has many interesting CPLEX posts: OR in an OB World.

I think the best way to become better at using solvers, is by actually using them in your own projects. An interesting project could be to solve a problem with Benders decomposition, or with multithreaded callbacks.

This blog post from the above-mentioned blog is about Benders decomposition, and can serve as a starting point.

• @prubin should get some points commission for answers referncing his blog as the key substance. But SE apparenlly has no provision for commission points. Sep 9, 2019 at 14:35
• Agreed, but I don't know how we could do this. Sep 9, 2019 at 18:31
• I haven't figured out yet where I can spend these points, so I'm not worried too much about it. ;-)
– prubin
Sep 9, 2019 at 20:38

Solvers like CPLEX and Gurobi usually use the pre-solve steps to simplify the modeled problem. Actually, the aim of pre-solving step is, to eliminate fixed variables, remove redundant constraints, remove linear dependencies, substitute out (implied) free variables, and reduce the size of the optimization problem in general. As a guru user, you may focus on the implementation of those steps and compare the results(in terms of solution time and complexity) with/without those options. In the pre-solve steps, on the other hand, those solvers use some heuristics to modify the solution space which comes out of a black box without any details. Focusing on the implementation of those heuristics may help you understand and even design more effective approaches.

I recommend you read the Gurobi Documentation:

the Gurobi Documentation is better than Cplex Documentation and their classes, functions, ... are similar. Besides that, check some codes using Cplex in a git-hub repository.

A good question to learn more is "how to stop the solver when your model finding the first feasible solution. To clarify, you need to stop your program or return an integer solution found when the column of the Cplex-log named Best Integer to stop being empty".

hint: CPX_PARAM_INTSOLLIM

• Could you elaborate your answer on stopping the solver when it finds the first feasible solution ? Sep 8, 2019 at 22:33
• I will edit this question. Sep 8, 2019 at 22:35

There's an old joke (popular at least in New York, back in the day). Newly arrived tourist to local: "How do I get to Carnegie Hall?" Local to tourist: "Practice, practice, practice."

I can't say how to reach guru status, not having gotten there myself. I suspect it involves working for the tech team that produces one of the solvers. To get to what I might call "power user" status, you need to use the solver repeatedly, starting with easy to formulate models and progressing to models that involve advanced techniques (decomposition, column generation, mysterious oracles, ...).

Things that have helped me get where I am today vis-a-vis CPLEX, in no particular order, are:

• Using it ... a lot.
• Using it with a programming API. APIs require you to attend to details from which modeling languages (such as OPL, MPL, AMPL, GAMS etc.) might shield you. I personally don't think you need experience with more than one API, although it certainly does not hurt. When programming, if something in the API documentation seems unclear or unexpected, take some time to chase it down and see if there is a (possibly hidden) reason why it is the way it is.
• Monitoring the relevant help forums. (I subscribe to the CPLEX forums via RSS feed.) Not only can you get your own questions answered, but you can learn tidbits about the internals from seeing the answers to other peoples' questions ... plus you can find out where people get confused by the solver.
• Watching for solver-related questions and answers on forums such as this one.
• Experimenting, as time permits, to see if you can figure out the answer to a question (or the source of an error message) when someone asks something not particularly mundane on one of those forums.
• Attending conference workshops (and occasionally presentations in technical sessions) by the vendor. IBM, Gurobi and (I think) FICO put on workshops at some conferences, including the INFORMS annual meetings.
• Stopping by the vendor booths at those conferences and chatting up the technical folks.
• Attending (or watching after the fact) vendor webinars. I know that IBM and Gurobi both have periodic free webinars on topics related to their solvers, and I'm pretty sure I've seen FICO webinars listed.

I'm not sure that list is exhaustive, but it's all I can think of at the moment.