Nlp++
Public Member Functions
SqpWrapper Class Reference

This class provides an SQP-solver for nonlinear programming problems. More...

#include <SqpWrapper.h>

Inheritance diagram for SqpWrapper:
ScalarOptimizer OptimizerInterface

List of all members.

Public Member Functions

 SqpWrapper (void)
 Class Constructor.
virtual ~SqpWrapper (void)
 Class Destructor.
void Reset (void)
 Resets the optimizer so that another optimization problem can be solved.
int Put (const char *pcParam, const int *piValue)
 Sets an integer Parameter.
int Put (const char *pcParam, const double *pdValue)
 Sets a double Parameter.
int Put (const char *pcParam, const char *pcValue)
 Sets a character Parameter.
int Put (const char *pcParam, const bool *pbValue)
 Sets a bool Parameter.
int Put (const char *pcParam, const int iValue)
 Sets an integer Parameter.
int Put (const char *pcParam, const double dValue)
 Sets a double Parameter.
int Put (const char *pcParam, const char cValue)
 Sets a char Parameter.
int Put (const char *pcParam, const bool bValue)
 Sets a bool Parameter.
int Get (const char *pcParam, int *&piValue)
 Gets the value of an integer Parameter.
int Get (const char *pcParam, double *&pdValue)
 Gets the value of a double Parameter.
int Get (const char *pcParam, char *&pcValue)
 Gets the value of a character Parameter.
int Get (const char *pcParam, bool *&pbValue)
 Gets the value of a bool Parameter.
int Get (const char *pcParam, int &iValue)
 Gets the value of an integer Parameter.
int Get (const char *pcParam, double &dValue)
 Gets the value of a double Parameter.
int Get (const char *pcParam, char &cValue)
 Gets the value of a char Parameter.
int Get (const char *pcParam, bool &bValue)
 Gets the value of a bool Parameter.
int PutNumDv (const int iNumDv)
 Puts number of design variables.
int PutNumEqConstr (const int iNumEqConstr)
 Sets number of equality constraint functions.
int PutNumIneqConstr (const int iNumIneqConstr)
 Puts the number of inequality constraints.
int PutConstrVal (const int iConstrIdx, const double dConstrVal, const int iParSysIdx=0)
 Sets the value of a constraint function at a considered design variable vector.
int PutConstrValVec (const double *const pdConstrVal, const int iParSysIdx=0)
 Set constraint function values for a design variable vector provided by SQP.
int PutDerivConstr (const int iConstrIdx, const int iDesignVarIdx, const double dDerivVal)
 Set the value for a derivative of a considered constraint.
int PutGradConstr (const int iConstrIdx, const double *dGradConstr)
 Sets the value of the gradient of a considered constraint.
int GetDesignVar (const int iDesignVarIdx, double &dDesignVarVal, const int iParSysIdx=0) const
 Get one value of one design variable.
int GetDesignVarVec (const double *&dDesignVarVec, const int iParSysIdx=0) const
 Get the iParSysIdx'th design variable vector.
int GetDerivConstr (const int iConstrIdx, const int iDesignVarIdx, double &dDerivConstr) const
 Gets one derivative of one constraint function.
int Output (char *cFile, bool bFirstOutput) const
 Puts some data to file.
int StartOptimizer (void)
 Performs one iteration step.
int DefaultLoop (OptProblem *Prob)
 Starts an optimization loop.
int EvalFuncId (void) const
 Returns constant indicating that Functions have to be evaluated.
int EvalGradId (void) const
 Returns constant indicating that Gradients have to be evaluated.
int SolvedId (void) const
 Returns constant indicating that the problem is solved.

Detailed Description

This class provides an SQP-solver for nonlinear programming problems.

SqpWrapper is a C++ wrapper class for the fortran subroutine NLPQLP, which is a special implementation of a sequential quadratic programming (SQP) method.

Problem formulation:

\[ \begin{tabular}{r l l} Minimize & $F(x), $ & \\ s.t. & $G_j(x) = 0, $ & $j= 0,\dots,M_E-1$,\\ & $G_j(x)\geq 0 , $ & $j= M_E,\dots,M-1$,\\ & $XL \leq x \leq XU,$ & \\ & $x_i \in R, $ & $\forall i=0,\dots,N-1.$ \\ \end{tabular} \]

