Compiling the solver "GJH" for AMPL?

146 views
Skip to first unread message

charles...@gmx.net

unread,
May 15, 2007, 9:41:06 AM5/15/07
to AMPL Modeling Language
Hello,

I'm looking for a way to get the solver GJH for ampl, so that I can
access and evaluate first and second derivatives of my nonlinear
problem.

I downloaded the AMPL solver files from "http://netlib.bell-labs.com/
netlib/ampl/" in a big tarball, and now I'm looking at all those
files... I found the files gjh.c in the subfolder "examples", and also
"README.gjh" which tells me what I can do with gjh in AMPL. So I guess
there already is everything I need in order to get the GJH solver that
I want.

Now, how do I actually create whatever file I need in order to use
GJH? I guess I have to compile something here so that in the end I
have an executable "GJH" that I can put into the same directory as my
AMPL executable, right?

I'm working on a 64 bit Linux openSUSE 10.2 system.

Vladimir

unread,
May 15, 2007, 10:28:11 AM5/15/07
to AMPL Modeling Language
In directory "examples" type "make gjh".
On my machine I first had to edit the makefile (the one in the same
directory) and change line 30 to
CFLAGS = -g -fPIC

and also line 45 to
L = -lm -ldl


Regards,
Vladimir


On May 15, 2:41 pm, "charles.mar...@gmx.net" <charles.mar...@gmx.net>
wrote:

charles...@gmx.net

unread,
May 15, 2007, 11:15:25 AM5/15/07
to AMPL Modeling Language
Hi Vladimir,

I tried that and got the following error messages:

cc -g -fPIC gjh.c -o gjh
gjh.c:33:21: error: getstub.h: Datei oder Verzeichnis nicht gefunden
gjh.c:37: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'dense_kw'
gjh.c:37: error: expected identifier or '(' before ',' token
gjh.c:40: error: expected ')' before '*' token
gjh.c:50: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'suftab'
gjh.c:66: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'keywds'
gjh.c:75: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'Oinfo'
gjh.c: In function 'main':
gjh.c:81: error: 'ASL' undeclared (first use in this function)
gjh.c:81: error: (Each undeclared identifier is reported only once
gjh.c:81: error: for each function it appears in.)
gjh.c:81: error: 'asl' undeclared (first use in this function)
gjh.c:82: error: 'FILE' undeclared (first use in this function)
gjh.c:82: error: 'f' undeclared (first use in this function)
gjh.c:83: error: 'SufDesc' undeclared (first use in this function)
gjh.c:83: error: 'ow' undeclared (first use in this function)
gjh.c:84: error: 'cgrad' undeclared (first use in this function)
gjh.c:84: error: 'cg' undeclared (first use in this function)
gjh.c:84: error: 'cgx' undeclared (first use in this function)
gjh.c:86: error: 'fint' undeclared (first use in this function)
gjh.c:86: error: 'hcs' undeclared (first use in this function)
gjh.c:86: error: 'hrow' undeclared (first use in this function)
gjh.c:86: error: 'i1' undeclared (first use in this function)
gjh.c:86: error: 'i2' undeclared (first use in this function)
gjh.c:86: error: 'nh' undeclared (first use in this function)
gjh.c:86: error: 'nn' undeclared (first use in this function)
gjh.c:88: error: 'real' undeclared (first use in this function)
gjh.c:88: error: 'g' undeclared (first use in this function)
gjh.c:88: error: 'g1' undeclared (first use in this function)
gjh.c:88: error: 't' undeclared (first use in this function)
gjh.c:88: error: 'x' undeclared (first use in this function)
gjh.c:88: error: 'w' undeclared (first use in this function)
gjh.c:88: error: 'w0' undeclared (first use in this function)
gjh.c:88: error: 'y' undeclared (first use in this function)
gjh.c:90: error: 'ASL_read_pfgh' undeclared (first use in this
function)
gjh.c:91: error: 'Oinfo' undeclared (first use in this function)
gjh.c:91: warning: assignment makes pointer from integer without a
cast
gjh.c:94: error: 'suftab' undeclared (first use in this function)
gjh.c:94: error: 'SufDecl' undeclared (first use in this function)
gjh.c:96: error: 'X0' undeclared (first use in this function)
gjh.c:96: error: 'n_var' undeclared (first use in this function)
gjh.c:97: error: 'want_xpi0' undeclared (first use in this function)
gjh.c:98: error: 'ASL_findgroups' undeclared (first use in this
function)
gjh.c:99: error: 'ASL_Sufkind_obj' undeclared (first use in this
function)
gjh.c:103: error: 'n_con' undeclared (first use in this function)
gjh.c:104: error: 'pi0' undeclared (first use in this function)
gjh.c:108: warning: incompatible implicit declaration of built-in
function 'strcpy'
gjh.c:108: error: 'stub_end' undeclared (first use in this function)
gjh.c:109: error: 'filename' undeclared (first use in this function)
gjh.c:110: warning: incompatible implicit declaration of built-in
function 'printf'
gjh.c:113: warning: incompatible implicit declaration of built-in
function 'strlen'
gjh.c:123: warning: incompatible implicit declaration of built-in
function 'fprintf'
gjh.c:144: error: 'nzc' undeclared (first use in this function)
gjh.c:146: error: expected expression before ')' token
gjh.c:151: warning: incompatible implicit declaration of built-in
function 'memset'
gjh.c:152: error: 'n_obj' undeclared (first use in this function)
gjh.c:176: error: 'Cgrad' undeclared (first use in this function)
gjh.c:200: error: 'sputinfo' undeclared (first use in this function)
gjh.c:222: warning: incompatible implicit declaration of built-in
function 'sprintf'
make: *** [gjh] Fehler 1


