Tech Blog

Tips and Tricks for AIMMS Users

Scheduling example: Narrowing time window for smaller jobs

Scheduling problem

Scheduling problem

The purpose of this example is to illustrate a few features of the AIMMS identifier types ACTIVITIES and RESOURCES.

In the example used, we model the intuition that smaller jobs get a more narrow time window in which they are to be scheduled. In addition, the time needed between jobs, the change over time, increases with the difference in jobs.

Continue reading »

This entry was posted in Beginner, Technical on by .

Catching errors and warnings in AIMMS

Catching errors

Catching errors

When you created an AIMMS project and let others use it, unfortunately, things hardly go as you planned…. Sometimes you will have users providing the wrong kind of input for your model resulting in AIMMS throwing errors. Before AIMMS 3.10, you could only suppress these errors and check the predefined string parameter CurrentErrorMessage, which would be set by most of the intrinsic AIMMS functions.

This approach however did not let you really catch the errors and act based on the information of the error. With the introduction of AIMMS 3.10, we added error handling routines to AIMMS, allowing you to not only catch errors, but also raise your own errors.

Continue reading »

This entry was posted in Beginner on by .

One year anniversary of AIMMS blog

Birthday

One year

Today marks the 1 year anniversary of this AIMMS blog. When starting with the blog, the idea was to share all kinds of useful information for both beginners with AIMMS, as well as the advanced users.

We have been working hard to point as many people to the blog as possible. Personally, I have found that for quite some questions of people on the AIMMS Google group, as well as questions from customers to our support desk, I can point already to the blog for the answer :)

Over the past year, we have been able to keep up with just over 1 post per week. Our goal is to keep this pace. Fortunately, there is enough of possible content since we see more and more questions coming in on the google group. Some of these questions are perfect for writing an article explaining something about AIMMS in more detail.

Continue reading »

This entry was posted in Uncategorized on by .

Showing messages in windows status bar

In your application, you typically want to provide some feedback informing the end-user about what the application is doing. One very big reason for doing this is that normally end-users don’t have a problem with waiting for your program to finish something, as long as they have some indication that something is still happening :)

Showing message in status bar

Showing message in status bar


One very straight forward approach is to reserve some space of your GUI for providing the feedback. Another way is that AIMMS allows you as a developer to provide some feedback to your end-user is by writing something in the status bar of the application, as shown in the screenshot above. The big advantage of this approach is that you don’t have to reserve any space in your GUI.

Continue reading »

This entry was posted in Beginner on by .

Get top n set elements for some criteria

Top 3

Top 3

When working with sets in AIMMS, two functions that are very useful are the first and last functions. As the names of these two functions already give away, they return you the first element of the set and the last element of a set, respectively.

Sometimes, you are not interested in just the first or last element, but in the first couple of elements of a set (based on some sort of order). Another set related function, that is less known, is the NBest operator in AIMMS. This operator allows you to achieve just this, namely obtain the first n elements of a set based on some sort criteria, which must be provided to the NBest operator as an additional argument.

Continue reading »

This entry was posted in Advanced on by .

Using multiple indices for one set

Multiple indices

Multiple indices for a set

One question that I have seen multiple times being asked to our support via email, as well as on the AIMMS Google Group is a way to use different indices to refer to the elements of a set.

Suppose we have a set Cities, then a parameter Distance would naturally be defined over 2 dimensions (from and to), both coming from this same set Cities. However, if you don’t know that AIMMS can handle multiple indices for a set, a solution approach I have seen come by a couple of times is creating two new sets CitiesFrom and CitiesTo, both subset of the set Cities, containing all elements of the set Cities and each with its’ own index.

Continue reading »

This entry was posted in Beginner on by .

Units of Measurement – Are your computations correct?

A classical method employed by physicists to check equations is the use of units of measurement. Consider the following example:

The following equation, intended to model that a ship is kept afloat, is slightly wrong:

Archimedes - Eureka

Archimedes – Eureka

MaxWeight * WaterDensity < = ShipVolume

Continue reading »

This entry was posted in Beginner on by .

Local Binding vs. Default Binding


Assume there are two sets:

SET:
   identifier :  RootSet
   index      :  i

and

SET:
   identifier :  MySubSet
   subset of  :  RootSet

What is the difference between expression ( i in MySubSet ) and ( i | i in MySubSet ) ?

Continue reading »

This entry was posted in Advanced on by .

Trim leading/trailing spaces from strings

Trimming spaces

Trimming spaces

Recently, I received a question about how to remove leading and trailing spaces from a string parameters in AIMMS. A possible reason want to do this is that input from the end-user might contain additional leading and trailing spaces, which need to be removed before you can actually use the data.

Although some programming languages provide specific functionality to do this, AIMMS does not provide intrinsic functions to achieve this goal. Fortunately, this functionality can easily be implemented in AIMMS by making use of the two intrinsic string manipulation functions, namely StringLength and SubString.

Continue reading »

This entry was posted in Beginner on by .

Connect to Access database file via ODBC connection string

Microsoft Access databases

Microsoft Access databases

For a long time, AIMMS already has the possibility to retrieve/store data from/into any ODBC or OLEDB datasource. Originally, you could provide a UDL file (in case of OLEDB) or a System/User/File DSN (in case of ODBC).

In case you deploy a project where the user of the project can actually choose which specific Access database file should be used, you either would have to generate the .dsn files based on this choice, or let the user choose the specific Access database file via the file selection wizards of the ODBC driver.

Since AIMMS 3.11, another possibility was introduced, namely generating the connection string within AIMMS itself. You could then base this connection string on some file that the end-user had selected. One very big advantage of creating such a connection string instead of using DSN files is that you don’t have to include the database password in the plain-text DSN file if your database requires a password: you can keep this password hidden in the code of your project.

These connection strings can be used in the Data Source attributes of all the database related identifiers AIMMS (e.g. tables, database procedures).

Continue reading »

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

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

  • Categories