Numerical Method:

Proceeding from a quadratic approximation of the Lagrangian function and a linearization of constraints, a quadratic programming subproblem is formulated and solved. Depending on the number of nodes of the distributed system, objective and constraint functions can be evaluated simultaneously at predetermined test points along the search direction. The parallel line search is performed with respect to an augmented Lagrangian merit function. Moreover, a non-monotone line search is performed in error situations where the line search cannot be stopped within a given number of iterations. All theoretical convergence properties of the SQP algorithm remain satisfied. The Hessian approximation is updated by the modified BFGS-formula.

Special features:

Reference:

Usage without DefaultLoop():
(For usage with DefaultLoop() read documentation of class OptProblem)

  1. Generate an SqpWrapper object employing SqpWrapper()

    1. Put the number of design variables to the object:
    2. Put the number of available systems to the object:
    3. Put the values for other parameters you want to adjust:
    4. Put the number of inequality constraint functions to the object:
    5. Put the number of equality constraint functions to the object:
  2. Set boundary values and provide initial guess.

    1. Set upper and lower bounds using

    2. Provide an initial guess for the optimization vector by PutInitialGuess( const double * pdInitialGuess ),
      where pdInitialGuess must be a double array of length equal to the number of variables.

      or PutInitialGuess( const int iVariableIndex, const double dInitialGuess ),

      for iVariableIndex = 0,...,NumberOfVariables - 1.

      Before setting an initial guess, the number of design variables must be set.

    3. If you want to provide an initial guess for the Hessian of the Lagrangian and the Lagrange multipliers use Put( const char * pcParam , const double * pdValue ) to set the values. Use Put( const char * pcParam , const int * piValue ) to set parameter "Mode" = 1.
  3. Start Sqp-Routine: StartOptimizer()

  4. Check status of the object using GetStatus( int & iStatus) const

    • if iStatus equals SolvedId():
      The final accuracy has been achieved, the problem is solved.

    • if iStatus is > 0:
      An error occured during the solution process.

    • if iStatus equals EvalFuncId() :
      SqpWrapper needs new function values -> 6 b) New function values.
      After passing these values to the SqpWrapper object go to 4.

    • if iStatus equals EvalGradId():
      SqpWrapper needs new values for gradients -> 6 c) Providing new gradient values.
      After passing these values to the SqpWrapper object go to 4.

  5. Providing new function and gradient values:

    1. Useful methods:

      1. GetNumConstr( int & iNumConstr ) const
        Returns the number of constraints.

        GetNumDv( int & iNumDesignVar ) const
        Returns the number of design variables.

        Get( const char * pcParam, int & iNumParallelSys )
        Returns the number of parallel systems when pcParam = "NumParallelSys".

      2. GetDesignVarVec( const double * & pdPointer, const int i ) const
        Returns a pointer to the i'th design variable vector ( default: i=0 ).

        GetDesignVar( const int iVarIdx , double & pdPointer, const int iVectorIdx ) const
        Returns the value of the iVarIdx'th design variable of the iVectorIdx'th design variable vector.

    2. Providing new function values

      Function values for the objective as well as for constraints have to be calculated for all optimization vectors provided by SqpWrapper.
      Note: When the status is equal EvalFuncId() for the first time, the functions need to be evaluated only for the 0'th parallel system.
      For access to the design variable vectors see 6.a.ii. After calculating the values, these must be passed to the SqpWrapper object.

      PutConstrValVec( const double * const pdConstrVals, const int iParSysIdx ),

      for iParSysIdx=0,...,NumberOfParallelSystems - 1

      where pdConstrVals is pointing on an array containing the values of each constraint at the iParSysIdx'th design variable vector provided by SqpWrapper.

      PutObjVal( const double dObjVal, const int iObjFunIdx, const int iParSysIdx ),

      for iParSysIdx = 0,...,NumberOfParallelSystems - 1

      where iObjFunIdx = 0 and dObjVal defines the value of the objective function at the iParSysIdx'th design variable vector provided by Sqp.

      Alternatively you can employ

      PutConstrVal( const int iConstrIdx, const double dConstrValue, const int iParSysIdx ),

      for iParSysIdx = 0,...,NumberOfParallelSystems - 1
      and iConstrIdx = 0,...,NumberOfConstraints - 1

    3. Providing new gradient values

      Gradients must be calculated for the objective and the active constraints at the current design variable vector. Get( const char * pcParam, int * & piActPtr ) with pcParam = "ActConstr" sets piActPtr on an array of length equal to the number of constraints whose entries are 0 for an inactive constraint and 1 for an active constraint. Note: piActPtr must be NULL on input.

      For access to the design variable vector see 6.a.ii with iParSysIdx = 0.
      For the gradients of the constraints you can use
      PutDerivConstr( const int iConstrIdx, const int iVariableIdx, const double dDerivativeValue )
      for iVariableIdx = 0,...,NumberOfVariables - 1
      and iConstrIdx = 0,...,NumberOfConstraints - 1

      where dDerivativeValue is defined as the derivative of the iConstrIdx'th constraint with respect to the iVariableIdx'th variable.
      Alternatively, you can use
      PutGradConstr( const int iConstrIdx, const double * pdGradient ),
      for iConstrIdx = 0,...,NumberOfConstraints - 1

      where pdGradient is a pointer on the gradient of the iConstrIdx'th constraint.

      For the gradient of the objective you can use
      PutDerivObj( const int iVariableIdx, const double dDerivativeValue, const int iFunIdx ),

      with iFunIdx = 0
      for iVariableIdx = 0,...,NumberOfVariables - 1

      where dDerivativeValue is defined as the derivative of the objective with respect to the iVariableIdx'th variable at the current design variable vector,

      or PutGradObj( const double * pdGradient, const int iFunIdx),
      where iFunIdx = 0 and pdGradient is a pointer on the gradient of the objective at the current design variable vector.

  6. Output

