This example illustrates how AIMMS can be used as an optimization component from within an external program, using Microsoft COM technology. In this example data is transfered back and forth to an AIMMS model. The external program will also call a procedure within the AIMMS model. The AIMMS model is a simple transport model and contains all relevant declarations and procedures.
In the model formulation of this example project no input data is read at all. Instead, all input data is supplied from within the external program through the AIMMSCOM interface.
To run the external program:
- make sure that you have installed the AIMMS Launcher, which can be downloaded here; this will automatically register the AIMMS COM interface on a per-user basis. It allows you to use the AIMMS COM interface for any installation-free AIMMS version installed on your machine.
- run the program RunAIMMS.exe.
The results of optimizing the transport model are displayed in the file RunAIMMS.out.
The RunAIMMS.exe executable can be made via Microsoft Visual Studio 2013. To create the RunAIMMS.exe program yourself:
- make sure you set the proper environment variables for your compiler and target platform first (all compilers provide batch files to do this)
- run 'nmake' in the 'Source' subfolder
- copy the created 'RunAIMMS.exe' program to the folder where the AIMMS project (RunAIMMS.aimms) is located (i.e. 'Calling AIMMSCOM')
AIMMS COM, Component, External program.
A zip file with this example can be downloaded here.