YANE-Framework 1.1.0
Public Member Functions | Public Attributes | Protected Attributes

yane::SqpFortran::SqpFortran Class Reference

Wrapper class for the SQP routine NLPQLP.

Inheritance diagram for yane::SqpFortran::SqpFortran:
[legend]
Collaboration diagram for yane::SqpFortran::SqpFortran:
[legend]

List of all members.

Public Member Functions

virtual double abortTime ()
 Function which returns the current abort time, after which the optimization would be stopped.
virtual void calcMin (double *x, double *fx, double *lb, double *ub, double *rpar=0, int *ipar=0)
 Function which solves the minimization problem.
virtual yane::MinProg::NLPclone ()
 Function to clone the object with the current configuration.
virtual void getLagrangeParameters (double *lambda)
 Function which returns the Lagrange parameters of the nonlinear contraints regarding to the calculated optimal solution.
virtual void getRestrictionJacobi (double *jac)
 Function which returns the Jacobian of the Restriction.
virtual void init (int n, yane::MinProg::T_FUNC func, yane::MinProg::T_FUNC rest=0, int nrest=0, int nrest_eq=0, yane::MinProg::T_FUNC df=0, yane::MinProg::T_FUNC dg=0)
 Function to initialize the minimization problem.
virtual yane::MinProg::T_MEMMODEL memoryModel () const
 Function to specify the memorymodel (by-line or by-column)
virtual void setAbortTime (double time)
 Function to set abort time, after which the optimization will be stopped.
virtual void setAccuracy (double acc)
 Function to set the accuracy of the optimization routine.
void setLineSearchTol (double tol=.1)
 Function to set the tolerance of the linesearch.
void setMaxFun (int num=20)
 Function to set the maximal number of function evaluations.
virtual void setMaxIterations (int num)
 Function to set the maximum number of iterations for the optimization routine.
void setMinimalStepsize (double step=1E-6)
 Function to set the minimal stepsize for a single step of the optimization routine.
void setNMLineSearchStack (int size=0)
 Function to set the maximal number of nonmonotone linesearch steps.
void setPrintLevel (int lvl=0)
 Function to set the desired output level of the routine.
void setQLAccuracy (double acc=DBL_EPSILON *10000.0)
 Function to set the accurracy of the QP-Solver.
 SqpFortran (int n, yane::MinProg::T_FUNC func, yane::MinProg::T_FUNC rest=0, int nrest=0, int nrest_eq=0, yane::MinProg::T_FUNC df=0, yane::MinProg::T_FUNC dg=0)
 Constructor.
 SqpFortran ()
 Default-Constructor.
virtual ~SqpFortran ()
 Destructor.

Public Attributes

T_FUNCTIONSTRUCT * func_params
 Structure containing the dynamic of the system.
T_RESTRICTIONSTRUCT * restr_params
 Structure containing the restrictions of the system.

Protected Attributes

double _aborttime
 Saves the maximal allowed runtime for the optimization.
double _accql
 The tolerance is needed for the QP solver to perform several tests, for example whether optimality conditions are satisfied or whether a number is considered as zero or not. If _accqö is less or equal to zero, then the machine precision is computed by NLPQLP and subsequently multiplied by 10000.
double _accuracy
 The user has to specify the desired final accuracy (e.g. 1.0D-7). The termination accuracy should not be smaller than the accuracy by which gradients are computed.
int * _active
 Logical array which shows a user the constraints, which NLPQLP considers to be active at the last computed iterate.
double * _c
 Pointer of the last computed approximation of the Hessian.
yane::Utils::RTClock_clock
 Internal clock (time measurement for aborttime)
double * _d
 Pointer to the diagonal elements of the LDL of the Quasi-Newton matrix of the constraints.
double * _df
 Pointer of the gradient of the cost function.
double * _dg
 Pointer of the Jacobian matrix.
int _dimension
 Dimension of the optimization variable.
