This class provides a data structure for a optimization function. This function could be either a constraint or a objective function of the problem. More...

Inheritance diagram for NlpFunction:
[legend]

Public Member Functions

 NlpFunction (varargin)
 The class constructor function. More...
 
function NlpFunction funcs = getSummands ()
 Returns the object of the dependent function. More...
 
function obj = setSummands (NlpFunction summands)
 Sets dependent objects of the Nlp Function. More...
 
function colvec indices = getDepIndices ()
 Returns the indices of the dependent variables. More...
 
function obj = setName (char name)
 Specifies the name of the NLP function. More...
 
function obj = setType (char type)
 Sets the type (either LINEAR or NONLINEAR) of the NLP function. More...
 
function obj = setAuxdata (rowvec auxdata)
 Sets the auxilary input argument data to call the NLP function. These auxilary data must be a vector of numeric values. More...
 
function obj = setJacobianPattern (matrix jac_sp,char sp_form)
 This function configure the sparsity pattern of the Jacobian of the function. More...
 
function obj = setHessianPattern (cell hes_sp,char sp_form)
 This function configure the sparsity pattern of the Hessian of the function. More...
 
function obj = setDependentVariable (NlpVariables depvars)
 This function sets the dependent variables of the function. More...
 
function obj = setBoundary (colvec lowerbound,colvec upperbound)
 set the upper/lower boundary values of the function if they exist More...
 
function obj = updateProp (varargin)
 This function updates the properties of the class object based on the input name-value pair arguments. More...
 
function val = checkFuncs (colvec x,double derivative_level)
 Evaluates the external functions (or function handles) with a given input argument. More...
 
function obj = setDimension (double dim)
 Sets the dimension of the NLP variable vector. More...
 
function obj = setFuncIndices (integer index)
 Sets indinces of the Nlp Function. More...
 
function obj = setFuncs (funcs)
 This function specify the functions (name) that calculates the the function. More...
 
function obj = setSymFun (SymFunction symfun)
 This function specify the symbolic expression (SymFunction) of the NLP function. More...
 

Public Attributes

logical Type
 This property specifies whether the function is the linear function of dependent variables. More...
 
char Name
 An identification of the object. More...
 
NlpVariable DepVariables
 An array of dependent NLP variables. More...
 
NlpFunction SummandFunctions
 An array of summand NlpFunctions that are to be summed up to get the current NLP function. More...
 
colvec FuncIndices
 Stores the indices of the function. More...
 
colvec nnzJacIndices
 Stores the indices of the non-zero elements in the first-order jacobian. More...
 
colvec nnzHessIndices
 Stores the indices of the non-zero elements in the Hessian matrix of the Lagrangian. More...
 
 Funcs
 File names of the external functions that computes the function/Jacobian/Hessian of the object. More...
 
struct JacPattern
 A two-vector structure that specifies the non-zero structure of the first order Jacobian of the function with respect to the dependent variables. The first vector determines the row indices of the all non-zero elements in the Jacobian matrix, and the second vector determines the colomn indices of the all non-zero elements in the Jacobian matrix. For the gradient of the cost function, the first vector should consists of all 1s. More...
 
struct HessPattern
 A two-vector structure that specifies the non-zero structure of the second order Hessian of the Lagrangian function with respect to the dependent variables. The first vector determines the row indices of the all non-zero elements in the Hessian matrix, and the second vector determines the colomn indices of the all non-zero elements in the Hessian matrix. More...
 
integer nnzJac
 The number of nonzero entries in the Jacobian matrix. More...
 
integer nnzHess
 The number of nonzero entries in the Hessian matrix. More...
 
cell AuxData
 A constant array of auxiliary data that will be used to construct the function handles. More...
 
SymFunction SymFun
 The associated SymFunction object that specifies the symbolic expression of the NlpFunction. More...
 
colvec LowerBound
 The lower boundary values of the function. More...
 
colvec UpperBound
 The upper boundary values of the function. More...
 
integer Dimension = 0
 It gives a quick access to the dimension of the function output without actually evaluating the function. More...
 
- Public Attributes inherited from handle
 addlistener
 Creates a listener for the specified event and assigns a callback function to execute when the event occurs. More...
 
 notify
 Broadcast a notice that a specific event is occurring on a specified handle object or array of handle objects. More...
 
 delete
 Handle object destructor method that is called when the object's lifecycle ends. More...
 
 disp
 Handle object disp method which is called by the display method. See the MATLAB disp function. More...
 
 display
 Handle object display method called when MATLAB software interprets an expression returning a handle object that is not terminated by a semicolon. See the MATLAB display function. More...
 
 findobj
 Finds objects matching the specified conditions from the input array of handle objects. More...
 
 findprop
 Returns a meta.property objects associated with the specified property name. More...
 
 fields
 Returns a cell array of string containing the names of public properties. More...
 
 fieldnames
 Returns a cell array of string containing the names of public properties. See the MATLAB fieldnames function. More...
 
 isvalid
 Returns a logical array in which elements are true if the corresponding elements in the input array are valid handles. This method is Sealed so you cannot override it in a handle subclass. More...
 
 eq
 Relational functions example. See details for more information. More...
 
 transpose
 Transposes the elements of the handle object array. More...
 
 permute
 Rearranges the dimensions of the handle object array. See the MATLAB permute function. More...
 
 reshape
 hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape function. More...
 
 sort
 ort the handle objects in any array in ascending or descending order. More...
 

