Skip to main content
Solved

Save a case from AIMMS procedure


Forum|alt.badge.img
  • Explorer
  • 5 replies
Hi, is there a similar code that I can use if a project has set the option Data Management style to
Disk files and folders?

The below code was valid for projects using option Single Data Manager file. The code was available from https://techblog.aimms.com/2012/06/05/save-a-case-from-aimms-procedure/ (note this is blog is now not available)



************
!First try to find a case with the name indicated by CaseName. If AIMMS
!can find this, it will store a reference to this case in the element
!parameter CaseReference
if ( not CaseFind( CaseName, CaseReference ) ) then
!If no case with the name indicated by CaseName could be found, then
!we try to create a case with this name. After creating the case, AIMMS
!will store a reference in the CaseReference element parameter to the
!newly created case
if ( not CaseCreate( CaseName, CaseReference ) ) then
!If there was an error while creating the case, notify the developer
!by raising an error. If the raised error is not caught, AIMMS will
!display it in the error window.
raise error "Could not create case with name " + CaseName ;
endif;
endif;
!If we got here, it means either a case with the indicated case name could be
!found, or it was created. Now instruct AIMMS to set this case to be the
!current case
CaseSetCurrent( CaseReference );
!And then instruct AIMMS to save the case
CaseSave( 0 );

Best answer by mohansx

@Nick

You can use functions like CaseFileSave and CaseFileLoad for your purpose, these are documented in the function reference chapter.

https://download.aimms.com/aimms/download/manuals/AIMMS3FR_Case.pdf
View original

4 replies

Jess Es
Forum|alt.badge.img+6
  • Grand Master
  • 120 replies
  • June 25, 2019
Hi @Nick thanks for your post. I'm afraid I don't have the answer (but someone around here will!) -- I wanted to let you know that the Tech Blog articles are being moved over to how-to.aimms.com .

Forum|alt.badge.img
  • Author
  • Explorer
  • 5 replies
  • June 25, 2019
Hi Jess, thank you so much for your reply. i dont think i can find the original post on the how-to.aimms.com

that said, i think the question is where there are similar functions:
  1. CaseFind
  2. CaseCreate
  3. CaseSetCurrent
  4. CaseSave
for the option "Disk files and folders". The above four functions are only applicable to "Single Data Manager file" option.

the above procedure that i copy pasted from the Tech Blog is quite handy in that if one wants to run mutliple scenarios (in an iterative loop) then this procedure automatically creates and then saves the results from every iteration. But this is only available for "Single Data Manager file" option which i understand aimms is phasing out in favour of "Disk files and folders" data management option.

many thanks

mohansx
Forum|alt.badge.img+5
  • Former AIMMSian
  • 223 replies
  • Answer
  • July 2, 2019
@Nick

You can use functions like CaseFileSave and CaseFileLoad for your purpose, these are documented in the function reference chapter.

https://download.aimms.com/aimms/download/manuals/AIMMS3FR_Case.pdf

Jess Es
Forum|alt.badge.img+6
  • Grand Master
  • 120 replies
  • July 3, 2019