For example in the project that I worked out in the earlier blog post Solve problems in parallel with asynchronous solver sessions, I showed how you can start up multiple asynchronous solver sessions in AIMMS to solve multiple different problems simultaneously (if your license allowed for this).
In such cases, you typically do not want to have more simultaneous sessions running than the number of cores present in your computer. The operating system (windows or linux) provides information that allows you to find the number of cores.
Another example is that you could use this information to limit the number of parallel threads of solvers like CPLEX and GUROBI to some value that depends on the actual number of cores that is available.
In the integrated environment or under Linux system, AIMMS supports a command line tool through which you can control an AIMMS project externally. In the command window, you can start the AIMMS command line tool by running:
AIMMS command line tool offers a set of commends, for example,
- assigning values:
Let Demand := 100;
- displaying the contents:
- running procedures:
Run MainExecution ;
Instead of running each command one by one, you can also run batch commands by writing all the commands you want to execute in a text file. For example, the contents of file “MyComannds.txt” are:
Let Demand := 100; Display Supply; Run MainExecution;
By running the following command, you can have them all executed.
AimmsCmd ExampleProject.prj < MyCommands.txt
By doing this, all the running results will be displayed on the command window. If you want to redirect the output to a text file, you can add it to the running command as well.
AimmsCmd ExampleProject.prj < MyCommands.txt > RunLog.txt
One other very useful setting that you can also change is the way different types of identifiers are displayed in the editor. For example, in the picture on the side shows that the variable Assignments in the editor is displayed using a green color. Note that all identifiers of the type variable will have this same green color. Using different colors for different types of identifiers (combined with descriptive names) helps you to quickly understand a definition for example.
One very trivial way would be to introduce an additional argument for the procedure in which the calling procedure must provide its name. The main disadvantage of this approach is that each procedure must always provide this additional input argument. Furthermore, it is also not very robust as there is nothing preventing a procedure to provide the name of a different procedure as the input argument instead of its own.
Therefore, we needed another approach that can determine which procedure did the call to the current procedure.
There are situations where you want to save a case from within a procedure. A typical example of this is when you need to run a lot of scenarios and store the result of each scenario to a separate case. One possible solution is to separately start each scenario and save a case when it is finished.
However, when you have a lot of scenarios or when each scenario takes a very long time to solve, you don’t want to sit behind the computer all the time and do the start/save of each scenario manually. Instead, you want to do this automatically with a procedure. This way you can start the procedure that solves all your scenarios and let it run unattended over night.
In this blog article, I will show the list of shortcuts that are provided by AIMMS.
Continue reading »
In his blog post K Best Solutions, Paul Rubin provides some information on how to obtain the K best solutions for a MIP model. One of the approaches he uses is the solution pool functionality of the CPLEX solver. In the follow-up post K Best Solutions in AMPL/CPLEX he provides the AMPL source code that shows how to use the solution pool feature of CPLEX from within AMPL.
In this post, I will use the same binary knapsack problem used by Paul and with this demonstrate how to make use of this solution pool feature of the CPLEX solver within AIMMS to get alternative solutions for a MIP problem.
Please note that using this solution pool does not need to provide the actual K best solutions: it provides the optimal solution and some sub-optimal alternatives, but from some testing it shows that there might exist some better sub-optimal solutions than the K solutions provided by CPLEX.
In this article, I will explain how to use the asynchronous solver sessions that are in AIMMS in order to solve multiple mathematical programs simultaneously, each using its own CPU core. The idea for this article came from a comment by Will Usher on my previous article. He was interested in an example that shows how to use asynchronous solver sessions in AIMMS.
The tree structure of the model explorer in AIMMS allows you as a modeller to structure your project and make it easy to maintain a good overview. Especially if your model becomes larger, having a well structured model will allow you to quickly find the identifiers you need. For AIMMS, the structure and order of the tree are not important: if you want, you could even declare all your identifiers under one declaration section.
One of the nice things is that you can actually use the information from the tree structure in your model: each section or declaration section that you introduce in your model will automatically create a new set in AIMMS with the same name as the section. This new set is a subset of the predefined set AllIdentifiers and it will contain all identifiers that are declared under the section or declaration section.
When you want to share some information about your model, you typically want to direct another person to take a look at specific lines in a procedure or a definition. In order to do this, you will need to know the specific line number. By default, the editor in the IDE of AIMMS will not show any line numbers in attributes that can be multi-line.
Continue reading »