Get Name of an AIMMS Case
This article was originally posted to the AIMMS Tech Blog.
This article explains how to get the name of the current case, or more generally, any case denoted by an element in the predefined set
AllCases. You can use the case-related AIMMS functions to achieve this.
In AIMMS you have the option to store the data for all or some identifiers in so-called AIMMS cases. Within the AIMMS language there is support for saving and loading cases.
As the predefined set
AllCases is a subset of
Integers, you can’t get the name of the current (or any other case) directly. You will have to use the string parameter
CaseFileURL provided in the AIMMS language to obtain the name of a case referenced by an element in the set
In the following code,
ep_Case denotes an element parameter in the set
1!CurrentCase is predefined by AIMMS and denotes current case 2ep_Case := CurrentCase ; 3if not CaseFileURL(ep_Case) then 4 raise error "Could not obtain case name corresponding to case " + ep_Case ; 5endif ;
If successful, the above call will store the name of the case referred to by the element parameter in the string parameter that is provided as the second argument.