How long should I run the solver for?

I see the default is usually sub 10 seconds and that I can adjust it to run for longer. What is a good duration limit? How should I think about configuring it?

1 Like

How long you run your model for depends on your operational requirements and your model complexity.

A good place to start is by seeing how long it takes to find a first solution and how quickly solutions improve after that. Most models hit a “knee in the curve” where the cost of running longer outweighs the improvement in the value or KPI you are optimizing for.

To understand your model duration, first set the solution limit to 1 and see how long it takes to find an initial solution to your model. Next try runner.output.solutions all with a duration limit set to the solve time of the first solution + 10s. Using the output, you can plot the value of the each solution by the elapsed_seconds which should produce a curve that looks something like this:


In the graph above you may choose to trade 3k in solution value for 500ms of runtime back for other processing in your system.

This is because we also like to think about decision apps as providing the next decision in the time you have. Typically run time and frequency are inversely related. The less frequent your runs, typically the longer they are because they include more data.

Moral of the story: try out a few duration limits and see how the solution value improves. If the operation is happy with the value from a 5s run, it may be worth saving time and not running to a mathematically optimal solution that is only marginally better.

You can learn more about solver options in the docs here: CLI · Nextmv Docs.