Author:
inuTech GmbH

Constructor & Destructor Documentation

Class Constructor.

Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477
SqpWrapper::~SqpWrapper ( void  ) [virtual]

Class Destructor.

Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Member Function Documentation

int SqpWrapper::DefaultLoop ( OptProblem Prob) [virtual]

Starts an optimization loop.

The loop is only left when either the solution is computed or an error has occured. It requires the number of design variables and constraints to be properly set.

Parameters:
[in]ProbPointer on an OptProblem object defining FuncEval and GradEval.
Return values:
ERROR_OPTIMIZER_INVALID_FUNCTION_CALLFunction must not be called at this time.
ERROR_OPTIMIZER_ILLEGAL_DATAInput pointer equals NULL.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::EvalFuncId ( void  ) const [virtual]

Returns constant indicating that Functions have to be evaluated.

Return values:
SQP_WRAPPER__STATUS_FUN_EVAL= -1
Returns:
Constant indicating that Functions have to be evaluated.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::EvalGradId ( void  ) const [virtual]

Returns constant indicating that Gradients have to be evaluated.

Return values:
SQP_WRAPPER__STATUS_GRAD_EVAL= -2
Returns:
Constant indicating that Gradients have to be evaluated
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::Get ( const char *  pcParam,
int *&  piValue 
) [virtual]

Gets the value of an integer Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter. Not case sensitive.

