AIMMS is extremely powerful, but sometimes it can be very tricky.

AIMMS uses sparse matrix multiplication methods. It makes a lot of sense, since the matrices in linear or integer programming are usually giant, but sparse. But sparse arithmetics is difficult to understand and there are sometimes troubles caused by this.

Real life problem example

I had a model, whose behavior was very very strange.

It was taking a lot of time, about 10 minutes, in the preprocessing stage. After the long preprocessing, the actual running of the solver was fast, one minute in average.

I checked the formulation dozen of times, but there was no evident mistake.

AIMMS profiler

In order to investigate where the problem was, I used the AIMMS profiler tool.

The profiler can be found in Tools -> Diagnostic Tools -> Profiler.

After one more running of the model, I could find the results in Profiler -> Results Overview.

In this case, it showed clearly that one specific variable – “vNroCac” – was taking too long to be processed. It had clearly a running time several times greater than other variables. I’ve found the offender!

This specific variable had a structure like this: it calculated a lot of things, using other variables as inputs, and some of these variables also used other variables and parameters. I guess the sparse multiplication was taking too long to be processed, due to these several subcalculations…

I simply eliminated this variable and reformulated the model.

Now, the preprocessing time was fine!

Conclusion

The profiler is a great tool for investigating running time calculation problems in Aimms.