MINOPT

Special Note for SOL Library Users

MINOPT Home MINOPT Model Library MINOPT Solver Links MINOPT Purchasing MINOPT Software
MINOPT home MINOPT Model Library MINOPT Solver Links MINOPT Purchasing & Licensing MINOPT Software

Due to name conflicts among the software packages from the Systems Optimization Library (SOL) at Stanford University, linking these libraries together in the same program is not possible. The MINOS, NPSOL, and SNOPT packages all have subroutines that have the same name and when the program is linked, the linker give warning messages about duplicate symbols. Since these subroutines come from the same place, they do all have the same functionality and a subroutine from one of the libraries can be used with another library.

This describes the necessary actions that need to be taken if two or more of SOL packages must be linked into the same program. This can also be done if only one of the packages is being used, but it is not necessary.

The overall course of action is to identify the common subroutines, remove these from individual software libraries for MINOS, NPSOL, and SNOPT, and place these subroutines into a common library. A procedure will be described for doing this for each software package such that both the full version and the stripped down versions can be compiled. The full version corresponds to software as it was received from the vendor, and the stripped down version is the version that has the common subroutines removed.

A new library containing the common subroutines is created. When the program is to be compiled, the stripped down versions of the libraries and the common library are all linked and no name conflicts will arise.

Note that no changes to the source code need to be made nor should be made. All the changes deal with the location of subroutines (the files in which they are located) and the contents of libraries.

Note that if just one of the packages is needed, no changes need to be made and the full version of the library can be used. Problems only arise when using two or more of the SOL libraries.

Common Source Code

If two or more of the SOL packages are to be linked together with a program, modifications to the libraries need to be made to eliminate duplicate names. This is done by moving the common subroutines into separate files which are not included in the stripped down version of the library. These common subroutines are all included in the common library which is linked at compile time.

The common is categorized as follows:

A local version of the library of BLAS routines is usually included with the UNIX operating systems. Sometimes it may be part of the FORTRAN package for an operating system and only exist if this package is installed on the computer. If the library does not exist or if the user wants the source code, it can be obtained from NETLIB. The version of the BLAS library that is installed locally on a computer as part of the operating system is optimized for that computer and generally should be used. The remainder of this document assumes that a local verion of the BLAS library does exist and the BLAS routines will NOT be included as part of the common library.

The NAG routines are part of a NAG library which is not readily available or included as part of the operating system. They can be obtained from NAG NAG (Numerical Algorithms Group) for a cost. However, the NAG routines that are necessary for the SOL packages are included with the SOL solver library source. The rest of this document assumes that a local version of the NAG library does not exist and the NAG routines will be included as part of the common library.

Duplicate Symbols

Descriptions for how to modify each of the software packages is given below. The source files are listed, the files that have duplicate symbols with the other packages are listed, and the duplicate symbols are listed. Instructions are given for dissecting each of the source files with the common code.

NPSOL (4.06-2 1992)

As distributed, NPSOL has the following source files:

The last four are note required for making the library. The files that must be modified are f06subs.f, and opsubs.f.

The BLAS and NAG routines are both included in the file f06subs.f. These should be separated so that the NAG routines remain in f06subs.f, and the BLAS routines are in a new file called blassubs.f Thus, the file f06subs.f will contain the following routines:

*                         Level 0  F06  Scalar routines
*                         -------  ---- ---------------
*     f06aaz+         f06baf/drot3g+  f06bcf/dcsg+    f06blf/ddiv+
*     f06bmf/dnorm+
*
*                         Level 1  F06  Vector routines
*                         -------  ---  ---------------
*     f06dbf/iload    f06fbf/dload    dddiv           f06fcf/ddscl
*     f06dff/icopy    f06fjf/dssq+    f06fkf          f06flf/dcond
*     f06klf/idrank+  f06fqf          f06frf/dgrfg+
*
*                         Level 2  F06  Matrix routines
*                         -------  ---  ---------------
*     f06qff          f06qgf          f06qhf          f06qjf
*     f06qkf          f06qnf          f06qrf          f06qsf
*     f06qtf          f06qvf          f06qwf          f06qxf
*     f06qzf
*
    
The file blassubs.f will contain the following routines:
*                         Level 1  BLAS Vector routines
*                         -------  ---- ---------------
*     daxpy           dcopy           ddot            dnrm2
*     dscal           dswap           idamax          drot
*
*                         Level 2  BLAS Matrix-vector routines
*                         -------  ---  ----------------------
*     dgemv           dger            dsymv           dsyr
*     dtrmv           dtrsv
    

