« Return to Thread: [AMPL 2552] backtick operator and list of built-in parameters

[AMPL 2553] Re: backtick operator and list of built-in parameters

by Robert Fourer-2 :: Rate this Message:

Reply to Author | View in Thread


There are builtin functions time and ctime:

   ampl: print time();
   1243702207
   ampl: print ctime();
   Sat May 30 11:50:10 2009
   ampl: print ctime(time());
   Sat May 30 11:50:19 2009

However if you define

   param stamp symbolic = ctime();

the value of stamp won't be updated automatically every time you refer to
it.  You have to do something to cause it to be updated, such as a reset
data:

   ampl: param stamp symbolic = ctime();
   ampl: print stamp;
   Sat May 30 11:52:34 2009
   ampl: print stamp;
   Sat May 30 11:52:34 2009
   ampl: print stamp;
   Sat May 30 11:52:34 2009
   ampl: reset data stamp;
   ampl: print stamp;
   Sat May 30 11:53:09 2009

There are lists of all the functions in the appendix to the AMPL book, but
there's no master list of builtin parameters.

Bob Fourer
4er@...


> -----Original Message-----
> From: ampl@... [mailto:ampl@...]
> On Behalf Of Guney Petek [guneyp@...]
> Sent: Friday, May 29, 2009 7:15 PM
> To: AMPL Modeling Language
> Subject: [AMPL 2552] backtick operator and list of built-in parameters
>
>
> Greetings,
>
> Is it possible to define a variable including the date and time .run
> file is run on? I'd like to name the output file using this stamp
> variable.
> for example: param stamp symbolic:=`shell "date"`; that is, something
> like the backtick operator that do a similar job in BASH...
>
> Secondly, is there a list of all built-in parameters and variables(?)?
>
> thanks //Guney
>



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: [AMPL 2552] backtick operator and list of built-in parameters