Possible parameter names:

  • "NumParallelSys" Get number of parallel Systems.
    On input, piValue must be a pointer on an integer array of length 1.
  • "NumObjFuns" Get number of objective functions.
    On input, piValue must be a pointer on an integer array of length 1.
  • "MaxNumIter" Get maximum number of iterations for the optimizer.
    On input, piValue must be a pointer on an integer array of length 1.
  • "MaxNumIterLS" Get maximum number of function calls during line search.
    On input, piValue must be a pointer on an integer array of length 1.
  • "NumIterLS" Get number of function calls during last line search.
    On input, piValue must be a pointer on an integer array of length 1.
  • "OutputLevel" Get desired output level.
    On input, piValue must be a pointer on an integer array of length 1.
  • "FortranOutputLevel" If >0, the output of the fortran code is written to an additional output file.
    On input, piValue must be a pointer on an integer array of length 1.
  • "OutputUnit" Get output unit.
    On input, piValue must be a pointer on an integer array of length 1.
  • "OutUnit" Same as "OutputUnit"
  • "NumIter" Get the number of iterations already performed.
    On input, piValue must be a pointer on an integer array of length 1.
  • "ActConstr" Get an active-inactive vector. piValue is the Address of a vector whose entries are 0 for an inactive constraint, 1 for an active constraint.
    On input, piValue must be == NULL.
  • "StackSizeLS" Stack size for storing merit function values at previous iterations for non-monotone line search (e.g. 10). In case of m_iStackSize == 0, monotone line search is performed.
Parameters:
[out]piValueValue of the parameter.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAIllegal input data.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::Get ( const char *  pcParam,
double *&  pdValue 
) [virtual]

Gets the value of a double Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter. Not case sensitive.

Possible parameter names:

  • "TermAcc" Get final accuracy.
    On input, pdValue must be a pointer on a double array of length 1.
  • "AccQP" Get accuracy of the QP solver.
    On input, pdValue must be a pointer on a double array of length 1.
  • "MinStepLength" Get minimum steplength.
    On input, pdValue must be a pointer on a double array of length 1.
  • "RestartParameter" Get the restart parameter (See int Put( const char*, const double*) for details).
    On input, pdValue must be a pointer on a double array of length 1.
  • "HessLagr" Get an array containing columnwise the Hessian of the Lagrangian at the current iterate as full matrix.
    Only if LQL = true.
    On input, pdValue must be == NULL.
    Note: The matrix has one additional column and one additional row which can both be ignored.
  • "LoTriLdlHessLagr" Get an array containing columnwise the lower triangular matrix $L$ of the $LDL^T$ decomposition of the Hessian of the Lagrangian at the current iterate. (Without the diagonal elements, which are 1). Only if LQL = false.
    On input, pdValue must be == NULL.
    Note: The matrix has one additional column and one additional row which can both be ignored.
  • "DiagLdlHessLagr" Get the diagonal matrix $D$ of the $LDL^T$ decomposition of the Hessian of the Lagrangian at the current iterate. Only if LQL = false.
    On input, pdValue must be == NULL.
  • "LagrMultiplier" Get the array of Lagrangian multipliers. The first M locations contain the multipliers of the M nonlinear constraints, the subsequent N locations the multipliers of the lower bounds, and the final N locations the multipliers of the upper bounds. At an optimal solution, all multipliers with respect to inequality constraints should be nonnegative. During optimization, the multipliers for the current iterate are returned. After optimization, the multipliers for the best iterate are returned. On input, pdValue must be == NULL.
  • "LagrMultiplierConstr" As "LagrMultiplier" but returning only the multipliers for the constraints.
  • "LagrMultiplierEqConstr" As "LagrMultiplier" but returning only the multipliers for the equality constraints.
  • "LagrMultiplierIneqConstr" As "LagrMultiplier" but returning only the multipliers for the inequality constraints.
  • "LagrMultiplierBounds" As "LagrMultiplier" but returning only the multipliers for the bounds.
  • "LagrMultiplierLowerBounds" As "LagrMultiplier" but returning only the multipliers for the lower bounds.
  • "LagrMultiplierUpperBounds" As "LagrMultiplier" but returning only the multipliers for the upper bounds.
Parameters:
[out]pdValueValue of the parameter.
Return values:
ERROR_OPTIMIZER_HESS_LAGR_NO_LDLThe Hessian of the Lagrangian is stored as full matrix.
ERROR_OPTIMIZER_HESS_LAGR_LDLThe Hessian of the Lagrangian is stored as $LDL^T$ decomposition.
ERROR_OPTIMIZER_ILLEGAL_DATAIllegal input data.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::Get ( const char *  pcParam,
char *&  pcValue 
) [virtual]

Gets the value of a character Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter. Not case sensitive.
[out]pcValueValue of the parameter.

