Saturday
Dec152012

Introducing Minimax: an LP solver for iPhone

Introducing Minimax: a linear program (LP) and mixed-integer linear program (MILP) solver for the iPhone.

I created Minimax for a few reasons. There are a few LP solvers already available on iOS, but I had some thoughts on how to design such an app from the ground up to be optimized (!) for the iPhone. I also wanted to experiment with ideas I’ve had for a while for a simple modelling language. I think existing languages have a steeper learning curve than necessary, and their syntax is too verbose to be suited for a mobile device. Finally, I designed Minimax to be the solver I wish existed.

Minimax is intended for students, small businesses, and optimization geeks who see everyday decisions as objective functions and linear inequalities. (Does anyone else do their grocery shopping by minimizing total weight subject to cost and nutritional requirement constraints?) It is best at solving small and medium-sized problems, but is capable of solving problems with hundreds or even thousands of variables and constraints, depending on your iPhone memory (which get bigger each year) and patience.1

Minimax uses a new modelling language called OptML, which was specially designed for the constraints of mobile computing. OptML consists of two distinct syntaxes. The basic syntax writes models out as close to their mathematical formulation as possible, in fact the only difference is that each constraint begins with a colon.

  max 143x + 60 * y
  : 120 x + 210y <= 15000
  : 110x + 30y <= 4000
  : x + y <= 75
  : x, y integer

For simple models, or for beginners, basic syntax is all you need. However, more power is available with macro syntax, which is used for model generation. This includes symbols that you can predefine and substitute later in the model, and constructs such as loops and conditionals. An OptML model is parsed in two phases. First, the macro compiler processes all the macro syntax and outputs basic syntax text. This will be exactly the same as if the equivalent basic syntax had been written out in full. Second, the interpreter reads in the basic syntax model, ready to be solved.

A key feature of Minimax and OptML is the ability to import and create datasets, which are key-value maps. These datasets can be registered at the start of the model, and then the symbols can be called and evaluated within the model.

Check out the Minimax product page for a much more detailed description of the features of the app, with screenshots, and the OptML page for its specification, including examples. You can also follow me on Twitter, @DCWoods, to hear about Minimax news and updates.

Minimax is available now in the App Store.


  1. It can take a long time to tap out a big model on an iPhone keyboard, but you can import models, including models in OPTML and MPS format, and also datasets in CSV format.