Next, the file opsubs.f needs to be split into two files opsubs.f and opfile.f. The file opsubs.f contains the following subroutines:

The file opfile.f contains the subroutine opfile.

After these adjustments have been made, the files that contain common subroutines are the following:

An appropriate makefile for the NPSOL library looks like this:

# NPSOL makefile
F77     = f77

.SUFFIXES: .o.f
.f.o:
	$(F77) -c $(FFLAGS) $<

NPSOL = chsubs.f  srsubs.f  npsolsubs.f f06subs.f blassubs.f \
        mcsubs.f  opsubs.f  opfile.f    cmsubs.f  qrsubs.f   lssolsubs.f

STRIP = chsubs.f            npsolsubs.f                      \
        mcsubs.f            opfile.f    cmsubs.f  qrsubs.f   lssolsubs.f

NPSOL_OBJS = $(NPSOL:.f=.o)
STRIP_OBJS = $(STRIP:.f=.o)

libnpsol.a: $(NPSOL_OBJS)
	ar ruv libnpsol.a $?
	ranlib libnpsol.a

libnpsol_strip.a: $(STRIP_OBJS)
	ar ruv libnpsol_strip.a $?
	ranlib libnpsol_strip.a
	  

This can be used to create both the full library, libnpsol.a and the stripped down library, libnpsol_strip.a.

MINOS (5.5 Mar 1996)

The minos distribution contains the following source files:

The last three are not required to create the library. The files that require modification are mi15blas.f, mi25bfac.f, mi30spec.f, and mi60srch.f.

Both the BLAS and the NAG routines are contained in the file mi15blas.f. In the new file layout, the BLAS subroutines remain in the file mi15blas.f, but the NAG subroutines are moved to the file mi17util.f. Thus mi15blas.f contains the following subroutines:

*     dasum    daxpy    dcopy    ddot     dnrm2    dscal    idamax
    
and the file mi17util.f contains the following subroutines:
*     dddiv    ddscl    dload    dnorm1
*     hcopy    hload    icopy    iload    iload1
    

The file mi25bfac.f contains the LU factorization subroutines. These are moved to the file mi27LU.f Now mi25bfac.f contains the following:

*     m2bfac   m2bmap   m2belm   m2newB   m2bsol   m2sing
    
The file mi27LU.f contains the subroutines:
*     lu1fac   lu1fad   lu1gau   lu1mar   lu1pen
*     lu1max   lu1or1   lu1or2   lu1or3   lu1or4
*     lu1pq1   lu1pq2   lu1pq3   lu1rec
*     lu1ful   lu1den
*     lu6chk   lu6sol   lu7add   lu7elm   lu7for   lu7zap   lu8rpc
    

The file mi30spec.f contains the options routines as well as the string parsing commands. The option routines remain in mi30spec.f and the parsing routines are moved to mi31op.f. Now mi30spec.f contains the following subroutines:

*     miopt    miopti   mioptr   m3char   m3dflt   m3key
*     m3file
    
The file mi31op.f contains the subroutines:
*     oplook   opnumb   opscan   optokn   opuppr
    
The file mi60srch.f contains various search subroutines. Two of these are common to all the libraries and moved to a file mi61srch.f. The file mi60srch.f contains the following subroutines:
*     m6dmmy   m6fcon   m6fobj   m6fun    m6fun1   m6grd    m6grd1
*     m6dobj   m6dcon   m6srch
    
The file mi61srch.f contains the two subroutines:
*     srchc  srchq
    

With the above changes made, the common source files are the following:

A makefile that will create both the full and stripped down versions of the libraries is the following:


# MINOS Makefile
F77	= f77

.SUFFIXES:	.o.f
.f.o:
	$(F77) -c $(FFLAGS) $<

MINOS = mi10unix.f mi15blas.f mi17util.f mi20amat.f mi25bfac.f mi27LU.f   \
        mi30spec.f mi31op.f   mi35inpt.f mi40bfil.f mi50lp.f   \
        mi60srch.f mi61srch.f mi65rmod.f mi70nobj.f mi80ncon.f 

STRIP = mi10unix.f                       mi20amat.f mi25bfac.f            \
        mi30spec.f            mi35inpt.f mi40bfil.f mi50lp.f   \
        mi60srch.f            mi65rmod.f mi70nobj.f mi80ncon.f 

MINOSOBJS = $(MINOS:.f=.o)
STRIPOBJS = $(STRIP:.f=.o)

libminos.a: $(MINOSOBJS)
	ar ruv libminos.a $?
	ranlib libminos.a

libminos_strip.a: $(STRIPOBJS)
	ar ruv libminos_strip.a $?
	ranlib libminos_strip.a
	  