int _dimension_rest
 Number of constriants.
int _dimension_resteq
 Number of equality constraints.
double _f
 Value of the cost function.
T_FUNC _function
 Function pointer of the objective function.
T_FUNC _function_diff
 Function pointer of the gradient of the objective function.
double _fvalue1
 Variable to store the objective function value.
double _fvalue2
 Auxilliary variable to store the objective function value.
double * _g
 Pointer of the constraints.
double * _gvalue1
 Array to store the constraint values.
double * _gvalue2
 Auxilliary array to store the constraint values.
int _ifail
 Parameter which shows the reason for terminating a solution process. Initially _ifail must be set to zero. On return _ifail could contain the following values:

  • _ifail =-2 : Compute gradient values w.r.t. the variables stored in first column of _x, and store them in _df and _dg. Only derivatives for active constraints _active[j] == true need to be computed. Then call NLPQLP again.
  • _ifail =-1 : Compute objective function and all constraint values subject the variables found in the first l columns of _x, and store them in _f and _g. Then call NLPQLP again.
  • _ifail = 0 : The optimality conditions are satisfied.
  • _ifail = 1 : The algorithm has been stopped after _maxit iterations.
  • _ifail = 2 : The algorithm computed an uphill search direction.
  • _ifail = 3 : Underflow occurred when determining a new approximation matrix for the Hessian of the Lagrangian.
  • _ifail = 4 : The line search could not be terminated successfully.
  • _ifail = 5 : Length of a working array is too short. More detailed error information is obtained with '_irpint>0'.
  • _ifail = 6 : There are false dimensions, for example M>MMAX, N>=NMAX, or MNN2<>M+N+N+2.
  • _ifail = 7 : The search direction is close to zero, but the current iterate is still infeasible.
  • _ifail = 8 : The starting point violates a lower or upper bound.
  • _ifail = 9 : Wrong input parameter, i.e., _mode, LDL decomposition in _d and _c (in case of _mode == 1), _iprint, _iout
  • _ifail = 10 : Internal inconsistency of the quadratic subproblem, division by zero.
  • _ifail > 100 : The solution of the quadratic programming subproblem has been terminated with an error message and _ifail is set to _ifql + 100, where _ifql denotes the index of an inconsistent constraint.

int _iout
 Parameter for the desired output unit.
int _iprint
 Specification of the desired output level.

  • _iprint = 0 : No output of the program.
  • _iprint = 1 : Only a final convergence analysis is given.
  • _iprint = 2 : One line of intermediate results is printed in each iteration.
  • _iprint = 3 : More detailed information is printed in each iteration step, e.g. variable, constraint and multiplier values.
  • _iprint = 4 : In addition to '_iprint=3', merit function and steplength values are displayed during the line search.
    NOTE: Constraint and multiplier values are not displayed if the number of constraints is larger than 10000.

int * _kwa
 Integer working array of length _lkwa.
int _l
 Number of parallel systems, i.e. function calls duringline search at predetermined iterates.
HINT: If less than 10 parallel function evaluations are available, it is recommended to apply the serial version by setting L=1.
int _lactive
 Length of the logical array _active.
int _lkwa
 Length of the integer working array _kwa.
int _lql
 If _lql is set to true, the quadratic programming subproblem is solved with a full positive definite quasi-Newton matrix. Otherwise, a Cholesky decomposition is performed and updated, so that the subproblem matrix contains only an upper triangular factor.
int _lwa
 Length of the real working array _lwa.
int _max_nm
 Stack size for storing merit function values at previous iterations for non-monotone line search (e.g. 10). In case of _max_nm = 0, monotone line search is performed. _max_nm should not be greater than 50.
int _maxfun
 The integer variable defines an upper bound for the number of function calls during the line search (e.g. 20). _maxfun is only needed in case of _l=1, and must not be greater than 50.