Detailed Description

This class provides a data structure for a optimization function. This function could be either a constraint or a objective function of the problem.

To define a NlpFunction object, a user-defined function file must be created first. It could be either MATLAB m file or mex file. The name of the file should be the same as the name of the NlpFunction.

Copyright (c) 2016, AMBER Lab All right reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted only in compliance with the BSD 3-Clause license, see http://www.opensource.org/licenses/bsd-license.php

Constructor & Destructor Documentation

◆ NlpFunction()

NlpFunction.NlpFunction (   varargin)
inline

The class constructor function.

Attention
The auxdata argument must be an 1-dimensional vector of constants.
Parameters
vararginvariable nama-value pair input arguments, in detail: Required Parameters for varargin:
  • Name the name of the function.
  • Type the type of the function.
Required fields of Funcs:
  • Func —  a string of the function that computes the function value
  • Jac —  a string of the function that computes the function Jacobian
  • JacStruct —  a string of the function that computes the sparsity structure of function Jacobian
  • Hess —  a string of the function that computes the function Hessian
  • HessStruct —  a string of the function that computes the sparsity structure of function Hessian
Required fields of jac_nz_pattern:
  • rows —  the row indices of non-zero elements
  • cols —  the column indices of non-zero elements
Required fields of hess_nz_pattern:
  • rows —  the row indices of non-zero elements
  • cols —  the column indices of non-zero elements

Member Function Documentation

◆ checkFuncs()

function struct val = NlpFunction.checkFuncs ( colvec  x,
double  derivative_level 
)

Evaluates the external functions (or function handles) with a given input argument.

Parameters
xthe value of dependent variables
derivative_leveldetermines the level of derivatives to be exported (1, 2)
Return values
vala structure of computed values

◆ getDepIndices()

function colvec indices = NlpFunction.getDepIndices ( )
inline

Returns the indices of the dependent variables.

Return values
indicesthe indices of dependent variables

◆ getSummands()

function NlpFunction funcs = NlpFunction.getSummands ( )
inline

Returns the object of the dependent function.

For most of the function object, the dependent object is itself.

Return values
funcsthe summand function objects

◆ setAuxdata()

function obj = NlpFunction.setAuxdata ( rowvec  auxdata)

Sets the auxilary input argument data to call the NLP function. These auxilary data must be a vector of numeric values.

Parameters
auxdataa set of auxilary input argument
Generated fields of obj:

◆ setBoundary()

function obj = NlpFunction.setBoundary ( colvec  lowerbound,
colvec  upperbound 
)

set the upper/lower boundary values of the function if they exist

Note
If the boundary values are not specified, then use -Inf/Inf by default.
If the NLP function is a vector (Dimension > 1) but the lower/upper bound values are specified as a scalar, we set the lower/upper bounds of all element with the same scalar value.
Ignore a particular boundary if it is given as empty
Parameters
lowerboundthe lower boundary values
upperboundthe upper boundary values
Generated fields of obj:

◆ setDependentVariable()

function obj = NlpFunction.setDependentVariable ( NlpVariables  depvars)

This function sets the dependent variables of the function.

Parameters
depvarsan array of dependent variables
Required fields of depvars:
Generated fields of obj:

◆ setDimension()

function obj = NlpFunction.setDimension ( double  dim)

Sets the dimension of the NLP variable vector.

Parameters
dimthe dimension of the vector
Generated fields of obj:

◆ setFuncIndices()

function obj = NlpFunction.setFuncIndices ( integer  index)

Sets indinces of the Nlp Function.

Parameters
indexthe indices of the function
Generated fields of obj:

◆ setFuncs()

function obj = NlpFunction.setFuncs (   funcs)

This function specify the functions (name) that calculates the the function.

Parameters
funcs
Required fields of Funcs:
  • Func —  a string of the function that computes the function value
  • Jac —  a string of the function that computes the function Jacobian
  • JacStruct —  a string of the function that computes the sparsity structure of function Jacobian
  • Hess —  a string of the function that computes the function Hessian
  • HessStruct —  a string of the function that computes the sparsity structure of function Hessian
Generated fields of obj:

◆ setHessianPattern()

function obj = NlpFunction.setHessianPattern ( cell  hes_sp,
char  sp_form 
)

This function configure the sparsity pattern of the Hessian of the function.

The form of given sparsity pattern is determined by the input

argument sp_form. It can be one of the followings
MatrixForm: the sparsity pattern is given as a matrix (dense or sparse). In this case we extract the row and column indices of non-zero elements from this matrix Indexform: the sparsity pattern is directly given as vectors row and column indices of non-zero entries
Note
In MATLAB's sparse matrix, the values of same set of row and column indices are added together. For example, sparse([1;1],[1;1],[1,2]) will results in a sparse matrix with 1+2 = 3 at entry (1,1).
Parameters
hes_spa matrix array consists of sparsity pattern of Hessian of each element of the function
sp_formthe type of given sparsity pattern.
Generated fields of obj:

