Model Edit API
The AIMMS API supports Model Edit Functions, allowing external applications to inspect, modify or even construct AIMMS models. This example illustrates how the Model Edit functions can be used to build and solve an AIMMS transport model from within an external program, using the AIMMS API.
The external program "Model Edit API.exe" performs the following steps: (Please note that for the 64-bit version of AIMMS, the executable is named "Model Edit API64.exe".)
- It starts up an AIMMS project (empty AIMMS project.aimms).
- It builds a transport model in this AIMMS project, i.e. it creates
- sets, parameters, variables, constraints, and a math program,
- a procedure that initializes the data, solves the model, and writes the data (including the solution) to a file.
The source of the external program "Model Edit API.exe" is displayed on the Source tab on the demo page and it is contained in the Source directory that comes with this example.
To run the external program:
- make sure that the Bin directory of your AIMMS installation directory is contained in the PATH environment variable on your computer. Make sure that there is no Bin folder of an older AIMMS version in the PATH environment, this will lead to incompatibility problems.
- run the program "Model Edit API.exe", or use the corresponding button on the demo page.
Afterwards, you can inspect the log file, data output file and model file, on the tabs on the Demo Page. In the log file, you can see all actions that the external program has executed. In case there are any errors (during execution), these will show up in the log file as well. You can also inspect the model by importing it into the model explorer. To do so, click on the Import Transport Model on the demo page.
- You can change the PATH environment variable by going to Control Panel, System... For Windows 2000, Windows XP and newer Windows versions: Advanced tab, Environment Variables, select 'Path', click on Edit, and add the path of the Bin directory (separated by ";"). For Windows NT: Environment tab, select 'Path', and add the path of the Bin directory (separated by ";").
- AIMMS projects started via the AIMMS API are in end-user mode. By default, warnings are not communicated to end-users. If you do want to check whether AIMMS has any warnings for you, you can set the option Communicate_warnings_to_end_users to 'On'.
Model Edit functions, AIMMS API, using AIMMS externally, C++, integrating AIMMS.
A zip file with this example can be downloaded here.