Smart models start small

There is only one good way to build large-size or complex optimization models: to start by a small model and adding elements gradually until you get the model you wanted in the first place. I have seen so many people (including myself) try to build large-size, complex models from scratch, only to spend countless frustrating hours trying to debug all kinds of problems. It just doesn’t work.

A better approach is to start with the simplest version of the model. On or two decision variable categories and two to three constraint families, not more. For instance, if you’re doing network design, it should start as an uncapacitated facility location model. If you have a large data set, start with a smaller subset containing 5 to 10 decision variables of each type.

A model this size will solve really fast, and if you did any kind of error (bad data, typos, programming or modeling errors), you should be able to find them pretty fast. When the model solves and the solution makes sense, then you can try the same model on your big data set to check whether it still works. If the small data set solves but the large one is infeasible, then it is likely that the cause is bad data in your large model.

Once the big model solves and the answer is correct, you revert back to the small model, and add one or two constraint families (and associated variables if needed). Once the small model solves, you scale it up to the larger version. You can repeat this process iteratively until you get the model you wanted in the first place.

Among the benefits of using this technique:

  1. You build a better understanding of how the model components affect the model as a whole;
  2. You will likely spend less time overall writing and debugging the model;
  3. You reduce the risk of your model not being able to solve at all and not knowing why;
  4. It is easier to find whether the cause of an error is the data or the programming / modeling side.

It’s really similar to the practice of unit testing used to produce code: test early and test often.

Credits: The idea of writing this post came when I was reading the “Art of Modeling” chapter from Watson M., Lewis S., Cacioppi P., jayaraman J., Supply Chain Network Design, Pearson Education, 2013. Jean-François Puget wrote a blog post about this book, and you can find the book authors’ blog here.

Speak Your Mind