And I have no idea why this looks so bad...

Hans Mittelmann

unread,
May 15, 2007, 11:43:09 AM5/15/07
to AMPL Modeling Language
without Unix/Linux experience that may be hard to do. Obviously you
need to include certain AMPl header files either by having -I.. or
so in your compile options assuming the files are one level up or by
copying the ones you need into the examples directory.


On May 15, 8:15 am, "charles.mar...@gmx.net" <charles.mar...@gmx.net>
wrote:

Vladimir

unread,
May 15, 2007, 12:11:57 PM5/15/07
to AMPL Modeling Language
I see ... I think you have to do the following:

1. go one directory up (called "solvers")
2. rename "makefile.u" to "makefile"
3. type "make" (which should compile amplsolver.a)
4. go to directory "examples"
5. rename "makefile.u" to "makefile" (this should overwrite existing
makefile)
6. edit "makefile" as indicated in the previous post, i.e.
CFLAGS = -g -fPIC
L = -lm -ldl
7. type "make gjh"

Let me know how it goes.
Vladimir

On May 15, 4:15 pm, "charles.mar...@gmx.net" <charles.mar...@gmx.net>
wrote:

charles...@gmx.net

unread,
May 15, 2007, 12:34:51 PM5/15/07
to AMPL Modeling Language
Hi Vladimir, hi Hans,

I followed Vladimir's advice and got the response attached below.

Looking at the output I noticed that -among other things- it complains
about not finding "getstub.h", which is in the directory above, i.e.
in ampl/solvers. I tried to compile "gjh" in the directory ampl/
solvers/examples. Copying the file "getstub.h" into the examples
folder did not solve the problem, instead it complained about new
files that were also missing. I guess it might be looking in the wrong
directory...?

And, yes, I am a complete Linux newbie ...

# cd ampl/solvers
# rename makefile makefile.org
# rename makefile.u makefile
# make (a lot of unintelligible output appeared, and then there
was a new file "amplsolvers.a")
# cd examples/
# rename makefile makefile.org
# rename makefile.u makefile
# edit makefile (I did the changes that Vladimir described)
# make gjh

uz:/home/delix/num_package/GJH package/ampl/solvers/examples #

Hans Mittelmann

unread,
May 15, 2007, 7:40:35 PM5/15/07
to AMPL Modeling Language
In the examples directory execute the command:

cc -I.. -o gjh gjh.c ../amplsolver.a -lm -ldl


On May 15, 9:34 am, "charles.mar...@gmx.net" <charles.mar...@gmx.net>
wrote:

charles...@gmx.net

unread,
May 16, 2007, 3:24:37 AM5/16/07
to AMPL Modeling Language
Hi Hans,

Thanks for the advice! That command worked wundervoll. :-)

David

Hans Mittelmann

unread,
May 16, 2007, 3:22:35 PM5/16/07
to AMPL Modeling Language
you're very willkommen!

On May 16, 12:24 am, "charles.mar...@gmx.net" <charles.mar...@gmx.net>

Reply all
Reply to author
Forward
0 new messages