You can use "option ampl_include ..." to specify the location for model and data files, but it will not affect output files; in particular there is no option for changing the path to be assumed for a printed file. There is a "cd" command however that changes the current directory, which does affect all file references, including output files.
You can always write the path to the output file explicitly, as in this example:
display ... >"C:\AMPL\models\results.out";
If you have a lot of commands like this then you can define a new option, say,
option outdir "C:\AMPL\models\results.out";
and then
display ... >$outdir;
Or if you have different files you can define
option outdir "C:\AMPL\models\";
and then
display ... >($outdir & "results.out");
and similarly for other output files in that same directory.
Bob Fourer
From: am...@googlegroups.com [mailto:am...@googlegroups.com]
On Behalf Of frankcw
Sent: Saturday, August 18, 2012 2:36 PM
To: am...@googlegroups.com
Subject: [AMPL 6077] Re: print path in AMPL
Dear AMPL friends,
I was wondering if anyone knows the answer. Basically, it is the relative path question. I have a run file with all the commands. I want to specify in the beginning the folder where my model and data are located. Then I want to print the result into a file in that folder. So many thanks,
Frank
On Monday, July 30, 2012 8:20:55 PM UTC-4, frankcw wrote:
Hello, I was wondering a simple question in ampl.
I change the path to be
option include_path '...'
but once I print the result to some file, it is not in the folder I specify above.
Anyone can help me on this?
Thanks a lot,
Frank