IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.

IG::Num::ScalarFunctionResults Class Reference

Storage for results of a scalar function. Includes parameters at which function was (or should be) evaluated, flags specifying what has been and what should be evaluated, calculated value, gradient and Hessian of the function in the specified point. More...

Inheritance diagram for IG::Num::ScalarFunctionResults:
Collaboration diagram for IG::Num::ScalarFunctionResults:

List of all members.

Public Member Functions

 ScalarFunctionResults ()
 1 parameter, no constraints, 1 objective function. No gradients required
 ScalarFunctionResults (bool reqGradients)
 1 parameter, no constraints, 1 objective function.
 ScalarFunctionResults (int numParameters)
 Specified number of parameters, 1 objective, no constraints. No gradients required.
 ScalarFunctionResults (int numParameters, bool reqGradients)
 Specified number of parameters, 1 objective, no constraints. No gradients required.
virtual IVector GetParameters ()
 Returns vector of optimization parameters.
virtual void SetParameters (IVector value)
 Sets the vector of optimization parameters. If CopyReferences=true (false by default) then only the reference is copied.
virtual void SetParametersReference (IVector reference)
 Sets the vector of optimization parameters. Only the reference is copied.
virtual double GetParameter (int index)
 Returns specific optimization parameter. Throws exception if not defined or index out of bounds.
virtual void SetParameter (int index, double value)
 Sets the specified optimization parameter.
virtual double GetValue ()
 Returns the value of the function./summary>
virtual void SetValue (double value)
 Sets the value of the function.
virtual IVector GetGradient ()
 Returns the function gradient.
virtual void SetGradient (IVector value)
 Sets the function gradient. If CopyReferences=true (false by default) then only the reference is copied.
virtual void SetGradientReference (IVector reference)
 Sets the function gradient. Only the reference is copied.
virtual double GetGradient (int index)
 Returns the specified component of the function gradient.
virtual void SetGradient (int index, double value)
 Sets the specified component of the function gradient.
virtual IMatrix GetHessian ()
 Returns the function's Hessian.
virtual void SetHessian (IMatrix value)
 Sets the functions' Hessian. If CopyReferences=true (false by default) then only the reference is copied.
virtual void SetHessianReference (IMatrix reference)
 Sets the functions' Hessian. Only the reference is copied.
virtual double GetHessian (int rowIndex, int columnIndex)
 Returns the specified component of the function's Hessian.
virtual void SetHessian (int rowIndex, int columnIndex, double value)
 Sets the specified component of the function's Hessian.
virtual void NullifyAll ()
 Sets all objects (parameters and result objects) to null. If the references are not assigned elsewhere, these objects become eligible for garbage collection.
virtual void NullifyResults ()
 Sets all result objects to null. If the references are not assigned elsewhere, these objects become eligible for garbage collection.
virtual void AllocateParameters ()
 Allocates space for parameters.
virtual void AllocateRequested ()
 Allocates space for all requested result objects.
virtual void AllocateGradient ()
 Allocate space for function gradient.
virtual void AllocateHessian ()
 Allocates space for function Hessian.
virtual void ResetResults ()
 Sets all calculated flags to false, error code to 0 (no error) and error string to null.
virtual void Copy (IScalarFunctionResults results)
 Copies data from another analysis results.
virtual IScalarFunctionResults GetCopy ()
 Returns an exact deep copy of the current object.

Protected Attributes

int _numParameters = 1
IVector _parameters
double _value
IVector _Gradient
IMatrix _Hessian
bool _copyReferences = false
bool _reqValue = true
bool _reqGradient = false
bool _reqHessian = false
int _errorCode = 0
string _errorString = null
bool _calcValue = false
bool _calcGradient = false
bool _calcHessian = false
int _numObjectives = 1
int _numConstraints = 0
int _numEqualityConstraints = 0
List< double > _constraints
List< IVector_constraintGradients
List< IMatrix_constraintHessians
bool _reqConstraints = true
bool _reqConstraintGradients = false
bool _reqConstraintHessians = false
bool _calcConstraints = false
bool _calcConstraintGradients = false
bool _calcConstraintHessians = false

Properties

virtual int NumParameters [get, set]
 Number of parameters.
virtual bool CopyReferences [get, set]
 Indicates whether just references can be copied when setting function parameters or results. If false then deep copy is always performed. Default is false.
virtual IVector Parameters [get, set]
 Optimization parameters. If CopyReferences=true (false by default) then only the reference is copied when assigning.
virtual double Value [get, set]
 Value of the function.
virtual IVector Gradient [get, set]
 Function gradient. If CopyReferences=true (false by default) then only the reference is copied in assignments.