Possible parameter names:

  • "OutputFileName" Get the name of the output file.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAIllegal input data.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::Get ( const char *  pcParam,
bool *&  pbValue 
) [virtual]

Gets the value of a bool Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter. Not case sensitive.

Possible parameter names:

  • "LQL" If m_bLQL 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.
  • "OpenNewOutputFile" Determines whether a new output file has to be opened. If false, the output is appended to an existing file. Usually, this parameter does not have to be changed. On input, pbValue must be a pointer on a bool-array of length one, resp. the address of a bool variable.
  • "OpenCloseOutputFile" The same as OpenNewOutputFile but with an obsolete parameter name.
Parameters:
[out]pbValueValue of the parameter.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAIllegal input data.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::Get ( const char *  pcParam,
int &  iValue 
) [virtual]

Gets the value of an integer Parameter.

This reimplementation is necessary because overloading and overriding at the same time may cause hidden functions.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter. Not case sensitive.
[out]iValueValue of the parameter.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAIllegal input data.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::Get ( const char *  pcParam,
double &  dValue 
) [virtual]

Gets the value of a double Parameter.

This reimplementation is necessary because overloading and overriding at the same time may cause hidden functions.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter. Not case sensitive.
[out]dValueValue of the parameter.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAIllegal input data.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::Get ( const char *  pcParam,
char &  cValue 
) [virtual]

Gets the value of a char Parameter.

This reimplementation is necessary because overloading and overriding at the same time may cause hidden functions.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter. Not case sensitive.
[out]cValueValue of the parameter.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAIllegal input data.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::Get ( const char *  pcParam,
bool &  bValue 
) [virtual]

Gets the value of a bool Parameter.

This reimplementation is necessary because overloading and overriding at the same time may cause hidden functions.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter. Not case sensitive.
[out]bValueValue of the parameter.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAIllegal input data.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::GetDerivConstr ( const int  iConstrIdx,
const int  iDesignVarIdx,
double &  dDerivConstr 
) const [virtual]

Gets one derivative of one constraint function.

Gets the derivative of an active constraint function with respect to the "iDesignVarIdx'th" design variable vector.

Parameters:
[in]iConstrIdxIndex of the considered constraint function.
[in]iDesignVarIdxThe derivative, asked for, is with respect to this design variable.
[out]dDerivConstrValue of the derivative asked for. If constraint is not active the function will return EXIT_FAILURE.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAAn index is out of bounds
ERROR_OPTIMIZER_CONSTRAINT_NOT_ACTIVEThe constraint function is not active. In this case, the value may be incorrect because the correct value may not have been put to the optimizer. It is the responsibility of the user to either ignore the value or make sure it is correct.
ERROR_OPTIMIZER_ARRAY_NOT_ALLOCATEDAn array is not allocated.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::GetDesignVar ( const int  iDesignVarIdx,
double &  dDesignVarVal,
const int  iParSysIdx = 0 
) const [virtual]

Get one value of one design variable.

Gets the value of the design variable with index "iDesignVarIdx" within the design variable vector with index "iParSysIdx".

Parameters:
[in]iParSysIdxIndex of the considered design variable vector.
[in]iDesignVarIdxIndex of the design variable.
[out]dDesignVarValValue of the considered design variable within the considered design variable vector.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAAn index is out of bounds.
ERROR_OPTIMIZER_ARRAY_NOT_ALLOCATEDThe design variabe array is not allocated. Probably the number of design variables was not set.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::GetDesignVarVec ( const double *&  dDesignVarVec,
const int  iParSysIdx = 0 
) const [virtual]

Get the iParSysIdx'th design variable vector.

Parameters:
[in]iParSysIdxIndex of the design variable vector.
[out]dDesignVarVecPointer to the iParSysIdx'th design variable vector.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAThe index of the parallel system does not exist.
ERROR_OPTIMIZER_ARRAY_NOT_ALLOCATEDThe design variable array is not allocated. Probably the number of design variables was not set.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::Output ( char *  cFile,
bool  bFirstOutput 
) const

Puts some data to file.

The information is the current step, the value of the objective function and the value of the Lagrangian.

