I have a problem with around 3000 suppliers, each supplier is independent. Our Aimms runs in a loop solving a MIP model for each supplier with around 800 variables and a gap of 2%. Each model runs very quickly at around 5-6 seconds, but the entire run of 3000 suppliers takes around 30-40 min. We need to improve the time of the model and I would like some sugestions. Options we are already thinking:
a) Merge the models in batchs of suppliers, creating a bigger model and pass it to the solver.
b) Performance tunning of the CPLEX options
Is there any other suggestion? Is there some way to run the models in parallel for example?
Best answer by Marcel HuntingView original
@rodafig , as @gdiepen mentioned, asynchronous solver sessions might help but you have to make sure that these solver sessions are not going to compete for the (logical) cores. If CPLEX solves an MIP problem then it will use multiple threads, at least for some part of the solve. By default CPLEX can use as many threads as there are (logical) cores; this is controlled by the CPLEX option ‘Global thread limit’. For example, if you have a computer with 8 cores then CPLEX can use 8 threads. If two solver sessions are running at the same time on this computer, each using 8 threads, then the total amount of threads used will be 16 while only 8 cores are available, and this will harm the performance. So if the computer has 8 cores then the following “logical” configurations are possible:
It is hard do say upfront which configuration will be the most efficient.
If the generation time is significant, and the differences between the MIP problems is fairly small, then you could use GMP modification functions to speed up the generation.
Finally, it might be an idea to look at improving the solving time of each MIP problem itself. A first step would be to print the CPLEX status file by switching on the following options:
The CPLEX status file will be printed in the log sub-folder. I would be interested in seeing this CPLEX status file, so if you can generate and share it, that would be great. (This CPLEX status file will also tell us how many threads CPLEX is using during the solve which might be useful information for selecting a configuration with asynchronous solver sessions.)
you can use something like the asynchronous solver sessions to run multiple solves at the same time (will depend on your license how many you can run at the same time).
You can find an example at https://how-to.aimms.com/Articles/261/261-solve-with-asynchronous-solver-sessions.html
Do you know if most of the 5/6 seconds is spent by cplex, or is there also a big part spent in the generating of each model?
@gdiepen thanks for the reply, I will try the solution you suggested. Meanwhile, about the times, is there a easy way to check the time really used by cplex and the time used for generating each model ? I know how to see times in the profiller at Aimms and the 4-6 seconds I saw were in the progress window.
@rodafig , you can get access to these using the GenTime and SolutionTime suffix of the Mathematical Program identifier after you have solved it.
In case you are using the GMP functions (needed for the parallel solver sessions), I am not sure whether there is a specific property you can use to retrieve the generation time, but you can get the solversession time to get the time cplex required. For the generation time with GMP, you can at least always use the stopwatch functionality around the `gmp::instance::generate` function to obtain the time required for generating the mathematical program.