Publishing an AIMMS service

AIMMS 4.90 project download

This how-to is a Hello World type example illustrating how to create a service from an AIMMS procedure. It requires the following steps:

  1. Create procedure that implements a task

  2. Publish the application

Procedure implementing task

 1Procedure pr_runTask {
 2    Body: {
 3        block
 4            ! Initialize
 5            pr_initializeTaskData();
 6
 7            ! Read the request body.
 8            pr_readData( dex::api::RequestAttribute( 'request-data-path' ) );
 9
10            ! Actual solving of Operations Research problem at hand.
11            pr_actuallySolveEqualParallelMachineAsMIP();
12
13            ! Transform solution
14            pr_postProcessSolution();
15
16            ! write response body
17            pr_writeSolution( dex::api::RequestAttribute( 'response-data-path' ) );
18
19        onerror ep_err do
20
21            sp_taskStatus := errh::Message( ep_err );
22            errh::MarkAsHandled( ep_err );
23
24        endblock ;
25
26        ! the application-specific returncode that will be returned
27        ! via the task status of the job
28        return 1;
29    }
30    dex::ServiceName: equalParallelMachineTimeIndexedMIP;
31    ElementParameter ep_err {
32        Range: errh::PendingErrors;
33    }
34}

Some remarks about the highlighted lines:

  1. Line 30: By specifying this line, the service equalParallelMachineTimeIndexedMIP is linked to the procedure pr_runTask.

  2. Line 8: The request data is read from a file. The string dex::api::RequestAttribute( 'request-data-path' ) is the path to that file.

  3. Line 17: Similarly, the response is written to a file. The string dex::api::RequestAttribute( 'response-data-path' ) is the path to that file.

Deploying an application on AIMMS Cloud

For AIMMS Clouds with Tasks enabled, it suffices to publish the .aimmspack on that cloud.

Further reading