Parameters:
[in]cFileName of output file
[in]bFirstOutputDetermines if this is the first output
Return values:
ERROR_OPTIMIZER_FILE_OUTPUTOutput problem
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477
int SqpWrapper::Put ( const char *  pcParam,
const int *  piValue 
) [virtual]

Sets an integer Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter to be set. Not case sensitive.

Possible parameter names:

  • "NumParallelSys" Put number of parallel systems.
    Redefining the value for the number of parallel systems is only allowed when optimization has not yet been started.
  • "MaxNumIter" Put maximum number of iterations for the optimizer. One iteration corresponds to one formulation and solution of the quadratic programming subproblem, or, alternatively, one evaluation of gradients (e.g. 100).
  • "MaxNumIterLS" Put maximum number of function calls during line search.
    This value is only needed when there is only one parallel system. In case of more parallel systems the value is ignored.
  • "OutputLevel" Put desired output level.
  • "FortranOutputLevel" If > 0, the output of the fortran code is written to an additional output file. This output might give more detailed information about errors.
    0: no additional output (default)
    1: only final convergence analysis
    2: one line of intermediate results is printed in each iteration.
    3: more detailed information is printed in each iteration step, e.g. variable, constraint and multiplier values.
    4: In addition to 3, merit function and steplength values are displayed during the line search.
    NOTE: Constraint and multiplier values are not displayed if there are more than 1000 constraints.
  • "OutputUnit" Put output unit for the Fortran output.
  • "OutUnit" Same as "OutputUnit"
  • "StackSizeLS" Stack size for storing merit function values at previous iterations for non-monotone line search (e.g. 10). In case of StackSizeLS == 0, monotone line search is performed. StackSizeLS should not be greater than 50.
  • "Mode" Parameter for warm starts:
    Mode = 0 : Normal execution.
    Mode = 1 : The user wants to provide an initial guess for the multipliers in LagrMultiplier and for the Hessian of the Lagrangian function in HessLagr or in LoTriLdlHessLagr and DiagLdlHessLagr.
    Mode = 2 : Initial scaling (Oren-Luenberger) after first step.
    Mode = 3 : Scaled restart if scaling parameter less than sqrt(TermAcc). Mode > 3 : Repeated scaled restart after "Mode" steps.
Parameters:
[in]piValuePointer to an array containing desired value(s) of the parameter.
Return values:
ERROR_OPTIMIZER_INVALID_FUNCTION_CALLInvalid function call.
ERROR_OPTIMIZER_ILLEGAL_DATAInput pointer equals NULL or the value is not allowed.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::Put ( const char *  pcParam,
const double *  pdValue 
) [virtual]

Sets a double Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter to be set. Not case sensitive.

Possible parameter names:

  • "TermAcc" Put desired final accuracy. The termination accuracy should not be smaller than the accuracy by which gradients are computed.
  • "AccQP" Put desired accuracy for QP solver. The value 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 AccQP is less or equal to zero, then the machine precision is computed and subsequently multiplied by 1.0E+4.
  • "MinStepLength" Put Minimum steplength in case of NumParallelSys>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 MinStepLength^(1/NumParallelSys-1).
    If MinStepLength <= 0, then MinStepLength = TermAcc is used.
  • "RestartParam" Parameter for initializing a restart in case of an uphill search direction by setting the BFGS-update matrix to RestartParam*I, where I denotes the identity matrix. The number of restarts is bounded by MaxNumIterLS. No restart is performed if RestartParam is less than 1. Must be greater than 0 (e.g. 1000).
  • "HessLagr" Put the Hessian of the Lagrangian as full matrix. Only if LQL = true.
    Note: The matrix must have one additional column and one additional row and must be stored columnwise.
  • "LoTriLdlHessLagr" Put the lower triangular matrix $L$ of the $LDL^T$ decomposition of the Hessian of the Lagrangian at the initial iterate. (Without the diagonal elements, which are 1). Only if LQL = false.
    Note: The matrix must have one additional column and one additional row and must be stored columnwise.
  • "DiagLdlHessLagr" Put the diagonal matrix $D$ of the $LDL^T$ decomposition of the Hessian of the Lagrangian at the initial iterate. Only if LQL = false.
  • "LagrMultiplier" Put array of multipliers with respect to the initial iterate. The first M locations must contain the multipliers of the M nonlinear constraints, the subsequent N locations the multipliers of the lower bounds, and the final N locations the multipliers of the upper bounds. At an optimal solution, all multipliers with respect to inequality constraints should be nonnegative.
