Running Locally in End-User mode

From WebUI 25.8 onwards, your WebUI apps can be run locally on end-users’ machines, in end-user mode, provided they have an end-user license. Functionally, the app will behave just as it would on the cloud, except for cloud-specific functionalities obviously. You will lose all the benefits that cloud publishing offers in terms of easy maintenance and deployment of your application, but in limited scenarios this way of publishing may fit your purposes just right.

Preparing your AIMMS Project

If you want to distribute your AIMMS project this way, you should be aware of a number of things in your AIMMS model.

There are two options in the AIMMS Settings -> Project Options menu that you need to consider:

  • Appearance in end-user mode: with this option you determine how the AIMMS session running your WebUI later should behave. You can choose between the options Normal, Minimized and Hidden. When choosing Normal, your end-user will still see the AIMMS IDE (albeit without being able to open the model tree). Minimized leads to AIMMS IDE being visible, but in a minimized window. Hidden leads to no AIMMS being visible at all. The latter option makes the most sense in this distribution scenario, as you will probably not want to ‘bother’ your end-users with the presence of AIMMS and just let them concentrate on the WebUI that they will use. In case any errors occur during startup, the end-user will still be presented with them.

  • Open webui on startup: this option should be set to ‘yes’. Doing so will make sure that whatever you choose for the previous option, the WebUI will always be started automatically for your end-user.

    Important

    When running AIMMS in Hidden mode, the AIMMS background process will automatically be terminated 5 minutes after the WebUI is closed. You are advised to think about how to deal with when to save changed data. Leaving MainTermination at its default implementation will prompt the user ‘suddenly’ after these 5 minutes, so it is better to let MainTermination just return 1 always and present the end-user either with explicit options (a button in the WebUI, for example) to save his work, or to save automatically without user intervention.

    Important

    In order to use this automatic termination feature, make sure you use AIMMS version 25.9 or higher.

Regarding the AIMMS code itself, you should be aware that calls to the ProjectDeveloperMode function in AIMMS still works, but it may not necessarily be enough for your situation. A good example of this is the following:

if ProjectDeveloperMode then
    SQL_ConnectionString := <string containing a reference to a local dsn file>
else
    SQL_ConnectionString := <string containing a reference to a datasource only present on the cloud>
endif;

When running the above locally in end-user mode, the function ProjectDeveloperMode will return 0 and, as a result, the SQL connection string will be initialized with a locally unusable datasource reference. In cases like this, you can use the following alternative:

if pro::GetPROEndpoint() then
    SQL_ConnectionString := <string containing a reference to a datasource only present on the cloud>
else
    SQL_ConnectionString := <string containing a reference to a local dsn file>
endif;

So, in order to determine programmatically if your code is running in developer mode, on PRO or in end-user mode locally, you should use the functions ProjectDeveloperMode and pro::GetPROEndPoint.

You should also think about what level of widget control, if any, you want your end-user to have in the WebUI itself. You can restrict this by specifying the WebUI settings UI Editable and Limited Option Editor from the Miscellaneous tab in the application menu in the WebUI.

Setting up and Exporting Your AIMMS Project

If you want your AIMMS project to be deployed as described above, you need to take the following steps to prepare your model for it:

  • You will need to create a ‘versioned’ AIMMS file. To do so, copy your original .aimms file and add a version number to the file name. For example: my-app.aimms -> my-app-1.0.aimms;

  • Open this versioned AIMMS file by double-clicking my-app-1.0.aimms;

  • Export your project as an end-user project by using File -> Export End User Project from the AIMMS menu. While doing so, make sure you exclude the my-app.aimms file from the file selection, and include the my-app-1.0.aimms from the file selection;

  • The step above will create a package file called my-app-1.0.aimmspack;

Running Your application

You should distribute this .aimmspack file to the end-users of your WebUI app. On their machines, they should open the my-app-1.0.aimmspack, which will extract it to a (new) folder of their choice. Inside that folder, they will find a my-app-1.0.aimms file, which they can double-click to open the WebUI app in end-user mode.