int _maxit
 Maximum number of outer iterations, where one iteration corresponds to one formulation and solution of the quadratic programming subproblem, or, alternatively, one evaluation of gradients (e.g. 100).
int _mmax
 Row dimension of the Jacobian matrix. _mmax must be at least one and greater or equal to the number of constraints.
int _mnn2
 Auxilliary variable.
int _mode
 Parameter for warm starts

  • _mode = 0: Normal execution (reverse communication!).
  • _mode = 1: The user wants to provide an initial guess for the multipliers in _u and for the Hessian of the Lagrangian function in _c. In case of lql == true, _d is ignored. Otherwise, the lower part of C has to contain the lower triangular factor of an LDL decomposition and _d the diagonal part.

int _nmax
 Row dimension of the Hessian. _nmax must be at least two and greater than the number of optimization variables.
T_FUNC _restrictions
 Function pointer of the constraints.
T_FUNC _restrictions_diff
 Function pointer of the Jacobian of the constraints.
double _stepmin
 Minimum steplength in case of L>1. Recommended is any value in the order of the accuracy by which functions are computed. The value is needed to compute a steplength reduction factor by pow(_stepmin, (1/_l-1)). If _stepmin <= 0, then _stepmin = _acc is used.
double _tol_nm
 Relative bound for increase of merit function value, if linesearch is not successful during the very first step. Must be non-negative (e.g. 0.1).
double * _u
 _u contains the multipliers with respect to the actual iterate stored in the first column of _x. The first locations contain the multipliers of the nonlinear constraints, the subsequent locations the multipliers of the lower bounds, and the final locations the multipliers of the upper bounds. At an optimal solution, all multipliers with respect to inequality constraints should be nonnegative.
double * _wa
 Real working array of length _lwa.
double * _x
 Array of the optimization variable.
double _xold
 Auxilliary variable to save one entry of the optimization variable.

Constructor & Destructor Documentation

yane::SqpFortran::SqpFortran::SqpFortran ( int  n,
yane::MinProg::T_FUNC  func,
yane::MinProg::T_FUNC  rest = 0,
int  nrest = 0,
int  nrest_eq = 0,
yane::MinProg::T_FUNC  df = 0,
yane::MinProg::T_FUNC  dg = 0 
)
Parameters:
nDimension of the optimization variable
funcObjective function
restConstraints
nrestNumber of constraints (both equality and inequality constraints)
nrest_eqnumber of equality constraints
These have to be listed first within the definition of the constraints
dfGradient of the objective function
dgJacobian matrix of the restriction function
Exceptions:
yane::Utils::MemoryExceptionIs thrown, if memory allocation has failed
yane::Utils::ExceptionIs thrown, if initialization of the class has failed

Member Function Documentation

LIB_EXPORT double yane::MinProg::NLP::abortTime ( ) [virtual, inherited]
Returns:
Abort time in seconds
LIB_EXPORT void yane::SqpFortran::SqpFortran::calcMin ( double *  x0,
double *  fx,
double *  lb,
double *  ub,
double *  rpar = 0,
int *  ipar = 0 
) [virtual]
Parameters:
xInitial guess of the optimization variable
Once the algorithm terminates successfully it contains the minimizer of the objective function
fxOptimal objective function value
lbLower bounds for the optimization variable
ubUpper bounds for the optimization variable
rparVector of real-valued parameters
iparVector of integer paramaters
Exceptions:
SolverWarningIs thrown, if optimization terminates with an noncritical error
SolverErrorIs thrown, if optimization terminates with a known critical error
yane::MinProg::MinProgExceptionIs thrown, if optimization terminates with an unknown error
yane::Utils::ExceptionIs thrown, if evaluations could not be done

Implements yane::MinProg::NLP.

LIB_EXPORT yane::MinProg::NLP * yane::SqpFortran::SqpFortran::clone ( ) [virtual]
Exceptions:
yane::Utils::MemoryExceptionIs thrown, if memory allocation of the clone fails
Returns:
Pointer to the cloned NLP object