virtual IMatrix Hessian [get, set]
 Function Hessian (matrix of second derivatives). If CopyReferences=true (false by default) then only the reference is copied in assignments.
virtual bool ReqValue [get, set]
 Indicates whether calculation of function value is/was requested.
virtual bool ReqGradient [get, set]
 Indicates whether calculation of function gradient is/was requested.
virtual bool ReqHessian [get, set]
 Indicates whether calculation of function Hessian is/was requested.
virtual int ErrorCode [get, set]
 Error code. 0 - everything is OK. negative value - something went wrong.
virtual String ErrorString [get, set]
 Error string indicating what went wrong.
virtual bool Calculated [get, set]
 Collectively gets or sets calculated flags. Set false: all calculated flags are set to false. Set true: all calculated flags for which the corresponding request flags are true, are set to truee, others are set to false. Get: returns true if all the flags for which the corresponding request flags are true, are also true. Otherwise returns false.
virtual bool CalculatedValue [get, set]
 Indicates whether calculation of function value is/was requested.
virtual bool CalculatedGradient [get, set]
 Indicates whether calculation of function gradient is/was requested.
virtual bool CalculatedHessian [get, set]
 Indicates whether calculation of function Hessian is/was requested.

Detailed Description

Storage for results of a scalar function. Includes parameters at which function was (or should be) evaluated, flags specifying what has been and what should be evaluated, calculated value, gradient and Hessian of the function in the specified point.

$A Igor xx Dec09 Nov10;


Constructor & Destructor Documentation

IG::Num::ScalarFunctionResults::ScalarFunctionResults ( ) [inline]

1 parameter, no constraints, 1 objective function. No gradients required

IG::Num::ScalarFunctionResults::ScalarFunctionResults ( bool  reqGradients) [inline]

1 parameter, no constraints, 1 objective function.

Parameters:
reqGradientsWhether gradient of the objective function is required.
IG::Num::ScalarFunctionResults::ScalarFunctionResults ( int  numParameters) [inline]

Specified number of parameters, 1 objective, no constraints. No gradients required.

Parameters:
numParametersNumber of parameters.
IG::Num::ScalarFunctionResults::ScalarFunctionResults ( int  numParameters,
bool  reqGradients 
) [inline]

Specified number of parameters, 1 objective, no constraints. No gradients required.

Parameters:
numParametersNumber of parameters.
reqGradientsWhether gradients are requested.

Member Function Documentation

virtual IVector IG::Num::ScalarFunctionResults::GetParameters ( ) [inline, virtual]

Returns vector of optimization parameters.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetParameters ( IVector  value) [inline, virtual]

Sets the vector of optimization parameters. If CopyReferences=true (false by default) then only the reference is copied.

Parameters:
valueValue to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetParametersReference ( IVector  reference) [inline, virtual]

Sets the vector of optimization parameters. Only the reference is copied.

Parameters:
valueReference to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual double IG::Num::ScalarFunctionResults::GetParameter ( int  index) [inline, virtual]

Returns specific optimization parameter. Throws exception if not defined or index out of bounds.

Parameters:
iindexIndex of parameter to be returned (counting from 0).

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetParameter ( int  index,
double  value 
) [inline, virtual]

Sets the specified optimization parameter.

Parameters:
indexIndex of parameter to be set (counting from 0).
valueParameter value.

Implements IG::Num::IScalarFunctionResults.

virtual double IG::Num::ScalarFunctionResults::GetValue ( ) [inline, virtual]

Returns the value of the function./summary>

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetValue ( double  value) [inline, virtual]

Sets the value of the function.

Parameters:
valueValue to be assigned to the objective function.

Implements IG::Num::IScalarFunctionResults.

virtual IVector IG::Num::ScalarFunctionResults::GetGradient ( ) [inline, virtual]

Returns the function gradient.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetGradient ( IVector  value) [inline, virtual]

Sets the function gradient. If CopyReferences=true (false by default) then only the reference is copied.

Parameters:
valueValue to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetGradientReference ( IVector  reference) [inline, virtual]

Sets the function gradient. Only the reference is copied.

Parameters:
valueReference to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual double IG::Num::ScalarFunctionResults::GetGradient ( int  index) [inline, virtual]

Returns the specified component of the function gradient.

Parameters:
indexIndex of the component.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetGradient ( int  index,
double  value 
) [inline, virtual]

Sets the specified component of the function gradient.

Parameters:
indexIndex of gradient component to be set.
valueValue of the gradient component.

Implements IG::Num::IScalarFunctionResults.

virtual IMatrix IG::Num::ScalarFunctionResults::GetHessian ( ) [inline, virtual]

Returns the function's Hessian.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetHessian ( IMatrix  value) [inline, virtual]