◆ setJacobianPattern()

function obj = NlpFunction.setJacobianPattern ( matrix  jac_sp,
char  sp_form 
)

This function configure the sparsity pattern of the Jacobian of the function.

The form of given sparsity pattern is determined by the input

argument sp_form. It can be one of the followings
MatrixForm: the sparsity pattern is given as a matrix (dense or sparse). In this case we extract the row and column indices of non-zero elements from this matrix Indexform: the sparsity pattern is directly given as vectors row and column indices of non-zero entries
Parameters
jac_spthe sparsity pattern of the Jacobian
sp_formthe type of given sparsity pattern.
Generated fields of obj:

◆ setName()

function obj = NlpFunction.setName ( char  name)

Specifies the name of the NLP function.

Parameters
namethe name character
Generated fields of obj:

◆ setSummands()

function obj = NlpFunction.setSummands ( NlpFunction  summands)
inline

Sets dependent objects of the Nlp Function.

Parameters
summandsthe summand function objects
Generated fields of obj:

◆ setSymFun()

function obj = NlpFunction.setSymFun ( SymFunction  symfun)

This function specify the symbolic expression (SymFunction) of the NLP function.

Parameters
symfunthe symbolic function object
Required fields of symfun:
Generated fields of obj:

◆ setType()

function obj = NlpFunction.setType ( char  type)

Sets the type (either LINEAR or NONLINEAR) of the NLP function.

Parameters
typethe type of the NLP function
Generated fields of obj:

◆ updateProp()

function obj = NlpFunction.updateProp (   varargin)

This function updates the properties of the class object based on the input name-value pair arguments.

Parameters
vararginvariable nama-value pair input arguments, in detail:
updateProp ( lb, ub )
Required Parameters for varargin:
  • lb lower limit
  • ub upper limit

Member Data Documentation

◆ AuxData

NlpFunction.AuxData

A constant array of auxiliary data that will be used to construct the function handles.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ DepVariables

NlpFunction.DepVariables

An array of dependent NLP variables.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ Dimension

NlpFunction.Dimension = 0

It gives a quick access to the dimension of the function output without actually evaluating the function.

Default: 0

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ FuncIndices

NlpFunction.FuncIndices

Stores the indices of the function.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ Funcs

NlpFunction.Funcs

File names of the external functions that computes the function/Jacobian/Hessian of the object.

Each field of 'Funcs' specifies the name of a function that used for a certain computation of the function.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ HessPattern

NlpFunction.HessPattern

A two-vector structure that specifies the non-zero structure of the second order Hessian of the Lagrangian function with respect to the dependent variables. The first vector determines the row indices of the all non-zero elements in the Hessian matrix, and the second vector determines the colomn indices of the all non-zero elements in the Hessian matrix.

See also
sparsematrix
Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ JacPattern

NlpFunction.JacPattern

A two-vector structure that specifies the non-zero structure of the first order Jacobian of the function with respect to the dependent variables. The first vector determines the row indices of the all non-zero elements in the Jacobian matrix, and the second vector determines the colomn indices of the all non-zero elements in the Jacobian matrix. For the gradient of the cost function, the first vector should consists of all 1s.

See also
sparsematrix
Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ LowerBound

NlpFunction.LowerBound

The lower boundary values of the function.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ Name

NlpFunction.Name

An identification of the object.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ nnzHess

NlpFunction.nnzHess

The number of nonzero entries in the Hessian matrix.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ nnzHessIndices

NlpFunction.nnzHessIndices

Stores the indices of the non-zero elements in the Hessian matrix of the Lagrangian.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ nnzJac

NlpFunction.nnzJac

The number of nonzero entries in the Jacobian matrix.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ nnzJacIndices

NlpFunction.nnzJacIndices

Stores the indices of the non-zero elements in the first-order jacobian.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ SummandFunctions

NlpFunction.SummandFunctions

An array of summand NlpFunctions that are to be summed up to get the current NLP function.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ SymFun

NlpFunction.SymFun

The associated SymFunction object that specifies the symbolic expression of the NlpFunction.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ Type

NlpFunction.Type

This property specifies whether the function is the linear function of dependent variables.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

◆ UpperBound

NlpFunction.UpperBound

The upper boundary values of the function.

Note
This property has non-standard access specifiers: SetAccess = Protected, GetAccess = Public
Matlab documentation of property attributes.

The documentation for this class was generated from the following files:
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/NlpFunction.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/checkFuncs.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/setAuxdata.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/setBoundary.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/setDependentVariable.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/setDimension.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/setFuncIndices.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/setFuncs.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/setHessianPattern.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/setJacobianPattern.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/setName.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/setSymFun.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/setType.m
  • /home/ayonga/.dropboxes/business/Dropbox/research/dzopt/frost/matlab/nlp/@NlpFunction/updateProp.m