Implements yane::MinProg::NLP.

LIB_EXPORT void yane::SqpFortran::SqpFortran::getLagrangeParameters ( double *  lambda) [virtual]
Parameters:
lambdaPointer to an array of length dimension_rest, contains the Lagrange parameters
Exceptions:
yane::Utils::MemoryExceptionIs thrown, if lambda is a zero-pointer

Implements yane::MinProg::NLP.

LIB_EXPORT void yane::SqpFortran::SqpFortran::getRestrictionJacobi ( double *  jac) [virtual]
Parameters:
jacPointer to an array of length dimension * dimension_rest
After termination of this function, jac contains the jacobian saved by-line or by-column
Exceptions:
yane::Utils::MemoryExceptionIs thrown, if jac is a zero-pointer
yane::Utils::ExceptionIs thrown, if calculation fails

Implements yane::MinProg::NLP.

virtual void yane::SqpFortran::SqpFortran::init ( int  n,
yane::MinProg::T_FUNC  func,
yane::MinProg::T_FUNC  rest = 0,
int  nrest = 0,
int  nrest_eq = 0,
yane::MinProg::T_FUNC  df = 0,
yane::MinProg::T_FUNC  dg = 0 
) [virtual]
Parameters:
nDimension of the optimizationvariable
funcObjective function
restConsrraints
nrestNumber of constraints (both equality and inequality constraints)
nrest_eqNumber of equality constraints
These have to be listed first within the definition of the constraints
dfGradient of the objective function
dgJacobian matrix of the constraints
Exceptions:
yane::Utils::MemoryExceptionIs thrown, if memory allocation fails
yane::Utils::ExceptionIs thrown, if initialization of the NLP object fails

Reimplemented from yane::MinProg::NLP.

LIB_EXPORT void yane::MinProg::NLP::setAbortTime ( double  time) [virtual, inherited]
Parameters:
timeAbort time in seconds

Reimplemented in yane::YaneIpopt::YaneIpopt.

LIB_EXPORT void yane::SqpFortran::SqpFortran::setAccuracy ( double  acc) [virtual]
Parameters:
accAccuracy of the minimization routine
Exceptions:
InitializingExceptionIs thrown, if acc <= 0.0

Implements yane::MinProg::NLP.

LIB_EXPORT void yane::SqpFortran::SqpFortran::setLineSearchTol ( double  tol = .1)
Parameters:
tolAbsolute tolerance value of the linesearch
LIB_EXPORT void yane::SqpFortran::SqpFortran::setMaxFun ( int  num = 20)
Parameters:
numMaximal number of function evaluations
Exceptions:
InitializingExceptionIs thrown, if num <= 0.0
LIB_EXPORT void yane::SqpFortran::SqpFortran::setMaxIterations ( int  num) [virtual]
Parameters:
numMaximal number of iterations
Exceptions:
InitializingExceptionIs thrown, if num <= 0

Implements yane::MinProg::NLP.

LIB_EXPORT void yane::SqpFortran::SqpFortran::setMinimalStepsize ( double  step = 1E-6)
Parameters:
stepMinimal stepsize of an optimization step
LIB_EXPORT void yane::SqpFortran::SqpFortran::setNMLineSearchStack ( int  size = 0)
Parameters:
sizeMaximal number of nonmonotone linesearch steps
LIB_EXPORT void yane::SqpFortran::SqpFortran::setPrintLevel ( int  lvl = 0)
Parameters:
lvlOutlevel (should lie between 0 and 4)
LIB_EXPORT void yane::SqpFortran::SqpFortran::setQLAccuracy ( double  acc = DBL_EPSILON * 10000.0)
Parameters:
accAccuracy of the QP solver
Exceptions:
InitializingExceptionIs thrown, if acc <= 0.0