Using SQOPT7

This section serves as a reference guide to SQOPT. We recommend the user read the SQOPT7 User’s Manual for detailed information on using SQOPT.

Initializing/Finalizing

sqInit

subroutine sqInit
&   ( iPrint, iSumm, cw, lencw, iw, leniw, rw, lenrw )

integer
&     iPrint, iSumm, lencw, leniw, lenrw, iw(leniw)
character
&     cw(lencw)*8
double precision
&     rw(lenrw)

sqInit is the initialization routine for SQOPT. The user must define the Fortran file unit numbers iPrint and iSumm for the print and summary output files. To turn off output on either of these streams, set the unit number to 0. The user must open the files for writing and associate them with the assigned unit numbers.

On exit, the workspace arrays are initialized to undefined or default values.

sqInitF

subroutine sqInitF
&   ( printfile, summaryfile, iPrint, iSumm,
&     cw, lencw, iw, leniw, rw, lenrw )

character*(*)
&     printfile, summaryfile
integer
&     iPrint, iSumm, lencw, leniw, lenrw, iw(leniw)
character
&     cw(lencw)*8
double precision
&     rw(lenrw)

sqInitF is an alternative initialization routine for SQOPT. The user passes the filenames of the print and summary output files. To turn off output on either stream, set the filename to ''. To send the summary output to standard output, set summaryfile to screen.

On exit, the assigned Fortran file unit numbers iPrint and iSumm for the print and summary files are returned. The workspace arrays are also initialized to undefined or default values.

sqEndF

subroutine sqEndF
&   ( cw, lencw, iw, leniw, rw, lenrw )

integer
&     lencw, leniw, lenrw, iw(leniw)
character
&     cw(lencw)*8
double precision
&     rw(lenrw)

sqEndF should be called if the user uses sqInitF or sqSpecF. This routine closes any opened files.

Solving with SQOPT

subroutine sqOpt
&   ( Start, qpHx, m,
&     n, neA, nName, lencObj, ncolH,
&     iObj, ObjAdd, Prob,
&     Acol, indA, locA, bl, bu, cObj, Names,
&     eType, hs, x, pi, rc,
&     INFO, mincw, miniw, minrw,
&     nS, nInf, sInf, Obj,
&     cu, lencu, iu, leniu, ru, lenru,
&     cw, lencw, iw, leniw, rw, lenrw )

 external
&     qpHx
 integer
&     iObj, INFO, lencObj, lencu, leniu, lenru, lencw, leniw,
&     lenrw, m, mincw, miniw, minrw, n, neA, nName, ncolH, nS,
&     nInf, eType(n+m), hs(n+m), indA(neA), iu(leniu), iw(leniw),
&     locA(n+1)
 double precision
&     Obj, ObjAdd, sInf, Acol(neA), bl(n+m), bu(n+m), cObj(*),
&     pi(m), rc(n+m), x(n+m), ru(lenru), rw(lenrw)
 character*(*)
&     Start
 character
&     Prob*8, Names(nName)*8, cu(lencu)*8, cw(lencw)*8

The SQOPT interface accepts a format that allows the constraints and variables to be defined in any order. The optimization problem is assumed to be in the form

\[ \begin{align} \min_x \quad & q(x) = f + a_{iobj}^T x + c^T x + \frac{1}{2} x^T Hx \\ \text{subject to} \quad & Ax = b, \quad l \le x \le u \\ \end{align} \]

where the upper and lower bounds are constant, \(q(x)\) is the quadratic objective, \(a_{iobj}\) is the iObj-th row of the constraint matrix \(A\), \(H\) is the symmetric positive semidefinite Hessian matrix, \(c\) is a constant vector, and \(f\) is a constant defined by the Fortran variable ObjAdd. If iObj is set to zero, then no term from the constraint matrix is included in the objective.

The linear term(s) of the objective can be defined by a constant vector \(c\) via the cObj, with length ncObj, which can be less than or equal to n. Alternatively, if the linear term is sparse, it may be defined via a row of the constraint matrix \(A\). Set iObj to point to the row of \(A\). The lower and upper bounds on this row of \(A\) should also be set to minus/plus infinity.

The linear constraint matrix \(A\) should be defined in sparse column format with Acol holding the nonzero values of \(A\), locA holding the column pointers, and indA holding the row indices of the elements of \(A\).

Variables that show up in the quadratic term of the objective should be ordered first in the vector x. The integer nnH should be set to denote that x(1:nnH) are the only quadratic variables. This allows the user to define a Hessian matrix of size nnH rather than n, making computations more efficient if nnH is much smaller than n.

The Hessian matrix must be defined via the user-defined subroutine qpHx.

