How To Report Date in AMPL

60 views
Skip to first unread message

Abdulaziz Alghosh

unread,
Apr 28, 2017, 7:58:38 AM4/28/17
to AMPL Modeling Language
Hello Fellows ,

Did anyone of you tried to report the date using ampl ?

i am trying to access the real date to name my created files according to it but after writing the following :

print "foo" & substr(date(),1,8) ;

 ampl resulting the following error: "date is not defined"

thanks in advance
Abdul

Robert Fourer

unread,
Apr 29, 2017, 11:51:24 AM4/29/17
to am...@googlegroups.com
The print command that you give is correct:

ampl: print "foo" & substr(date(),1,8) ;
foo20170429
ampl:

To get more help, copy the entire session from your command window into an email, or post a screenshot of the command window. Also it will be helpful if you can report the output from the AMPL command "option version;".

Bob Fourer
am...@googlegroups.com

=======
Message has been deleted

Abdulaziz Alghosh

unread,
Apr 30, 2017, 4:26:03 AM4/30/17
to AMPL Modeling Language, 4...@ampl.com
Hello Bob,

thanks for your replay. Kindly check the attached.

BR
Abdul
Screenshot from 2017-04-30 10-21-20.png

Robert Fourer

unread,
Apr 30, 2017, 2:27:54 PM4/30/17
to am...@googlegroups.com
The message from the "option version" statement shows that you are using an old AMPL version dated 20111121 (that is, 2011 November 21). However the change log at http://ampl.com/netlib/ampl/changes shows that the "date" function was not added to AMPL until the version of 20160221. Thus to use the date function you will need to write to lice...@ampl.com for information on buying an upgrade, or else consult http://ampl.com/try-ampl/ to see other possibilities for using the current version of AMPL.

Abdulaziz Alghosh

unread,
May 2, 2017, 5:51:16 AM5/2/17
to AMPL Modeling Language, 4...@ampl.com
Hi Bob,

hope u r doing well. I posted before a while the next issue and i hope u have a time to advise about it.


i have two nested FOR loops which will result in 91 iterations. I will get a bunch of files every iteration so i am trying to drop and classify these files automatically into a folder per each iteration.

to create a folder, i am writing per iteration the following:

shell  ' mkdir /home/aabd/ampl.linux64/("LightRobust_Gamma_"& g &"_Fine_"& iter) ' ;

per iteration : g will pick out a value of {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}  and iter will do so from {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6}

shell command provides a temporary escape to the operating system so the concatenation operator & is not recognized for the shell at the OS and i am not able to create the folders neither changing the directory into them through:

cd '/home/aabd/ampl.linux64/LR/("LightRobust_Gamma_"& g &"_Fine_"& iter)' ;

i am thinking about writing a Bash file to create the folders but mostly i will have the problem with changing the directory by cd in ampl.


BR
Abdul
Reply all
Reply to author
Forward
0 new messages