Tech Blog

Tips and Tricks for AIMMS Users

Run batch commands in AIMMS Command Line Tool

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:

AimmsCmd ExampleProject.prj

AIMMS command line tool offers a set of commends, for example,

  • assigning values:
    Let Demand := 100;
  • displaying the contents:
    Display Supply;
  • 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
This entry was posted in Advanced on by .

Changing colors for different identifier types in AIMMS IDE

Display variables in green

Display variables in green

In an earlier blog article I already showed that you can toggle the display of line numbering in the AIMMS IDE editor by changing one of the IDE editor settings.

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.

Continue reading »

This entry was posted in Beginner on by .

Determine the calling procedure

Determine calling procedure

Determine calling procedure

For something we were working on, we had to find a way to determine which procedure was calling the current procedure.

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.

Continue reading »

This entry was posted in Advanced on by .

Save a case from AIMMS procedure

Save case with procedure

Save case with 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.

Continue reading »

This entry was posted in Beginner on by .

Keyboard shortcuts for AIMMS

Keyboard shortcuts

Keyboard shortcuts

Although a lot of people prefer to work with the mouse, there is also a big group of people who like to use the keyboard as much as possible. To make life a little bit easier for this group, there are a number of keyboard shortcuts available in AIMMS that allow for quick access to certain features within AIMMS.

In this blog article, I will show the list of shortcuts that are provided by AIMMS.
Continue reading »

This entry was posted in Beginner on by .

Alternative MIP solutions with CPLEX solution pool

Alternative solutions

Alternative solutions

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.

Continue reading »

This entry was posted in Advanced on by .

Solve problems in parallel with asynchronous solver sessions

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.

Continue reading »

This entry was posted in Advanced on by .

Using model tree structure information in your model

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.

Continue reading »

This entry was posted in Advanced on by .

Displaying line numbers in the editor of the AIMMS IDE

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 »

This entry was posted in Beginner on by .

Quickly get text representation of one or more identifiers

When you need to share some identifiers with another person (e.g. on the AIMMS Google group or during contact with AIMMS Support), most of the times you can just copy the definition field of a parameter/variable/constraint. However, sometimes you must not only share the definition, but the values of all attributes, including the index domain/unit/etc.
Continue reading »

This entry was posted in Beginner on by .
  • Customer Reviews

    Read more AIMMS reviews
  • Review AIMMS on G2 Crowd
  • Recent Posts

  • Categories