Parameters:
[in]pdValuePointer to an array containing desired value(s) of the parameter.
Return values:
ERROR_OPTIMIZER_INVALID_FUNCTION_CALLThe parameter cannot be set at this point in the program
ERROR_OPTIMIZER_HESS_LAGR_NO_LDLThe Hessian of the Lagrangian is stored as full matrix.
ERROR_OPTIMIZER_HESS_LAGR_LDLThe Hessian of the Lagrangian is stored as $LDL^T$ decomposition.
ERROR_OPTIMIZER_ILLEGAL_DATAInput pointer equals NULL, the value is not allowed or the parameter was not found.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::Put ( const char *  pcParam,
const char *  pcValue 
) [virtual]

Sets a character Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter to be set. Not case sensitive.
[in]pcValuePointer to an array containing desired value(s) of the parameter.

Possible parameter names:

  • "OutputFileName" Put the name of the output file.
Return values:
ERROR_OPTIMIZER_INSUFFICIENT_MEMORYInsufficient memory.
ERROR_OPTIMIZER_ILLEGAL_DATAInput pointer equals NULL,the value is not allowed or the parameter was not found.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::Put ( const char *  pcParam,
const bool *  pbValue 
) [virtual]

Sets a bool Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter to be set. Not case sensitive.
[in]pbValuePointer to an array containing desired value(s) of the parameter.

Possible parameter names:

  • "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.
  • "OpenNewOutputFile" Determines whether a new output file has to be opened. If false, the output is appended to an existing file. Usually, this parameter does not have to be changed.
  • "OpenCloseOutputFile" The same as "OpenNewOutputFile" but with an obsolete parameter name.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAInput pointer equals NULL,the value is not allowed or the parameter was not found.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::Put ( const char *  pcParam,
const int  iValue 
) [virtual]

Sets an integer Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter to be set. Not case sensitive.
[in]iValueDesired value of the parameter.
Return values:
EXIT_FAILUREAn error occured.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::Put ( const char *  pcParam,
const double  dValue 
) [virtual]

Sets a double Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter to be set. Not case sensitive.
[in]dValueDesired value of the parameter.
Return values:
EXIT_FAILUREAn error occured.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::Put ( const char *  pcParam,
const char  cValue 
) [virtual]

Sets a char Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter to be set. Not case sensitive.
[in]cValueDesired value of the parameter.
Return values:
EXIT_FAILUREAn error occured.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::Put ( const char *  pcParam,
const bool  bValue 
) [virtual]

Sets a bool Parameter.

Parameters:
[in]pcParamPointer on a char-array containing the name of the parameter to be set. Not case sensitive.
[in]bValueDesired value of the parameter.
Return values:
EXIT_FAILUREAn error occured.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::PutConstrVal ( const int  iConstrIdx,
const double  dConstrVal,
const int  iParSysIdx = 0 
) [virtual]

Sets the value of a constraint function at a considered design variable vector.

Parameters:
[in]iConstrIdxIndex of the considered constraint function.
[in]iParSysIdxIndex of the considered design variable vector.
[in]dConstrValValue of the constraint function at the considered design variable vector.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAAn index is out of bounds.
ERROR_OPTIMIZER_ARRAY_NOT_ALLOCATEDThe array for the function values is not allocated. Probably the number of constraints was not set.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::PutConstrValVec ( const double *const  dConstrValsVec,
const int  iParSysIdx = 0 
) [virtual]

Set constraint function values for a design variable vector provided by SQP.

