MAC OSX Default Directory?!?

1,867 views
Skip to first unread message

Jonathan Farland

unread,
Sep 20, 2011, 6:19:10 PM9/20/11
to AMPL Modeling Language
Hey,

I'm a grad student at UMass Amherst and I'm taking a course using
AMPL. I am having trouble getting my 'AMPL' terminal window to find
the .mod files that I am saving. I saved the whole zip file to my
desktop, and then created a folder right there in the unzipped folder
and named it 752 (which is the course number of my class). I was told
this would automatically be the default directory. So I have created a
few text documents in the AMPL language and saved them as .mod's in
the folder 752. However, whenever I run the terminal and prompt AMPL
to find the .mod's it always says "context: the file cannot be
found".

Thoughts?

Thanks.

Robert Fourer

unread,
Sep 21, 2011, 5:29:49 PM9/21/11
to am...@googlegroups.com, Jonathan Farland
Can you post the contents of your Mac terminal window from the point at
which you opened it to the point where you get the "file cannot be found"
message? That would provide some context that might suggest where the
problem lies, or at least how to troubleshoot it. The solution is likely to
be simple, as AMPL normally looks for .mod files in whatever directory
(folder) is current when "ampl" is invoked.

Bob Fourer
4...@ampl.com

Robert Fourer

unread,
Sep 24, 2011, 4:12:45 PM9/24/11
to am...@googlegroups.com
Is the name of your AMPL directory (the one that contains the file "ampl"
that you execute to run the AMPL program) as follows?

/Users/jfarland/Desktop/AMPL/ampl_macosx64/ampl

And is the name of your homework directory (the one that contains HW1.mod)
as follows?

/Users/jfarland/Desktop/AMPL/ampl_macosx64/ampl/752

Then before you do anything else, type the following in the terminal window:

cd /Users/jfarland/Desktop/AMPL/ampl_macosx64/ampl

Then type

./ampl

and you should get an "ampl:" prompt. Then try loading the model file with
the command

model 752/HW1.mod

(Note that case of HW and mod is significant.) If the answer to both the
above is not "yes" then some adjustments will be necessary. But the key
thing is that AMPL interprets filenames relative to the directory that was
current when the AMPL program was started. The "cd" command in this example
acts to change the current directory.

Bob Fourer
4...@ampl.com


> -----Original Message-----
From: AMPL Modeling Language [mailto:ampl+m...@googlegroups.com]
Sent: Saturday, September 24, 2011 2:27 PM
To: Undisclosed recipients:
Subject: ampl - Google Groups: Message Pending
[{ILPV07-dhbGILCoCeWIwAY4-RRAIxnSK0}]

Upon trying a few syntaxes (very new to this language), this is what I
am getting for a response. It's gotta be something with the default
directory...

Last login: Wed Sep 21 09:36:31 on console
/Users/jfarland/Desktop/AMPL/ampl_macosx64/ampl ; exit;
Jonathan-Farlands-MacBook:~ jfarland$ /Users/jfarland/Desktop/AMPL/
ampl_macosx64/ampl ; exit;
ampl: model HW1.mod

Can't find file "HW1.mod"
context: model >>> HW1.mod <<<
ampl: model /752/HW1.mod

Can't find file "/752/HW1.mod"
context: model >>> /752/HW1.mod <<<
ampl: model 752/HW1.mod

Can't find file "752/HW1.mod"
context: model >>> 752/HW1.mod <<<
ampl:

Thanks


> -----Original Message-----
> From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of
> Jonathan Farland
> Sent: Tuesday, September 20, 2011 5:19 PM
> To: AMPL Modeling Language
> Subject: [AMPL 5054] MAC OSX Default Directory?!?
>

Jonathan Farland

unread,
Sep 29, 2011, 6:37:14 PM9/29/11
to AMPL Modeling Language
Bob,

Thank you so much for your help! It appears that I have been able to
assign the correct directory. However, I am getting an error message
that says "Cannot find "minos"". I realize minos is probably just the
name of the algorithm used to solve such programs, so could it be an
issue with where ampl is looking again? For instance, see below....

ampl: cd /Users/jfarland/Desktop/AMPL/ampl_macosx64;
cd '/Users/jfarland/Desktop/AMPL/ampl_macosx64' ;
ampl: model 752/hw2p1code.mod;
ampl: solve;
Cannot find "minos"
ampl:


Thanks for your time,

Regards,

Jon

Robert Fourer

unread,
Sep 30, 2011, 9:35:34 AM9/30/11
to am...@googlegroups.com
AMPL looks for solvers -- as specified in "option solver <solvername>;" or
"minos" by default -- in your search path. If you're not familiar with
search paths then give the fully-qualified filename for the solver, as in:

option solver '/Users/jfarland/Desktop/AMPL/ampl_macosx64/minos';

Of course this assumes there is the executable file "minos" in
/Users/jfarland/Desktop/AMPL/ampl_macosx64; substitute a different directory
if appropriate. If you got AMPL through the free AMPL for Courses package
then minos and the other solver files should already be in the same
directory as the "ampl" file. (On the other hand purchased solvers need to
be downloaded individually.)

Bob Fourer
4...@ampl.com

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

Reply all
Reply to author
Forward
0 new messages