call qpHx
&   ( nnH, x, Hx, Status,
&     cu, lencu, iu, leniu, ru, lenru )

integer
&     nnH, leniu, lenru, Status, iu(leniu)
double precision
&     Hx(nnH), ru(lenru), x(n)
character
&     cu(lencu)*8

This subroutine is called by SQOPT. The user should compute the matrix-vector product of the Hessian and the given vector x. The integer Status denotes the status of the current call. If Status is 0, then there is nothing special about the current call. If Status is 1, then qpHx is being called for the first time. If Status is greater than or equal 2, then qpHx is being called for the last time.

Setting and Getting Options

sqSpec

subroutine sqSpec
&   ( iSpecs, INFO, cw, lencw, iw, leniw, rw, lenrw )
integer
&     iSpecs, INFO, lencw, leniw, lenrw, iw(leniw)
double precision
&     rw(lenrw)
character
&     cw(lencw)*8

sqSpec reads options from a file. iSpecs should be set by the user to the Fortran file unit number associated with the specifications file. The file should also be opened for reading. If options are successfully read, the routine returns an iExit value of 101 or 107. The workspace arrays will be appropriately updated with the options.

sqSpecF

subroutine sqSpecF
&   ( specsfile, INFO, cw, lencw, iw, leniw, rw, lenrw )
character*(*)
&     specsfile
integer
&     INFO, lencw, leniw, lenrw, iw(leniw)
double precision
&     rw(lenrw)
character
&     cw(lencw)*8

sqSpecF is an alternative routine for reading options from a file. specsfile should be set to the specifications filename. If options are successfully read, the routine returns an iExit value of 101 or 107. The workspace arrays will be appropriately updated with the options.

sqSet

subroutine sqSet
&   ( option, iPrint, iSumm, Errors,
&             cw, lencw, iw, leniw, rw, lenrw )

character*(*)
&     option
integer
&     Errors, iPrint, iSumm, lencw, leniw, lenrw, iw(leniw)
double precision
&     rw(lenrw)
character
&     cw(lencw)*8

sqSet is called to set an option. The input argument option should be a character string containing the keyword of the option to modify and the desired value (in character format).

sqSetI

subroutine sqSeti
&   ( option, ivalue, iPrint, iSumm, Errors,
&                     cw, lencw, iw, leniw, rw, lenrw )

character*(*)
&     option
integer
&     Errors, ivalue, iPrint, iSumm, lencw, leniw, lenrw, iw(leniw)
double precision
&     rw(lenrw)
character
&     cw(lencw)*8

sqSetI is called to set an integer-valued option. The input argument option should be a character string containing the keyword of the option to modify. ivalue is the desired integer value.

sqSetR

subroutine sqSetr
&   ( option, rvalue, iPrint, iSumm, Errors,
&                     cw, lencw, iw, leniw, rw, lenrw )

character*(*)
&     option
integer
&     Errors, iPrint, iSumm, lencw, leniw, lenrw, iw(leniw)
double precision
&     rvalue, rw(lenrw)
character
&     cw(lencw)*8

sqSetR is called to set an real-valued option. The input argument option should be a character string containing the keyword of the option to modify. rvalue is the desired real value.

sqGetC

subroutine sqGetc
&   ( option, cvalue, Errors, cw, lencw, iw, leniw, rw, lenrw )

character*(*)
&     option
integer
&     Errors, lencw, leniw, lenrw, iw(leniw)
character
&     cvalue*8, cw(lencw)*8
double precision
&     rw(lenrw)

sqGetC is called to retrieve an option value. The input argument option should be a character string containing the keyword of the option to modify. cvalue is a character string containing the value of the option in character format. Errors indicates the number of errors encountered while retrieving the option value.

sqGetI

subroutine sqGeti
&   ( option, ivalue, Errors, cw, lencw, iw, leniw, rw, lenrw )

character*(*)
&     option
integer
&     Errors, ivalue, lencw, leniw, lenrw, iw(leniw)
character
&     cw(lencw)*8
double precision
&     rw(lenrw)

sqGetI is called to retrieve an integer-valued option. The input argument option should be a character string containing the keyword of the option to modify. ivalue will contain the value of the option. Errors indicates the number of errors encountered while retrieving the option value.

sqGetR

subroutine sqGetr
&   ( option, rvalue, Errors, cw, lencw, iw, leniw, rw, lenrw )

character*(*)
&     option
integer
&     Errors, lencw, leniw, lenrw, iw(leniw)
character
&     cw(lencw)*8
double precision
&     rvalue, rw(lenrw)

sqGetR is called to retrieve a real-valued option. The input argument option should be a character string containing the keyword of the option to modify. rvalue will contain the value of the option. Errors indicates the number of errors encountered while retrieving the option value.