SNOPT (5.0 1996)

The SNOPT distribution contains the following source files: The last 6 files are not needed to create the library. The two files that need to be modified are sn30spec.f and sn60srch.f.

The file sn30spec.f contains the option specification routines and option parsing routines. The specification routines remain in sn30spec.f and the parsing routines are moved to the file sn31op.f. The file sn30spec.f now contains the subroutines:

*     snprm    snprmi   snprmr   s3char   s3dflt   s3key
*     s3file
    
The file sn31op.f contains the subroutines:
*     oplook   opnumb   opscan   optokn   opuppr
    
The following functions/subroutines were placed in sn17utils.f:
*     s1init   s1time   s1timp
    
These were moved to the file sn10unix.f

The file sn60srch.f contains various search subroutines. Two of these are common to all the libraries and moved to a file sn61srch.f. The file sn60srch.f contains the following subroutines:

*     s6fd     s6dcon   s6dobj   s6init   s6srch
    
The file sn61srch.f contains the two subroutines:
*     srchc  srchq
    

With the above changes made, the common source files are the following:

A makefile that will create both the full and stripped down versions of the libraries is the following:

# SNOPT Makefile
F77	= f77

.SUFFIXES:	.o.f
.f.o:
	$(F77) -c $(FFLAGS) $<

SNOPT  = sn10unix.f sn12snzz.f sn15blas.f sn17util.f sn20amat.f\
         sn25bfac.f sn27LU.f   sn30spec.f sn31op.f   sn35inpt.f sn40bfil.f\
         sn50lp.f   sn55qp.f   sn60srch.f sn61srch.f sn65rmod.f sn70nobj.f\
         sn80ncon.f sn85Hess.f sn87sopt.f sn90lmqn.f sn95fmqn.f

STRIP  = sn10unix.f sn12snzz.f                       sn20amat.f\
         sn25bfac.f            sn30spec.f            sn35inpt.f sn40bfil.f\
         sn50lp.f   sn55qp.f   sn60srch.f            sn65rmod.f sn70nobj.f\
         sn80ncon.f sn85Hess.f sn87sopt.f sn90lmqn.f sn95fmqn.f

SNOPTOBJS = $(SNOPT:.f=.o)
STRIPOBJS = $(STRIP:.f=.o)

libsnopt.a: $(SNOPTOBJS)
	ar ruv libsnopt.a $?
	ranlib libsnopt.a

libsnopt_strip.a: $(STRIPOBJS)
	ar ruv libsnopt_strip.a $?
	ranlib libsnopt_strip.a
	  

SNOPT (5.3-2 May 21, 1998)

The SNOPT distribution contains the following source files: The last 6 files are not needed to create the library. The two files that need to be modified are sn30spec.f and sn60srch.f.

The file sn30spec.f contains the option specification routines and option parsing routines. The specification routines remain in sn30spec.f and the parsing routines are moved to the file sn31op.f. The file sn30spec.f now contains the subroutines:

*     s3dflt   s3key    s3file
    
The file sn31op.f contains the subroutines:
*     oplook   opnumb   opscan   optokn   opuppr
    

The file sn60srch.f contains various search subroutines. Two of these are common to all the libraries and moved to a file sn61srch.f. The file sn60srch.f contains the following subroutines:

*     s6fd     s6dcon   s6dobj   s6init   s6srch
    
The file sn61srch.f contains the two subroutines:
*     lsrchc  lsrchq
    

Now, I would expect the srchc and srchq routines from the other libraries to be update to the new lsrchc and lsrchq routines. Since they are different for now, we will include both of them. (This is a change from 5.0)

With the above changes made, the common source files are the following:

A makefile that will create both the full and stripped down versions of the libraries is the following:

# SNOPT Makefile
F77	= f77

.SUFFIXES:	.o.f
.f.o:
	$(F77) -c $(FFLAGS) $<

SNOPT  = sn10unix.f sn12snzz.f sn15blas.f sn17util.f sn20amat.f\
         sn25bfac.f sn27LU.f   sn30spec.f sn31op.f   sn35inpt.f sn40bfil.f\
         sn50lp.f   sn55qp.f   sn60srch.f sn61srch.f sn65rmod.f sn70nobj.f\
         sn80ncon.f sn85Hess.f sn87sopt.f sn90lmqn.f sn95fmqn.f

STRIP  = sn10unix.f sn12snzz.f                       sn20amat.f\
         sn25bfac.f            sn30spec.f            sn35inpt.f sn40bfil.f\
         sn50lp.f   sn55qp.f   sn60srch.f            sn65rmod.f sn70nobj.f\
         sn80ncon.f sn85Hess.f sn87sopt.f sn90lmqn.f sn95fmqn.f