Parameters:
[in]iParSysIdxIndex of the considered design variable vector.
[in]dConstrValsVecPointer to an array, whose length equals the total number of constraint functions. The array contains the values for all constraint functions at the considered design variable vector.
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAAn index is out of bounds or the input. pointer is equal NULL.
ERROR_OPTIMIZER_ARRAY_NOT_ALLOCATEDThe array for the function values is not allocated. Probably the number of constraints was not set.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::PutDerivConstr ( const int  iConstrIdx,
const int  iDesignVarIdx,
const double  dDerivVal 
) [virtual]

Set the value for a derivative of a considered constraint.

Parameters:
[in]iConstrIdxIndex of the considered constraint
[in]iDesignVarIdxIndex of a design variable
[in]dDerivValValue of the derivative of the iConstrIdx'th constraint function with resp. to the iDesignVarIdx'th design variable at the current solution vector ( design variable vector with index 0 )
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAAn index is out of bounds.
ERROR_OPTIMIZER_ARRAY_NOT_ALLOCATEDThe array for the gradient values is not allocated. Probably the number of constraints and the number of variables were not set.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::PutGradConstr ( const int  iConstrIdx,
const double *  dGradConstr 
) [virtual]

Sets the value of the gradient of a considered constraint.

Parameters:
[in]iConstrIdxIndex of the considered constraint
[in]dGradConstrPointer to a double array, whose length must equal the number of design variables. The array must contain the values of the gradient of the considered constraint function at the current solution vector ( design variable vector with index 0 )
Return values:
ERROR_OPTIMIZER_ILLEGAL_DATAThe constraint index is out of bounds or the input pointer equals NULL.
ERROR_OPTIMIZER_ARRAY_NOT_ALLOCATEDThe array for the gradient values is not allocated. Probably the number of constraints and the number of variables were not set.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::PutNumDv ( const int  iNumDesignVar) [virtual]

Puts number of design variables.

Setting the number of design variables. Allocating the memory for upper and lower bounds as well as for the initial guess and the gradients of constraint values and objective function.

Parameters:
[in]iNumDesignVarNumber of design variables.
Return values:
ERROR_OPTIMIZER_INVALID_FUNCTION_CALLFunction must not be called at this time.
ERROR_OPTIMIZER_ILLEGAL_DATAiNumDesignVar is negative.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::PutNumEqConstr ( const int  iNumEquConstr) [virtual]

Sets number of equality constraint functions.

Setting the number of equality constraint functions. (Re)allocating the memory for the values and gradients of the constraints.

Parameters:
[in]iNumEquConstrNumber of equality constraints.
Return values:
ERROR_OPTIMIZER_INVALID_FUNCTION_CALLFunction must not be called at this time.
ERROR_OPTIMIZER_ILLEGAL_DATAiNumEquConstr is negative.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::PutNumIneqConstr ( const int  iNumIneqConstr) [virtual]

Puts the number of inequality constraints.

Puts the number of inequality constraints and (re)allocates memory for the values and gradients of the constraints..

Parameters:
[in]iNumIneqConstrNumber of inequality constraints
Return values:
ERROR_OPTIMIZER_INVALID_FUNCTION_CALLFunction must not be called at this time.
ERROR_OPTIMIZER_ILLEGAL_DATAiNumIneqConstr is negative.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

void SqpWrapper::Reset ( void  ) [virtual]

Resets the optimizer so that another optimization problem can be solved.

This is not a complete reset, so that the parameters put to the optimizer are kept.

Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Reimplemented from OptimizerInterface.

int SqpWrapper::SolvedId ( void  ) const [virtual]

Returns constant indicating that the problem is solved.

Return values:
SQP_WRAPPER__STATUS_SOLVED= 0
Returns:
Constant indicating that the problem is solved.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.

int SqpWrapper::StartOptimizer ( void  ) [virtual]

Performs one iteration step.

On first call it allocates all needed arrays, calls the fortran routine and updates the stati. On further calls the fortran routine will be called and the stati will be updated.

Return values:
ERROR_OPTIMIZER_NOT_INITIALIZEDA parameter is not set correctly.
EXIT_SUCCESSNo error.
Returns:
Error code integer.
Author:
inuTech GmbH
Fuerther Str. 212
90429 Nuernberg
Version:
Rev:
477

Implements OptimizerInterface.


The documentation for this class was generated from the following files:
www.inutech.de