Sets the functions' Hessian. If CopyReferences=true (false by default) then only the reference is copied.

Parameters:
valueValue to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetHessianReference ( IMatrix  reference) [inline, virtual]

Sets the functions' Hessian. Only the reference is copied.

Parameters:
valueReference to be assigned.

Implements IG::Num::IScalarFunctionResults.

virtual double IG::Num::ScalarFunctionResults::GetHessian ( int  rowIndex,
int  columnIndex 
) [inline, virtual]

Returns the specified component of the function's Hessian.

Parameters:
rowIndexRow index of the component (counting from 0).
columnIndexColumn index of the component (counting from 0).

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::SetHessian ( int  rowIndex,
int  columnIndex,
double  value 
) [inline, virtual]

Sets the specified component of the function's Hessian.

Parameters:
rowIndexRow index of the component (counting from 0).
columnIndexColumn index of the component (counting from 0).
valueValue to be assigned to Hessian.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::NullifyAll ( ) [inline, virtual]

Sets all objects (parameters and result objects) to null. If the references are not assigned elsewhere, these objects become eligible for garbage collection.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::NullifyResults ( ) [inline, virtual]

Sets all result objects to null. If the references are not assigned elsewhere, these objects become eligible for garbage collection.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::AllocateParameters ( ) [inline, virtual]

Allocates space for parameters.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::AllocateRequested ( ) [inline, virtual]

Allocates space for all requested result objects.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::AllocateGradient ( ) [inline, virtual]

Allocate space for function gradient.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::AllocateHessian ( ) [inline, virtual]

Allocates space for function Hessian.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::ResetResults ( ) [inline, virtual]

Sets all calculated flags to false, error code to 0 (no error) and error string to null.

Implements IG::Num::IScalarFunctionResults.

virtual void IG::Num::ScalarFunctionResults::Copy ( IScalarFunctionResults  results) [inline, virtual]

Copies data from another analysis results.

Parameters:
resAnalysis results which data is copied from.

Implements IG::Num::IScalarFunctionResults.

virtual IScalarFunctionResults IG::Num::ScalarFunctionResults::GetCopy ( ) [inline, virtual]

Returns an exact deep copy of the current object.

Implements IG::Num::IScalarFunctionResults.


Member Data Documentation


Property Documentation

virtual int IG::Num::ScalarFunctionResults::NumParameters [get, set]

Number of parameters.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::CopyReferences [get, set]

Indicates whether just references can be copied when setting function parameters or results. If false then deep copy is always performed. Default is false.

Implements IG::Num::IScalarFunctionResults.

virtual IVector IG::Num::ScalarFunctionResults::Parameters [get, set]

Optimization parameters. If CopyReferences=true (false by default) then only the reference is copied when assigning.

Implements IG::Num::IScalarFunctionResults.

virtual double IG::Num::ScalarFunctionResults::Value [get, set]

Value of the function.

Implements IG::Num::IScalarFunctionResults.

virtual IVector IG::Num::ScalarFunctionResults::Gradient [get, set]

Function gradient. If CopyReferences=true (false by default) then only the reference is copied in assignments.

Implements IG::Num::IScalarFunctionResults.

virtual IMatrix IG::Num::ScalarFunctionResults::Hessian [get, set]

Function Hessian (matrix of second derivatives). If CopyReferences=true (false by default) then only the reference is copied in assignments.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::ReqValue [get, set]

Indicates whether calculation of function value is/was requested.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::ReqGradient [get, set]

Indicates whether calculation of function gradient is/was requested.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::ReqHessian [get, set]

Indicates whether calculation of function Hessian is/was requested.

Implements IG::Num::IScalarFunctionResults.

virtual int IG::Num::ScalarFunctionResults::ErrorCode [get, set]

Error code. 0 - everything is OK. negative value - something went wrong.

Implements IG::Num::IScalarFunctionResults.

virtual String IG::Num::ScalarFunctionResults::ErrorString [get, set]

Error string indicating what went wrong.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::Calculated [get, set]

Collectively gets or sets calculated flags. Set false: all calculated flags are set to false. Set true: all calculated flags for which the corresponding request flags are true, are set to truee, others are set to false. Get: returns true if all the flags for which the corresponding request flags are true, are also true. Otherwise returns false.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::CalculatedValue [get, set]

Indicates whether calculation of function value is/was requested.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::CalculatedGradient [get, set]

Indicates whether calculation of function gradient is/was requested.

Implements IG::Num::IScalarFunctionResults.

virtual bool IG::Num::ScalarFunctionResults::CalculatedHessian [get, set]

Indicates whether calculation of function Hessian is/was requested.

Implements IG::Num::IScalarFunctionResults.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties Events