SNOPTOBJS = $(SNOPT:.f=.o)
STRIPOBJS = $(STRIP:.f=.o)

libsnopt.a: $(SNOPTOBJS)
	ar ruv libsnopt.a $?
	ranlib libsnopt.a

libsnopt_strip.a: $(STRIPOBJS)
	ar ruv libsnopt_strip.a $?
	ranlib libsnopt_strip.a
	  

COMMON subroutines

With the new file layouts obtained through the above procedure, the following files contain the common subroutines:
NPSOLMINOSSNOPT
BLASblassubs.fmi15blas.fsn15blas.f
NAGf06subs.fmi17util.fsn17util.f
LU----mi27LU.fsn27LU.f
optionopsubs.fmi31op.fsn31op.f
searchsrsubs.fmi61srch.fsn61srch.f

The subroutines with the same name do perform the same tasks and are virtually identical.

A library is created which contains the necessary subroutines. The BLAS routines are not included in this library since they can be obtained from the BLAS library optimized for the specific machine. Any version of the LU, option, and search routines can be included. The NAG routines require a bit more work since each of the packages has its own set of these functions listed below:

NPSOL required NAG utils (f06subs.f):

*     f06aaz+         f06baf/drot3g+  f06bcf/dcsg+    f06blf/ddiv+
*     f06bmf/dnorm+
*     f06dbf/iload    f06fbf/dload    dddiv           f06fcf/ddscl
*     f06dff/icopy    f06fjf/dssq+    f06fkf          f06flf/dcond
*     f06klf/idrank+  f06fqf          f06frf/dgrfg+
*     f06qff          f06qgf          f06qhf          f06qjf
*     f06qkf          f06qnf          f06qrf          f06qsf
*     f06qtf          f06qvf          f06qwf          f06qxf
*     f06qzf
    
SNOPT required NAG utils (sn17util.f)
*     ddiv     dddiv    ddscl    dnrm1s   dload    icopy    iload
*     ddrand
    
MINOS required NAG utils (mi17util.f)
*     dddiv    ddscl    dload    dnorm1
*     hcopy    hload    icopy    iload    iload1
    
A source file containing the union of the the required NAG routine should be created.

All of the common subroutines should be compiled into a single library. To create this library I have merged all of the NAG utilities into a single file called all17utils.f and removed any duplicate subroutines. For the LU factorization, option, and search subroutines, I have used the files from the SNOPT library (sn27LU.f, sn31op.f, sn61srch.f). I have called this common library libstanford.a, and the Makefile for creating this library is the following:

# This is a makefile for compiling the library called libstanford.a
# It contains the subroutines common to the distributed code for
# MINOS, NPSOL, and SNOPT

# Compiler options for hppa 
#FFLAGS = +O3 +U77 +DA1.1
#FFLAGS = -g +U77

# Compiler options for rs6000
#FFLAGS = -O3

# Compiler flags for iris4d
FFLAGS = -O2

F77	= g77

.SUFFIXES:	.o.f
.f.o:
	$(F77) -c $(FFLAGS) $<

NPSRC = f06subs.f           opsubs.f srsubs.f
SNSRC = sn17util.f sn27LU.f sn31op.f sn61srch.f
MISRC = mi17util.f mi27LU.f mi31op.f mi61srch.f

STANFORDSRC = all17utils.f sn27LU.f sn31op.f sn61srch.f

STANFORDOBJ = $(STANFORDSRC:.f=.o)

libstanford.a: $(STANFORDOBJ)
	ar ruv libstanford.a $?
	ranlib libstanford.a

clean:
	/bin/rm -f *.o *~

realclean:
	/bin/rm -f *.o libstanford.a
	  

Linking all the Libraries

With the above modifications made, the following libraries can now be made:

and the BLAS library, libblas.a, is assumed to exist.

To compile a program and link in the correct libraries, the link line should look something like the following if all three packages are to be included:

% cc source.c -lminos_strip -lnpsol_strip -lsnopt_strip -lstanford -lblas

If only two packages are required, the following command could be used:

% cc source.c -lminos_strip -lsnopt_strip -lstanford -lblas

If only one of the packages is required, the following command could be used:

% cc source.c -lsnopt_strip -lstanford -lblas

Alternatively, since only one package is being used, the full version of the library could be used without needing the stanford and blas libraries:

% cc source.c -lsnopt
MINOPT
Last modified: Thu Jul 23 16:23:21 EDT 1998

Copyright © 1998 Princeton University
All Rights Reserved