IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Num.AnalysisResults Class Reference

Single objective optimization analysis results. Used to transfer parameters input (e.g. vector of parameters, request flags) to the analysis function and to store analysis output results (e.g. objective and constraint functions, their gradients, error codes, and flags indicating what has actually been calculated). REMARKS: Property CopyReferences specifies whether only references are copied when individial object fields are assigned and set (when the property is true), or values are actually copied (when false - deep copy). Each setter method also has the variant that always copies only the reference (function name appended by "Reference"). This makes possible to avoid duplication of allocated data and also to avoid having different data with the same references. AGREEMENTS: Optimization problem is defined as minimize f(x), subject to: c_i(x) less or equal 0, i=0...NI-1 c_j(x)=0, j=NI...NI+NE-1. Here x is vector of parameters, f(x) is the objective function, and c_i(x) and c_j(c) are constraint functions. NI is number of inequality constraints and NE is number of equality constraints. If there are equality constraints then they are listed after inequality constraints. More...

+ Inheritance diagram for IG.Num.AnalysisResults:
+ Collaboration diagram for IG.Num.AnalysisResults:

Public Member Functions

 AnalysisResults ()
 1 parameter, no constraints, 1 objective function. No gradients required More...
 
 AnalysisResults (bool reqGradients)
 1 parameter, no constraints, 1 objective function. More...
 
 AnalysisResults (int numParameters)
 Specified number of parameters, 1 objective, no constraints. No gradients required. More...
 
 AnalysisResults (int numParameters, bool reqGradients)
 Specified number of parameters, 1 objective, no constraints. No gradients required. More...
 
 AnalysisResults (int numParameters, int numConstraints)
 Specified number of parameters and constraints, 1 objective. No gradients required. More...
 
 AnalysisResults (int numParameters, int numConstraints, bool reqGradients)
 Specified number of parameters and constraints, 1 objective. No gradients required. More...
 
virtual bool IsEqualityConstraint (int which)
 Returns true if the specified constraint is an equality constraint, and false otherwise. More...
 
virtual IVector GetParameters ()
 Returns vector of optimization parameters. More...
 
virtual void SetParameters (IVector value)
 Sets the vector of optimization parameters. If CopyReferences=true (false by default) then only the reference is copied. More...
 
virtual void SetParametersReference (IVector reference)
 Sets the vector of optimization parameters. Only the reference is copied. More...
 
virtual double GetParameter (int index)
 Returns specific optimization parameter. Throws exception if not defined or index out of bounds. More...
 
virtual void SetParameter (int index, double value)
 Sets the specified optimization parameter. More...
 
virtual double GetObjective ()
 Returns the value of the objective function. More...
 
virtual void SetObjective (double value)
 Sets the value of the objective function. More...
 
virtual IVector GetObjectiveGradient ()
 Returns the objective function gradient. More...
 
virtual void SetObjectiveGradient (IVector value)
 Sets the objective function gradient. If CopyReferences=true (false by default) then only the reference is copied. More...
 
virtual void SetObjectiveGradientReference (IVector reference)
 Sets the objective function gradient. Only the reference is copied. More...
 
virtual double GetObjectiveGradient (int index)
 Returns the specified component of the objective function gradient. More...
 
virtual void SetObjectiveGradient (int index, double value)
 Sets the specified component of the objective function gradient. More...
 
virtual List< double > GetConstraints ()
 Returns a list of constraint function values. More...
 
virtual void SetConstraints (List< double > values)
 Sets the list of constraint function values. If CopyReferences=true (false by default) then only the list reference is copied. More...
 
virtual void SetConstraintsReference (List< double > reference)
 Sets the list of constraint function values. Only the list reference is copied. More...
 
virtual double GetConstraint (int which)
 Returns the specified constraint function value. More...
 
virtual void SetConstraint (int which, double value)
 Sets the specified constraint function value. More...
 
virtual List< IVectorGetConstraintGradients ()
 Returns a list of constraint function gradients. More...
 
virtual void SetConstraintGradients (List< IVector > values)
 Sets constraint function gradients. If CopyReferences=true (false by default) then only the list reference is copied. More...
 
virtual void SetConstraintGradientsReference (List< IVector > reference)
 Sets constraint function gradients. Only the list reference is copied. More...
 
virtual IVector GetConstraintGradient (int which)
 Returns the gradient of the specified constraint function. More...
 
virtual double GetConstraintGradient (int which, int index)
 Returns the specific constraint function gradient component. More...
 
virtual void SetConstraintGradient (int which, IVector value)
 Sets the specified constraint function gradient. If CopyReferences=true (false by default) then only the reference is copied. More...
 
virtual void SetConstraintGradientReference (int which, IVector reference)
 Sets the specified constraint function gradient. Only the reference is copied. More...
 
virtual void SetConstraintGradient (int which, int index, double value)
 Sets the specified constraint fuction gradient component. More...
 
virtual IMatrix GetObjectiveHessian ()
 Returns the objective function's Hessian. More...
 
virtual void SetObjectiveHessian (IMatrix value)
 Sets the objective functions' Hessian. If CopyReferences=true (false by default) then only the reference is copied. More...
 
virtual void SetObjectiveHessianReference (IMatrix reference)
 Sets the objective functions' Hessian. Only the reference is copied. More...
 
virtual double GetObjectiveHessian (int rowIndex, int columnIndex)
 Returns the specified component of the objective function Hessian. More...
 
virtual void SetObjectiveHessian (int rowIndex, int columnIndex, double value)
 Sets the specified component of the objective function's Hessian. More...
 
virtual List< IMatrixGetConstraintHessians ()
 Returns the list of constraint functions' Hessians. More...
 
virtual void SetConstraintHessians (List< IMatrix > values)
 Sets constraint functios' Hessians. If CopyReferences=true (false by default) then only the list reference is copied. More...
 
virtual void SetConstraintHessiansReference (List< IMatrix > reference)
 Sets constraint functios' Hessians. Only the list reference is copied. More...
 
virtual IMatrix GetConstraintHessian (int which)
 Returns Hessian of the specified constraint function. More...
 
virtual double GetConstraintHessian (int which, int rowIndex, int columnIndex)
 Returns the specified component of Hessian of the specified constraint function. More...
 
virtual void SetConstraintHessian (int which, IMatrix value)
 Sets the specified constraint function's Hessian. If CopyReferences=true (false by default) then only the reference is copied. More...
 
virtual void SetConstraintHessianReference (int which, IMatrix reference)
 Sets the specified constraint function's Hessian. Only the reference is copied. More...
 
virtual void SetConstraintHessian (int which, int rowIndex, int columnIndex, double value)
 Sets the specified component of the specified constraint's Hessian. More...
 
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. More...
 
virtual void NullifyResults ()
 Sets all result objects to null. If the references are not assigned elsewhere, these objects become eligible for garbage collection. More...
 
virtual void AllocateParameters ()
 Allocates space for parameters. More...
 
virtual void AllocateRequested ()
 Allocates space for all requested result objects. More...
 
virtual void AllocateObjectiveGradient ()
 Allocate space for objective function gradient. More...
 
virtual void AllocateObjectiveHessian ()
 Allocates space for objective function Hessian. More...
 
virtual void AllocateConstraintsList ()
 Allocates space for list of constraint functions. More...
 
virtual void AllocateConstraintGradientsList ()
 Allocates space for list of constraint function gradients. More...
 
virtual void AllocateConstrainGradients ()
 Allocates space for constraint function gradients (including for the list, if necessarty). More...
 
virtual void AllocateConstraintGradient (int which)
 Allocates space for the specified constraint function gradient. More...
 
virtual void AllocateConstraintHessiansList ()
 Allocates space for the list of constraint functions' Hessians. More...
 
virtual void AllocateConstraintHessians ()
 Allocates space for constraint functions' Hessians (including space for the list, if necessary). More...
 
virtual void AllocateConstraintHessian (int which)
 Allocates space for the specified constraint fucnction's Hessian. More...
 
virtual void ResetResults ()
 Sets all calculated flags to false, error code to 0 (no error) and error string to null. More...
 
virtual void SetDimensions (int numParameters, int numConstraints)
 Sets the dimension of the analysis results object according to the specified values. More...
 
virtual void SetDimensions (int numParameters, int numObjectives, int numConstraints)
 Sets the dimension of the analysis results object according to the specified values. More...
 
virtual void PrepareResultStorage ()
 Prepares data storage for results (allocates the appropriate vectors, matrices, lists, etc.) according to the numbers of parameters, constraint functions, and request flags, and resets calculation flags to false. More...
 
virtual void PrepareResultStorage (bool resetCalculatedFlags)
 Prepares data storage for results (allocates the appropriate vectors, matrices, lists, etc.) according to the numbers of parameters, constraint functions, and request flags. More...
 
virtual void PrepareResultStorage (int numParameters, int numConstraints)
 Prepares data storage for results (allocates the appropriate vectors, matrices, lists, etc.) according to the numbers of parameters, constraint functions, and request flags, and resets calculation flags to false. More...
 
virtual void PrepareResultStorage (int numParameters, int numObjectives, int numConstraints)
 Prepares data storage for results (allocates the appropriate vectors, matrices, lists, etc.) according to the numbers of parameters, constraint functions, and request flags, and resets calculation flags to false. More...
 
virtual void PrepareResultStorage (int numParameters, int numObjectives, int numConstraints, bool resetCalculatedFlags)
 Prepares data storage for results (allocates the appropriate vectors, matrices, lists, etc.) according to the numbers of parameters, constraint functions, and request flags. More...
 
virtual void Copy (IAnalysisResults results)
 Copies data from another analysis results. More...
 
virtual IAnalysisResults GetCopy ()
 Returns an exact deep copy of the current object. More...
 
virtual bool IsViolated (int which, double equalityTolerance)
 Returns true if the specified constraint is violated according to the current analysis results, false otherwise. More...
 
virtual bool IsViolated (int which)
 Returns true if the specified constraint is violated according to the current analysis results, false otherwise. More...
 
virtual bool IsFeasible (double equalityTolerance)
 Returns true if the current analysis results represent a feasible point. Feasible point is one where no constraints are violated. For unconstraint problems this method always returns true. More...
 
virtual bool IsFeasible ()
 Returns true if the current analysis results represent a feasible point. Feasible point is one where no constraints are violated. For unconstraint problems this method always returns true. More...
 
virtual int GetNumViolatedConstraints (double equalityTolerance)
 Returns number of violated constraints in the current analysis results. Specific constraint is violated if the corresponding constraint function is greater than 0. More...
 
virtual int GetNumViolatedConstraints ()
 Returns number of violated constraints in the current analysis results. Specific constraint is violated if the corresponding constraint function is greater than 0. More...
 
virtual double GetSumResiduals (double equalityTolerance)
 Returns sum of constraint function values corresponding to violated constraints in the current analysis results. Specific constraint is violated if the corresponding constraint function is greater than 0. More...
 
virtual double GetSumResiduals ()
 Returns sum of constraint function values corresponding to violated constraints in the current analysis results. Specific constraint is violated if the corresponding constraint function is greater than 0. More...
 
virtual double GetMaximalResidual (double equalityTolerance)
 Returns the largest constraint function value corresponding to any violated constraint in the current analysis results, or 0 if there are no violated constraints. Specific constraint is violated if the corresponding constraint function is greater than 0. More...
 
virtual double GetMaximalResidual ()
 Returns sum of constraint function values corresponding to violated constraints in the current analysis results. Specific constraint is violated if the corresponding constraint function is greater than 0. More...
 
virtual double GetPenaltyTerm (int which, IPenaltyEvaluator evaluator)
 Returns value of the penalty term corresponding to the specified constraint, calculated by the specified penalty evaluator. More...
 
virtual double GetSumPenaltyTerms (IPenaltyEvaluator evaluator)
 Returns sum of the penalty terms corresponding to all constraint, calculated by the specified penalty evaluator. More...
 
virtual double GetMaxPenaltyTerm (IPenaltyEvaluator evaluator)
 Returns sum of the penalty terms corresponding to all constraint, calculated by the specified penalty evaluator. More...
 
override string ToString ()
 Returns a string representation of the current analysis results object in a standard IGLib form. More...
 
string ToStringMath ()
 Returns a string representation of the current analysis results object in a standard IGLib form (Mathematica-like format but with C representation of numbers). More...
 

Static Public Member Functions

static string ToString (IAnalysisResults anres)
 Returns a string representation of the specified analysis results object in a standard IGLib form. More...
 
static string ToStringRequestMath (IAnalysisResults anres)
 Returns a string representation of the specified analysis request object in a standard IGLib form (Mathematica-like format but with C representation of numbers). More...
 
static string ToStringMath (IAnalysisResults anres)
 Returns a string representation of the specified analysis results object in a standard IGLib form (Mathematica-like format but with C representation of numbers). More...
 
static void LoadStringRequestMath (string requestString, ref AnalysisResults anres)
 Reads analysis request data. More...
 
static void LoadStringMath (string analysisOutputString, ref AnalysisResults anres)
 Reads analysis results data. More...
 
static void SaveRequestMath (IAnalysisResults anres, string filePath)
 Saves the specified analysis request to a file. If the file already exists then it is overwritten. More...
 
static void SaveRequestMath (IAnalysisResults anres, string filePath, bool append)
 Saves the specified analysis request to a file. More...
 
static void SaveMath (IAnalysisResults anres, string filePath)
 Saves the specified analysis results to a file. If the file already exists then it is overwritten. More...
 
static void SaveMath (IAnalysisResults anres, string filePath, bool append)
 Saves the specified analysis results to a file. More...
 
static void LoadRequestMath (string filePath, ref AnalysisResults anResults)
 Loads analysis request data from a file in standard mathematical format and stores it in the specified analysis results object. More...
 
static void LoadMath (string filePath, ref AnalysisResults anResults)
 Loads analysis results from a file in standard mathematical format and stores it in the specified analysis results object. More...
 
static void SaveRequestJson (AnalysisResults anResulsts, string filePath)
 Saves (serializes) the specified analysis request to the specified JSON file. File is owerwritten if it exists. More...
 
static void SaveRequestJson (AnalysisResults anResults, string filePath, bool append)
 Saves (serializes) the specified analysis request to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag. More...
 
static void LoadRequestJson (string filePath, ref AnalysisResults anResultsRestored)
 Restores (deserializes) analysis request from the specified file in JSON format. More...
 
static void SaveJson (AnalysisResults anResulsts, string filePath)
 Saves (serializes) the specified analysis results to the specified JSON file. File is owerwritten if it exists. More...
 
static void SaveJson (AnalysisResults anResults, string filePath, bool append)
 Saves (serializes) the specified analysis results to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag. More...
 
static void LoadJson (string filePath, ref AnalysisResults anResultsRestored)
 Restores (deserializes) analysis results from the specified file in JSON format. More...
 
static AnalysisResults CreateExample (int numParameters, int numConstraints, bool reqObjective, bool reqConstraints, bool reqObjectiveGradient, bool reqConstraintGradients, bool reqObjectiveHessian, bool reqConstraintHessians)
 Creates an example analysis results object according to parameters, with some arbitrary result components. More...
 

Static Protected Member Functions

static void AppendRequestFlagsMath (StringBuilder sb, IAnalysisResults anres)
 

Protected Attributes

int _numParameters = 0
 
int _numObjectives = 1
 
int _numConstraints = 0
 
int _numEqualityConstraints = 0
 
IVector _parameters
 
double _objective
 
IVector _objectiveGradient
 
IMatrix _objectiveHessian
 
List< double > _constraints
 
List< IVector_constraintGradients
 
List< IMatrix_constraintHessians
 
bool _copyReferences = false
 
bool _reqObjective = false
 
bool _reqConstraints = false
 
bool _reqObjectiveGradient = false
 
bool _reqConstraintGradients = false
 
bool _reqObjectiveHessian = false
 
bool _reqConstraintHessians = false
 
int _errorCode = 0
 
string _errorString = null
 
bool _calcObjective = false
 
bool _calcConstraints = false
 
bool _calcObjectiveGradient = false
 
bool _calcConstraintGradients = false
 
bool _calcObjectiveHessian = false
 
bool _calcConstraintHessians = false
 

Properties

virtual int NumParameters [get, set]
 Number of parameters. More...
 
virtual int NumObjectives [get, set]
 Number of objective functions (normally 1 for this type, but can be 0). More...
 
virtual int NumConstraints [get, set]
 Number of constraints. More...
 
virtual int NumEqualityConstraints [get, set]
 Number of equality constraints. More...
 
virtual int NumInequalityConstraints [get]
 Returns number of inequality constraints. More...
 
virtual bool CopyReferences [get, set]
 Indicates whether just references can be copied when setting optimization parameters or results. If false then deep copy is always performed. Default is false. More...
 
virtual IVector Parameters [get, set]
 Optimization parameters. If CopyReferences=true (false by default) then only the reference is copied when assigning. More...
 
virtual double Objective [get, set]
 Value of the objective function. More...
 
virtual IVector ObjectiveGradient [get, set]
 Objective function gradient. If CopyReferences=true (false by default) then only the reference is copied in assignments. More...
 
virtual List< double > Constraints [get, set]
 Constraint function values. If CopyReferences=true (false by default) then only the list reference is copied in assignments. More...
 
virtual List< IVectorConstraintGradients [get, set]
 Constraint function gradients. If CopyReferences=true (false by default) then only the list reference is copied in assignments. More...
 
virtual IMatrix ObjectiveHessian [get, set]
 Objective function Hessian (matrix of second derivatives). If CopyReferences=true (false by default) then only the reference is copied in assignments. More...
 
virtual List< IMatrixConstraintHessians [get, set]
 Constraint functions' Hessians (matrices of second derivatives). If CopyReferences=true (false by default) then only the list reference is copied in assignments. More...
 
virtual bool ReqObjective [get, set]
 Indicates whether calculation of objective function is/was requested. More...
 
virtual bool ReqObjectiveGradient [get, set]
 Indicates whether calculation of objective function gradient is/was requested. More...
 
virtual bool ReqObjectiveHessian [get, set]
 Indicates whether calculation of objective function Hessian is/was requested. More...
 
virtual bool ReqConstraints [get, set]
 Indicates whether calculation of constraint functions is/was requested. More...
 
virtual bool ReqConstraintGradients [get, set]
 Indicates whether calculation of constraint functions gradient is/was requested. More...
 
virtual bool ReqConstraintHessians [get, set]
 Indicates whether calculation of constraint functions Hessian is/was requested. More...
 
virtual int ErrorCode [get, set]
 Error code. 0 - everything is OK. negative value - something went wrong. More...
 
virtual String ErrorString [get, set]
 Error string indicating what went wrong. More...
 
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. More...
 
virtual bool CalculatedObjective [get, set]
 Indicates whether calculation of objective function is/was requested. More...
 
virtual bool CalculatedObjectiveGradient [get, set]
 Indicates whether calculation of objective function gradient is/was requested. More...
 
virtual bool CalculatedObjectiveHessian [get, set]
 Indicates whether calculation of objective function Hessian is/was requested. More...
 
virtual bool CalculatedConstraints [get, set]
 Indicates whether calculation of constraint functions is/was requested. More...
 
virtual bool CalculatedConstraintGradients [get, set]
 Indicates whether calculation of constraint functions gradient is/was requested. More...
 
virtual bool CalculatedConstraintHessians [get, set]
 Indicates whether calculation of constraint functions Hessian is/was requested. More...
 
- Properties inherited from IG.Num.IAnalysisResults
int NumParameters [get, set]
 Number of parameters. More...
 
int NumObjectives [get, set]
 Number of objective functions (normally 1 for this type, but can be 0). More...
 
int NumConstraints [get, set]
 Number of constraints. More...
 
int NumEqualityConstraints [get, set]
 Number of equality constraints. More...
 
bool CopyReferences [get, set]
 Indicates whether just references can be copied when setting optimization parameters or results. If false then deep copy is always be performed. Default is false. More...
 
IVector Parameters [get, set]
 Optimization parameters. If CopyReferences=true (false by default) then only the reference is copied when assigning. More...
 
double Objective [get, set]
 Value of the objective function. More...
 
IVector ObjectiveGradient [get, set]
 Objective function gradient. If CopyReferences=true (false by default) then only the reference is copied in assignments. More...
 
List< double > Constraints [get, set]
 Constraint function values. If CopyReferences=true (false by default) then only the list reference is copied in assignments. More...
 
List< IVectorConstraintGradients [get, set]
 Constraint function gradients. If CopyReferences=true (false by default) then only the list reference is copied in assignments. More...
 
IMatrix ObjectiveHessian [get, set]
 Objective function Hessian (matrix of second derivatives). If CopyReferences=true (false by default) then only the reference is copied in assignments. More...
 
List< IMatrixConstraintHessians [get, set]
 Constraint functions' Hessians (matrices of second derivatives). If CopyReferences=true (false by default) then only the list reference is copied in assignments. More...
 
bool ReqObjective [get, set]
 Indicates whether calculation of objective function is/was requested. More...
 
bool ReqObjectiveGradient [get, set]
 Indicates whether calculation of objective function gradient is/was requested. More...
 
bool ReqObjectiveHessian [get, set]
 Indicates whether calculation of objective function Hessian is/was requested. More...
 
bool ReqConstraints [get, set]
 Indicates whether calculation of constraint functions is/was requested. More...
 
bool ReqConstraintGradients [get, set]
 Indicates whether calculation of constraint functions gradient is/was requested. More...
 
bool ReqConstraintHessians [get, set]
 Indicates whether calculation of constraint functions Hessian is/was requested. More...
 
int ErrorCode [get, set]
 Error code. 0 - everything is OK. negative value - something went wrong. More...
 
String ErrorString [get, set]
 Error string indicating what went wrong. More...
 
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. More...
 
bool CalculatedObjective [get, set]
 Indicates whether calculation of objective function is/was requested. More...
 
bool CalculatedObjectiveGradient [get, set]
 Indicates whether calculation of objective function gradient is/was requested. More...
 
bool CalculatedObjectiveHessian [get, set]
 Indicates whether calculation of objective function Hessian is/was requested. More...
 
bool CalculatedConstraints [get, set]
 Indicates whether calculation of constraint functions is/was requested. More...
 
bool CalculatedConstraintGradients [get, set]
 Indicates whether calculation of constraint functions gradient is/was requested. More...
 
bool CalculatedConstraintHessians [get, set]
 Indicates whether calculation of constraint functions Hessian is/was requested. More...
 

Static Private Member Functions

static string ToStringMath (bool value)
 Returns a atring representation of a boolean value: "0" for false and "1" for true. More...
 
static void ReadAnalysisRequest (string filePath, ref IVector parameters, ref bool reqcalcobj, ref bool reqcalcconstr, ref bool reqcalcgradobj, ref bool reqcalcgradconstr, ref string cd)
 Read the analysis data from data file Format: { { p1, p2, … }, { reqcalcobj, reqcalcconstr, reqcalcgradobj, reqcalcgradconstr }, cd } More...
 
static void GetAnalysisRequest (string requestString, ref IVector parameters, ref bool reqcalcobj, ref bool reqcalcconstr, ref bool reqcalcgradobj, ref bool reqcalcgradconstr, ref string cd)
 Read the analysis request data from data file Format: { { p1, p2, … }, { reqcalcobj, reqcalcconstr, reqcalcgradobj, reqcalcgradconstr }, cd } More...
 
static void ReadAnalysisResult (string filePath, ref IVector parameters, ref bool calcobj, ref bool calcconstr, ref bool calcgradobj, ref bool calcgradconstr, ref double obj, ref IVector constr, ref IVector dobjdp, ref IVector[] dconstr, ref int errorcode, ref bool reqcalcobj, ref bool reqcalcconstr, ref bool reqcalcgradobj, ref bool reqcalcgradconstr)
 Read the analysis result data from data file Format: More...
 
static void GetAnalysisResult (string requestString, ref IVector parameters, ref bool calcobj, ref bool calcconstr, ref bool calcgradobj, ref bool calcgradconstr, ref double obj, ref IVector constr, ref IVector dobjdp, ref IVector[] dconstr, ref int errorcode, ref bool reqcalcobj, ref bool reqcalcconstr, ref bool reqcalcgradobj, ref bool reqcalcgradconstr)
 Read the analysis result data from data file Format: More...
 

Detailed Description

Single objective optimization analysis results. Used to transfer parameters input (e.g. vector of parameters, request flags) to the analysis function and to store analysis output results (e.g. objective and constraint functions, their gradients, error codes, and flags indicating what has actually been calculated). REMARKS: Property CopyReferences specifies whether only references are copied when individial object fields are assigned and set (when the property is true), or values are actually copied (when false - deep copy). Each setter method also has the variant that always copies only the reference (function name appended by "Reference"). This makes possible to avoid duplication of allocated data and also to avoid having different data with the same references. AGREEMENTS: Optimization problem is defined as minimize f(x), subject to: c_i(x) less or equal 0, i=0...NI-1 c_j(x)=0, j=NI...NI+NE-1. Here x is vector of parameters, f(x) is the objective function, and c_i(x) and c_j(c) are constraint functions. NI is number of inequality constraints and NE is number of equality constraints. If there are equality constraints then they are listed after inequality constraints.

$A Igor Jan08 Jun08;

Constructor & Destructor Documentation

IG.Num.AnalysisResults.AnalysisResults ( )
inline

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

IG.Num.AnalysisResults.AnalysisResults ( bool  reqGradients)
inline

1 parameter, no constraints, 1 objective function.

Parameters
reqGradientsWhether gradient of the objective function is required.
IG.Num.AnalysisResults.AnalysisResults ( int  numParameters)
inline

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

Parameters
numParametersNumber of parameters.
IG.Num.AnalysisResults.AnalysisResults ( int  numParameters,
bool  reqGradients 
)
inline

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

Parameters
numParametersNumber of parameters.
reqGradientsWhether gradients are requested.
IG.Num.AnalysisResults.AnalysisResults ( int  numParameters,
int  numConstraints 
)
inline

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

Parameters
numParametersNumber of parameters.
numConstraintsNumber of constraints.
IG.Num.AnalysisResults.AnalysisResults ( int  numParameters,
int  numConstraints,
bool  reqGradients 
)
inline

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

Parameters
numParametersNumber of parameters.
numConstraintsNumber of constraints.
reqGradientsWhether calcullation of gradients is required.

Member Function Documentation

virtual bool IG.Num.AnalysisResults.IsEqualityConstraint ( int  which)
inlinevirtual

Returns true if the specified constraint is an equality constraint, and false otherwise.

Parameters
whichIndex of constraint to determine the type.
Returns
True if the specified constraint is equality constraint, false otherwise.
virtual IVector IG.Num.AnalysisResults.GetParameters ( )
inlinevirtual

Returns vector of optimization parameters.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetParameters ( IVector  value)
inlinevirtual

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.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetParametersReference ( IVector  reference)
inlinevirtual

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

Parameters
referenceReference to be assigned.

Implements IG.Num.IAnalysisResults.

Referenced by IG.Num.AnalysisResults.CreateExample().

virtual double IG.Num.AnalysisResults.GetParameter ( int  index)
inlinevirtual

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

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

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetParameter ( int  index,
double  value 
)
inlinevirtual

Sets the specified optimization parameter.

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

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetObjective ( )
inlinevirtual

Returns the value of the objective function.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetObjective ( double  value)
inlinevirtual

Sets the value of the objective function.

Parameters
valueValue to be assigned to the objective function.

Implements IG.Num.IAnalysisResults.

virtual IVector IG.Num.AnalysisResults.GetObjectiveGradient ( )
inlinevirtual

Returns the objective function gradient.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetObjectiveGradient ( IVector  value)
inlinevirtual

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

Parameters
valueValue to be assigned.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetObjectiveGradientReference ( IVector  reference)
inlinevirtual

Sets the objective function gradient. Only the reference is copied.

Parameters
referenceReference to be assigned.

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetObjectiveGradient ( int  index)
inlinevirtual

Returns the specified component of the objective function gradient.

Parameters
indexIndex of the component.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetObjectiveGradient ( int  index,
double  value 
)
inlinevirtual

Sets the specified component of the objective function gradient.

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

Implements IG.Num.IAnalysisResults.

virtual List<double> IG.Num.AnalysisResults.GetConstraints ( )
inlinevirtual

Returns a list of constraint function values.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetConstraints ( List< double >  values)
inlinevirtual

Sets the list of constraint function values. If CopyReferences=true (false by default) then only the list reference is copied.

Parameters
valuesValues of constraint functions.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetConstraintsReference ( List< double >  reference)
inlinevirtual

Sets the list of constraint function values. Only the list reference is copied.

Parameters
referenceReference to be assigned.

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetConstraint ( int  which)
inlinevirtual

Returns the specified constraint function value.

Parameters
whichSpecifies which constraint function to return (counting from 0).

Implements IG.Num.IAnalysisResults.

Referenced by IG.Script.LoadableScriptShellNeuralBase.TestAnalysis().

virtual void IG.Num.AnalysisResults.SetConstraint ( int  which,
double  value 
)
inlinevirtual

Sets the specified constraint function value.

Parameters
whichSpecifies which constraint function is set (counting from 0).
valueAssigned value of the constraint function.

Implements IG.Num.IAnalysisResults.

virtual List<IVector> IG.Num.AnalysisResults.GetConstraintGradients ( )
inlinevirtual

Returns a list of constraint function gradients.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetConstraintGradients ( List< IVector values)
inlinevirtual

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

Parameters
valuesValue to be assigned.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetConstraintGradientsReference ( List< IVector reference)
inlinevirtual

Sets constraint function gradients. Only the list reference is copied.

Parameters
referenceReference to be assigned.

Implements IG.Num.IAnalysisResults.

virtual IVector IG.Num.AnalysisResults.GetConstraintGradient ( int  which)
inlinevirtual

Returns the gradient of the specified constraint function.

Parameters
whichSpecifies which constraint function to take (couonted from 0).

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetConstraintGradient ( int  which,
int  index 
)
inlinevirtual

Returns the specific constraint function gradient component.

Parameters
whichSpecifies which constraint function to take (couonted from 0).
indexSpecifies gradient component (conted form 0).

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetConstraintGradient ( int  which,
IVector  value 
)
inlinevirtual

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

Parameters
whichSpecifies which constraint function to take (couonted from 0).
valueValue of the gradient to be assigned.

Implements IG.Num.IAnalysisResults.

References IG.Num.IVector.GetCopy().

virtual void IG.Num.AnalysisResults.SetConstraintGradientReference ( int  which,
IVector  reference 
)
inlinevirtual

Sets the specified constraint function gradient. Only the reference is copied.

Parameters
whichSpecifies which constraint function to take (couonted from 0).
referenceGradient reference to be assigned.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetConstraintGradient ( int  which,
int  index,
double  value 
)
inlinevirtual

Sets the specified constraint fuction gradient component.

Parameters
whichSpecifies which constraint function to take (couonted from 0).
indexSpecified index of gradient coponent to be set.
valueValue to be assigned to the specified component.

Implements IG.Num.IAnalysisResults.

virtual IMatrix IG.Num.AnalysisResults.GetObjectiveHessian ( )
inlinevirtual

Returns the objective function's Hessian.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetObjectiveHessian ( IMatrix  value)
inlinevirtual

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

Parameters
valueValue to be assigned.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetObjectiveHessianReference ( IMatrix  reference)
inlinevirtual

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

Parameters
referenceReference to be assigned.

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetObjectiveHessian ( int  rowIndex,
int  columnIndex 
)
inlinevirtual

Returns the specified component of the objective function Hessian.

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

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetObjectiveHessian ( int  rowIndex,
int  columnIndex,
double  value 
)
inlinevirtual

Sets the specified component of the objective 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.IAnalysisResults.

virtual List<IMatrix> IG.Num.AnalysisResults.GetConstraintHessians ( )
inlinevirtual

Returns the list of constraint functions' Hessians.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetConstraintHessians ( List< IMatrix values)
inlinevirtual

Sets constraint functios' Hessians. If CopyReferences=true (false by default) then only the list reference is copied.

Parameters
valuesList of Hessians to be assigned.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetConstraintHessiansReference ( List< IMatrix reference)
inlinevirtual

Sets constraint functios' Hessians. Only the list reference is copied.

Parameters
referenceReference to be assigned.

Implements IG.Num.IAnalysisResults.

virtual IMatrix IG.Num.AnalysisResults.GetConstraintHessian ( int  which)
inlinevirtual

Returns Hessian of the specified constraint function.

Parameters
whichSpecifies which constraint function it applies to (counting from 0).

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetConstraintHessian ( int  which,
int  rowIndex,
int  columnIndex 
)
inlinevirtual

Returns the specified component of Hessian of the specified constraint function.

Parameters
whichSpecifies which constraint function it applies to (counting from 0).
rowIndexRow index of the component (counting from 0).
columnIndexColumn index of the component (counting from 0).

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetConstraintHessian ( int  which,
IMatrix  value 
)
inlinevirtual

Sets the specified constraint function's Hessian. If CopyReferences=true (false by default) then only the reference is copied.

Parameters
whichSpecifies which constraint function it applies to (counting from 0).
valueHessian matrix to be assigned.

Implements IG.Num.IAnalysisResults.

References IG.Num.IMatrix.GetCopy().

virtual void IG.Num.AnalysisResults.SetConstraintHessianReference ( int  which,
IMatrix  reference 
)
inlinevirtual

Sets the specified constraint function's Hessian. Only the reference is copied.

Parameters
whichSpecifies which constraint function it applies to (counting from 0).
referenceHessian matrix reference to be assigned.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetConstraintHessian ( int  which,
int  rowIndex,
int  columnIndex,
double  value 
)
inlinevirtual

Sets the specified component of the specified constraint's Hessian.

Parameters
whichSpecifies which constraint function it applies to (counting from 0).
rowIndexRow index of the component (counting from 0).
columnIndexColumn index of the component (counting from 0).
valueValue to which Hessian element is set.

Value to which Hessian element is set.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.NullifyAll ( )
inlinevirtual

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.IAnalysisResults.

virtual void IG.Num.AnalysisResults.NullifyResults ( )
inlinevirtual

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

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.AllocateParameters ( )
inlinevirtual

Allocates space for parameters.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.AllocateRequested ( )
inlinevirtual

Allocates space for all requested result objects.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.AllocateObjectiveGradient ( )
inlinevirtual

Allocate space for objective function gradient.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.AllocateObjectiveHessian ( )
inlinevirtual

Allocates space for objective function Hessian.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.AllocateConstraintsList ( )
inlinevirtual

Allocates space for list of constraint functions.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.AllocateConstraintGradientsList ( )
inlinevirtual

Allocates space for list of constraint function gradients.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.AllocateConstrainGradients ( )
inlinevirtual

Allocates space for constraint function gradients (including for the list, if necessarty).

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.AllocateConstraintGradient ( int  which)
inlinevirtual

Allocates space for the specified constraint function gradient.

Parameters
whichSpecifies which constraint function it applies to (countinf form 0).

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.AllocateConstraintHessiansList ( )
inlinevirtual

Allocates space for the list of constraint functions' Hessians.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.AllocateConstraintHessians ( )
inlinevirtual

Allocates space for constraint functions' Hessians (including space for the list, if necessary).

Implements IG.Num.IAnalysisResults.

References IG.Num.m.

virtual void IG.Num.AnalysisResults.AllocateConstraintHessian ( int  which)
inlinevirtual

Allocates space for the specified constraint fucnction's Hessian.

Parameters
whichSpecifies which constraint function it applies to (conting form 0).

Implements IG.Num.IAnalysisResults.

References IG.Num.m.

virtual void IG.Num.AnalysisResults.ResetResults ( )
inlinevirtual

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

Implements IG.Num.IAnalysisResults.

Referenced by IG.Num.OptFileManager.ServerAnalyse().

virtual void IG.Num.AnalysisResults.SetDimensions ( int  numParameters,
int  numConstraints 
)
inlinevirtual

Sets the dimension of the analysis results object according to the specified values.

Number of objective functions is set to 1.

Parameters
numParametersNumber of parameters.
numConstraintsNumber of constraints.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.SetDimensions ( int  numParameters,
int  numObjectives,
int  numConstraints 
)
inlinevirtual

Sets the dimension of the analysis results object according to the specified values.

Parameters
numParametersNumber of parameters.
numObjectivesNumber of objective functions.
numConstraintsNumber of constraints.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.PrepareResultStorage ( )
inlinevirtual

Prepares data storage for results (allocates the appropriate vectors, matrices, lists, etc.) according to the numbers of parameters, constraint functions, and request flags, and resets calculation flags to false.

Things whose calculation is not requested are not calculated.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.PrepareResultStorage ( bool  resetCalculatedFlags)
inlinevirtual

Prepares data storage for results (allocates the appropriate vectors, matrices, lists, etc.) according to the numbers of parameters, constraint functions, and request flags.

Things whose calculation is not requested are not calculated.

Parameters
resetCalculatedFlagsWhether the calculation flags are reset to false or not.

Implements IG.Num.IAnalysisResults.

References IG.Num.VectorBase.Resize(), and IG.Num.MatrixBase.Resize().

virtual void IG.Num.AnalysisResults.PrepareResultStorage ( int  numParameters,
int  numConstraints 
)
inlinevirtual

Prepares data storage for results (allocates the appropriate vectors, matrices, lists, etc.) according to the numbers of parameters, constraint functions, and request flags, and resets calculation flags to false.

This method also sets dimensions before preparing the storage (i.e. number of parameters and constraints while number of objective functions is set to 1).

Things whose calculation is not requested are not calculated.

Parameters
numParametersNumber of parameters.
numConstraintsNumber of constraints.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.PrepareResultStorage ( int  numParameters,
int  numObjectives,
int  numConstraints 
)
inlinevirtual

Prepares data storage for results (allocates the appropriate vectors, matrices, lists, etc.) according to the numbers of parameters, constraint functions, and request flags, and resets calculation flags to false.

This method also sets dimensions before preparing the storage (i.e. number of parameters, objective functions and constraints).

Things whose calculation is not requested are not calculated.

Parameters
numParametersNumber of parameters.
numObjectivesNumber of objective functions.
numConstraintsNumber of constraints.

Implements IG.Num.IAnalysisResults.

virtual void IG.Num.AnalysisResults.PrepareResultStorage ( int  numParameters,
int  numObjectives,
int  numConstraints,
bool  resetCalculatedFlags 
)
inlinevirtual

Prepares data storage for results (allocates the appropriate vectors, matrices, lists, etc.) according to the numbers of parameters, constraint functions, and request flags.

This method also sets dimensions before preparing the storage (i.e. number of parameters, objective functions and constraints).

Things whose calculation is not requested are not calculated.

Parameters
numParametersNumber of parameters.
numObjectivesNumber of objective functions.
numConstraintsNumber of constraints.
resetCalculatedFlagsWhether the calculation flags are reset to false or not.

Implements IG.Num.IAnalysisResults.

virtual IAnalysisResults IG.Num.AnalysisResults.GetCopy ( )
inlinevirtual

Returns an exact deep copy of the current object.

Implements IG.Num.IAnalysisResults.

References IG.Num.AnalysisResults.Copy().

virtual bool IG.Num.AnalysisResults.IsViolated ( int  which,
double  equalityTolerance 
)
inlinevirtual

Returns true if the specified constraint is violated according to the current analysis results, false otherwise.

Parameters
whichSpecifies the constraint in question.
equalityToleranceTolerance for violation of equality constraints. If constraint function corresponding to equality conatraint is less or equal than tolerance then the corresponding constraint is considered non-violated.
Returns
True if the constraint is violated, false if not. Constraint is violated when the corresponding constraint function is greater than 0.
Exceptions
IndexOutOfRangeExceptionwhen constraint index is smaller lesser than 0 or greater than the number of constraints.
InvalidOperationExceptionwhen constraints are not evaluated.

Implements IG.Num.IAnalysisResults.

virtual bool IG.Num.AnalysisResults.IsViolated ( int  which)
inlinevirtual

Returns true if the specified constraint is violated according to the current analysis results, false otherwise.

Parameters
whichSpecifies the constraint in question.
Returns
True if the constraint is violated, false if not. Constraint is violated when the corresponding constraint function is greater than 0.
Exceptions
IndexOutOfRangeExceptionwhen constraint index is smaller lesser than 0 or greater than the number of constraints.
InvalidOperationExceptionwhen constraints are not evaluated.

Implements IG.Num.IAnalysisResults.

virtual bool IG.Num.AnalysisResults.IsFeasible ( double  equalityTolerance)
inlinevirtual

Returns true if the current analysis results represent a feasible point. Feasible point is one where no constraints are violated. For unconstraint problems this method always returns true.

Returns
True if the current analysis results represent a feasible point, false otherwise.
Exceptions
InvalidOperationExceptionIf constraint optimization results do not contain evaluated constraint values.

Implements IG.Num.IAnalysisResults.

virtual bool IG.Num.AnalysisResults.IsFeasible ( )
inlinevirtual

Returns true if the current analysis results represent a feasible point. Feasible point is one where no constraints are violated. For unconstraint problems this method always returns true.

Returns
True if the current analysis results represent a feasible point, false otherwise.
Exceptions
InvalidOperationExceptionIf constraint optimization results do not contain evaluated constraint values.

Implements IG.Num.IAnalysisResults.

virtual int IG.Num.AnalysisResults.GetNumViolatedConstraints ( double  equalityTolerance)
inlinevirtual

Returns number of violated constraints in the current analysis results. Specific constraint is violated if the corresponding constraint function is greater than 0.

Parameters
equalityToleranceTolerance for violation of equality constraints. If constraint function corresponding to equality conatraint is less or equal than tolerance then the corresponding constraint is considered non-violated.
Exceptions
InvalidOperationExceptionIf constraint optimization results do not contain evaluated constraint values.

Implements IG.Num.IAnalysisResults.

virtual int IG.Num.AnalysisResults.GetNumViolatedConstraints ( )
inlinevirtual

Returns number of violated constraints in the current analysis results. Specific constraint is violated if the corresponding constraint function is greater than 0.

Exceptions
InvalidOperationExceptionIf constraint optimization results do not contain evaluated constraint values.

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetSumResiduals ( double  equalityTolerance)
inlinevirtual

Returns sum of constraint function values corresponding to violated constraints in the current analysis results. Specific constraint is violated if the corresponding constraint function is greater than 0.

Parameters
equalityToleranceTolerance for violation of equality constraints. If constraint function corresponding to equality conatraint is less or equal than tolerance then the corresponding constraint is considered non-violated.
Exceptions
InvalidOperationExceptionIf constraint optimization results do not contain evaluated constraint values.

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetSumResiduals ( )
inlinevirtual

Returns sum of constraint function values corresponding to violated constraints in the current analysis results. Specific constraint is violated if the corresponding constraint function is greater than 0.

Exceptions
InvalidOperationExceptionIf constraint optimization results do not contain evaluated constraint values.

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetMaximalResidual ( double  equalityTolerance)
inlinevirtual

Returns the largest constraint function value corresponding to any violated constraint in the current analysis results, or 0 if there are no violated constraints. Specific constraint is violated if the corresponding constraint function is greater than 0.

Parameters
equalityToleranceTolerance for violation of equality constraints. If constraint function corresponding to equality conatraint is less or equal than tolerance then the corresponding constraint is considered non-violated.
Exceptions
InvalidOperationExceptionIf constraint optimization results do not contain evaluated constraint values.

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetMaximalResidual ( )
inlinevirtual

Returns sum of constraint function values corresponding to violated constraints in the current analysis results. Specific constraint is violated if the corresponding constraint function is greater than 0.

Exceptions
InvalidOperationExceptionIf constraint optimization results do not contain evaluated constraint values.

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetPenaltyTerm ( int  which,
IPenaltyEvaluator  evaluator 
)
inlinevirtual

Returns value of the penalty term corresponding to the specified constraint, calculated by the specified penalty evaluator.

Parameters
whichSpecifies the constraint in question.
evaluatorPenalty function evaluator that evaluates penalty functions.

Implements IG.Num.IAnalysisResults.

References IG.Num.IPenaltyEvaluator.PenaltyValue().

virtual double IG.Num.AnalysisResults.GetSumPenaltyTerms ( IPenaltyEvaluator  evaluator)
inlinevirtual

Returns sum of the penalty terms corresponding to all constraint, calculated by the specified penalty evaluator.

Parameters
evaluatorPenalty function evaluator that evaluates penalty functions.

Implements IG.Num.IAnalysisResults.

virtual double IG.Num.AnalysisResults.GetMaxPenaltyTerm ( IPenaltyEvaluator  evaluator)
inlinevirtual

Returns sum of the penalty terms corresponding to all constraint, calculated by the specified penalty evaluator.

Parameters
evaluatorPenalty function evaluator that evaluates penalty functions.

Implements IG.Num.IAnalysisResults.

static string IG.Num.AnalysisResults.ToStringMath ( bool  value)
inlinestaticprivate

Returns a atring representation of a boolean value: "0" for false and "1" for true.

Parameters
valueValue whose string representation is returned.
Returns

Referenced by IG.Num.AnalysisResultsExtensions.ToStringMath().

static void IG.Num.AnalysisResults.AppendRequestFlagsMath ( StringBuilder  sb,
IAnalysisResults  anres 
)
inlinestaticprotected
static string IG.Num.AnalysisResults.ToString ( IAnalysisResults  anres)
inlinestatic

Returns a string representation of the specified analysis results object in a standard IGLib form.

Parameters
anresObject whose string representation is returned.

Referenced by IG.Script.LoadableScriptShellNeuralBase.TestAnalysis(), and IG.Num.AnalysisResultsExtensions.ToString().

static string IG.Num.AnalysisResults.ToStringRequestMath ( IAnalysisResults  anres)
inlinestatic

Returns a string representation of the specified analysis request object in a standard IGLib form (Mathematica-like format but with C representation of numbers).

Parameters
anresObject whose string representation is returned.

References IG.Num.IAnalysisResults.Parameters, and IG.Num.VectorBase.ToStringMath().

Referenced by IG.Num.AnalysisResultsExtensions.ToStringMathRequest().

static string IG.Num.AnalysisResults.ToStringMath ( IAnalysisResults  anres)
inlinestatic
static void IG.Num.AnalysisResults.LoadStringRequestMath ( string  requestString,
ref AnalysisResults  anres 
)
inlinestatic

Reads analysis request data.

Parameters
requestString
anres

$A Igor Mar11; Tako78 Apr11;

static void IG.Num.AnalysisResults.LoadStringMath ( string  analysisOutputString,
ref AnalysisResults  anres 
)
inlinestatic

Reads analysis results data.

Parameters
analysisOutputStringString from which data is read.
anresObject where results are stored.

$A Igor Mar11; Tako78 Apr11;

static void IG.Num.AnalysisResults.SaveRequestMath ( IAnalysisResults  anres,
string  filePath 
)
inlinestatic

Saves the specified analysis request to a file. If the file already exists then it is overwritten.

Parameters
anresObject from which analysis request is saved.
filePathPath to the file where analysis request is stored.

Referenced by IG.Num.AnalysisResultsExtensions.SaveRequestMath(), and IG.Num.OptFileManager.WriteAnalysisInputMath().

static void IG.Num.AnalysisResults.SaveRequestMath ( IAnalysisResults  anres,
string  filePath,
bool  append 
)
inlinestatic

Saves the specified analysis request to a file.

Parameters
anresObject from which analysis request is saved.
filePathPath to the file where analysis request is stored.
appendIf true then contents are appended to the end of the file if the file already exists.
static void IG.Num.AnalysisResults.SaveMath ( IAnalysisResults  anres,
string  filePath 
)
inlinestatic

Saves the specified analysis results to a file. If the file already exists then it is overwritten.

Parameters
anresObject from which analysis results are saved.
filePathPath to the file where analysis results are stored.

Referenced by IG.Num.AnalysisResultsExtensions.SaveMath(), and IG.Num.OptFileManager.WriteAnalysisOutputMath().

static void IG.Num.AnalysisResults.SaveMath ( IAnalysisResults  anres,
string  filePath,
bool  append 
)
inlinestatic

Saves the specified analysis results to a file.

Parameters
anresObject from which analysis results are saved.
filePathPath to the file where analysis results are stored.
appendIf true then contents are appended to the end of the file if the file already exists.
static void IG.Num.AnalysisResults.LoadRequestMath ( string  filePath,
ref AnalysisResults  anResults 
)
inlinestatic

Loads analysis request data from a file in standard mathematical format and stores it in the specified analysis results object.

Parameters
filePathPath to the file from which object is read.
anResultsObject where data is stored.

Referenced by IG.Num.OptFileManager.ReadAnalysisInputMath().

static void IG.Num.AnalysisResults.LoadMath ( string  filePath,
ref AnalysisResults  anResults 
)
inlinestatic

Loads analysis results from a file in standard mathematical format and stores it in the specified analysis results object.

Parameters
filePathPath to the file from which object is read.
anResultsObject where data is stored.

Referenced by IG.Num.OptFileManager.ReadAnalysisOutputMath().

static void IG.Num.AnalysisResults.SaveRequestJson ( AnalysisResults  anResulsts,
string  filePath 
)
inlinestatic

Saves (serializes) the specified analysis request to the specified JSON file. File is owerwritten if it exists.

Parameters
anResulstsObject that is saved to a file.
filePathPath to the file in which object is is saved.
static void IG.Num.AnalysisResults.SaveRequestJson ( AnalysisResults  anResults,
string  filePath,
bool  append 
)
inlinestatic

Saves (serializes) the specified analysis request to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag.

Parameters
anResultsObject that is saved to a file.
filePathPath to the file in which object is is saved.
appendSpecifies whether serialized data is appended at the end of the file in the case that the file already exists.
static void IG.Num.AnalysisResults.LoadRequestJson ( string  filePath,
ref AnalysisResults  anResultsRestored 
)
inlinestatic

Restores (deserializes) analysis request from the specified file in JSON format.

Parameters
filePathFile from which object is restored.
anResultsRestoredObject that is restored by deserialization.
static void IG.Num.AnalysisResults.SaveJson ( AnalysisResults  anResulsts,
string  filePath 
)
inlinestatic

Saves (serializes) the specified analysis results to the specified JSON file. File is owerwritten if it exists.

Parameters
anResulstsObject that is saved to a file.
filePathPath to the file in which object is is saved.

Referenced by IG.Num.OptFileManager.ClientTestCalculateAnalysisResults().

static void IG.Num.AnalysisResults.SaveJson ( AnalysisResults  anResults,
string  filePath,
bool  append 
)
inlinestatic

Saves (serializes) the specified analysis results to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag.

Parameters
anResultsObject that is saved to a file.
filePathPath to the file in which object is is saved.
appendSpecifies whether serialized data is appended at the end of the file in the case that the file already exists.
static void IG.Num.AnalysisResults.LoadJson ( string  filePath,
ref AnalysisResults  anResultsRestored 
)
inlinestatic

Restores (deserializes) analysis results from the specified file in JSON format.

Parameters
filePathFile from which object is restored.
anResultsRestoredObject that is restored by deserialization.
static void IG.Num.AnalysisResults.ReadAnalysisRequest ( string  filePath,
ref IVector  parameters,
ref bool  reqcalcobj,
ref bool  reqcalcconstr,
ref bool  reqcalcgradobj,
ref bool  reqcalcgradconstr,
ref string  cd 
)
inlinestaticprivate

Read the analysis data from data file Format: { { p1, p2, … }, { reqcalcobj, reqcalcconstr, reqcalcgradobj, reqcalcgradconstr }, cd }

Parameters
filePathPath to the file where training data are saved.
parametersInput and output parameters: { p1, p2, … }.
reqcalcobjFlag: reqcalcobj.
reqcalcconstrFlag: reqcalcconstr.
reqcalcgradobjFlag: reqcalcgradobj.
reqcalcgradconstrFlag: reqcalcgradconstr.
cdString: cd.

$A Tako78 Mar11;

static void IG.Num.AnalysisResults.GetAnalysisRequest ( string  requestString,
ref IVector  parameters,
ref bool  reqcalcobj,
ref bool  reqcalcconstr,
ref bool  reqcalcgradobj,
ref bool  reqcalcgradconstr,
ref string  cd 
)
inlinestaticprivate

Read the analysis request data from data file Format: { { p1, p2, … }, { reqcalcobj, reqcalcconstr, reqcalcgradobj, reqcalcgradconstr }, cd }

Parameters
requestStringString with request analysis data.
parametersInput and output parameters: { p1, p2, … }.
reqcalcobjFlag: reqcalcobj.
reqcalcconstrFlag: reqcalcconstr.
reqcalcgradobjFlag: reqcalcgradobj.
reqcalcgradconstrFlag: reqcalcgradconstr.
cdString: cd.

$A Tako78 Mar11;

References IG.Lib.UtilStr.ToBoolean().

static void IG.Num.AnalysisResults.ReadAnalysisResult ( string  filePath,
ref IVector  parameters,
ref bool  calcobj,
ref bool  calcconstr,
ref bool  calcgradobj,
ref bool  calcgradconstr,
ref double  obj,
ref IVector  constr,
ref IVector  dobjdp,
ref IVector[]  dconstr,
ref int  errorcode,
ref bool  reqcalcobj,
ref bool  reqcalcconstr,
ref bool  reqcalcgradobj,
ref bool  reqcalcgradconstr 
)
inlinestaticprivate

Read the analysis result data from data file Format:

Parameters
filePathPath to the file where training data are saved.
parametersInput and output parameters: { p1, p2, … }.
calcobjFlag for the objective function.
calcconstrFlag for constraint functions.
calcgradobjGradient of the objective function.
calcgradconstrGradients of constraint functions.
objValue of the objective functions.
constrValues of the constraint functions.
dobjdpDerivatives of the objective function.
dconstrDerivatives of individual constraint functions.
errorcodeInteger error code of analysis.
reqcalcobjFlag for calculation of the various values.
reqcalcconstrFlag for calculation of the various values.
reqcalcgradobjFlag for calculation of the various values.
reqcalcgradconstrFlag for calculation of the various values.

$A Tako78 Apr11;

static void IG.Num.AnalysisResults.GetAnalysisResult ( string  requestString,
ref IVector  parameters,
ref bool  calcobj,
ref bool  calcconstr,
ref bool  calcgradobj,
ref bool  calcgradconstr,
ref double  obj,
ref IVector  constr,
ref IVector  dobjdp,
ref IVector[]  dconstr,
ref int  errorcode,
ref bool  reqcalcobj,
ref bool  reqcalcconstr,
ref bool  reqcalcgradobj,
ref bool  reqcalcgradconstr 
)
inlinestaticprivate

Read the analysis result data from data file Format:

Parameters
requestStringString with result analysis data.
parametersInput and output parameters: { p1, p2, … }.
calcobjFlag for the objective function.
calcconstrFlag for constraint functions.
calcgradobjGradient of the objective function.
calcgradconstrGradients of constraint functions.
objValue of the objective functions.
constrValues of the constraint functions.
dobjdpDerivatives of the objective function.
dconstrDerivatives of individual constraint functions.
errorcodeInteger error code of analysis.
reqcalcobjFlag for calculation of the various values.
reqcalcconstrFlag for calculation of the various values.
reqcalcgradobjFlag for calculation of the various values.
reqcalcgradconstrFlag for calculation of the various values.

$A Tako78 Apr11;

References IG.Lib.UtilStr.ToBoolean().

override string IG.Num.AnalysisResults.ToString ( )
inline

Returns a string representation of the current analysis results object in a standard IGLib form.

string IG.Num.AnalysisResults.ToStringMath ( )
inline

Returns a string representation of the current analysis results object in a standard IGLib form (Mathematica-like format but with C representation of numbers).

static AnalysisResults IG.Num.AnalysisResults.CreateExample ( int  numParameters,
int  numConstraints,
bool  reqObjective,
bool  reqConstraints,
bool  reqObjectiveGradient,
bool  reqConstraintGradients,
bool  reqObjectiveHessian,
bool  reqConstraintHessians 
)
inlinestatic

Creates an example analysis results object according to parameters, with some arbitrary result components.

Parameters
numParametersNumber of prameters of the optimization problem.
numConstraintsNumber of constraints.
reqObjectiveWhether calculation of the objective function is required.
reqConstraintsWhether calculation of constraint functions is required.
reqObjectiveGradientWhether calculation of objective gradient is required.
reqConstraintGradientsWhether calculation of constraint gradients is required.
reqObjectiveHessianWhether calculation of objective Hessian is required.
reqConstraintHessiansWhether calculation of constraint Hessians is required.

References IG.Num.VectorBase.Add(), IG.Num.AnalysisResults.CalculatedConstraintGradients, IG.Num.AnalysisResults.CalculatedConstraintHessians, IG.Num.AnalysisResults.CalculatedConstraints, IG.Num.AnalysisResults.CalculatedObjective, IG.Num.AnalysisResults.CalculatedObjectiveGradient, IG.Num.AnalysisResults.CalculatedObjectiveHessian, IG.Num.AnalysisResults.ConstraintGradients, IG.Num.AnalysisResults.ConstraintHessians, IG.Num.AnalysisResults.Constraints, IG.Num.AnalysisResults.NumConstraints, IG.Num.AnalysisResults.NumObjectives, IG.Num.AnalysisResults.NumParameters, IG.Num.AnalysisResults.Objective, IG.Num.AnalysisResults.ObjectiveGradient, IG.Num.AnalysisResults.ObjectiveHessian, IG.Num.AnalysisResults.ReqConstraintGradients, IG.Num.AnalysisResults.ReqConstraintHessians, IG.Num.AnalysisResults.ReqConstraints, IG.Num.AnalysisResults.ReqObjective, IG.Num.AnalysisResults.ReqObjectiveGradient, IG.Num.AnalysisResults.ReqObjectiveHessian, and IG.Num.AnalysisResults.SetParametersReference().

Referenced by IG.Lib.SerializerBase.TestSerializationAll().

Member Data Documentation

int IG.Num.AnalysisResults._numParameters = 0
protected
int IG.Num.AnalysisResults._numObjectives = 1
protected
int IG.Num.AnalysisResults._numConstraints = 0
protected
int IG.Num.AnalysisResults._numEqualityConstraints = 0
protected
IVector IG.Num.AnalysisResults._parameters
protected
double IG.Num.AnalysisResults._objective
protected
IVector IG.Num.AnalysisResults._objectiveGradient
protected
IMatrix IG.Num.AnalysisResults._objectiveHessian
protected
List<double> IG.Num.AnalysisResults._constraints
protected
List<IVector> IG.Num.AnalysisResults._constraintGradients
protected
List<IMatrix> IG.Num.AnalysisResults._constraintHessians
protected
bool IG.Num.AnalysisResults._copyReferences = false
protected
bool IG.Num.AnalysisResults._reqObjective = false
protected
bool IG.Num.AnalysisResults._reqConstraints = false
protected
bool IG.Num.AnalysisResults._reqObjectiveGradient = false
protected
bool IG.Num.AnalysisResults._reqConstraintGradients = false
protected
bool IG.Num.AnalysisResults._reqObjectiveHessian = false
protected
bool IG.Num.AnalysisResults._reqConstraintHessians = false
protected
int IG.Num.AnalysisResults._errorCode = 0
protected
string IG.Num.AnalysisResults._errorString = null
protected
bool IG.Num.AnalysisResults._calcObjective = false
protected
bool IG.Num.AnalysisResults._calcConstraints = false
protected
bool IG.Num.AnalysisResults._calcObjectiveGradient = false
protected
bool IG.Num.AnalysisResults._calcConstraintGradients = false
protected
bool IG.Num.AnalysisResults._calcObjectiveHessian = false
protected
bool IG.Num.AnalysisResults._calcConstraintHessians = false
protected

Property Documentation

virtual int IG.Num.AnalysisResults.NumParameters
getset
virtual int IG.Num.AnalysisResults.NumObjectives
getset

Number of objective functions (normally 1 for this type, but can be 0).

Referenced by IG.Num.AnalysisRequestDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual int IG.Num.AnalysisResults.NumConstraints
getset
virtual int IG.Num.AnalysisResults.NumEqualityConstraints
getset

Number of equality constraints.

Referenced by IG.Num.AnalysisRequestDto.CopyFromPlain().

virtual int IG.Num.AnalysisResults.NumInequalityConstraints
get

Returns number of inequality constraints.

virtual bool IG.Num.AnalysisResults.CopyReferences
getset

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

virtual IVector IG.Num.AnalysisResults.Parameters
getset

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

Referenced by IG.Num.OptFileManager.ClientTestCalculateAnalysisResults(), IG.Num.AnalysisRequestDto.CopyFromPlain(), and IG.Script.LoadableScriptShellNeuralBase.TestAnalysis().

virtual double IG.Num.AnalysisResults.Objective
getset
virtual IVector IG.Num.AnalysisResults.ObjectiveGradient
getset

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

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual List<double> IG.Num.AnalysisResults.Constraints
getset

Constraint function values. If CopyReferences=true (false by default) then only the list reference is copied in assignments.

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual List<IVector> IG.Num.AnalysisResults.ConstraintGradients
getset

Constraint function gradients. If CopyReferences=true (false by default) then only the list reference is copied in assignments.

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual IMatrix IG.Num.AnalysisResults.ObjectiveHessian
getset

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

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual List<IMatrix> IG.Num.AnalysisResults.ConstraintHessians
getset

Constraint functions' Hessians (matrices of second derivatives). If CopyReferences=true (false by default) then only the list reference is copied in assignments.

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual bool IG.Num.AnalysisResults.ReqObjective
getset
virtual bool IG.Num.AnalysisResults.ReqObjectiveGradient
getset

Indicates whether calculation of objective function gradient is/was requested.

Referenced by IG.Num.OptFileManager.ClientTestCalculateAnalysisResults(), IG.Num.AnalysisRequestDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual bool IG.Num.AnalysisResults.ReqObjectiveHessian
getset

Indicates whether calculation of objective function Hessian is/was requested.

Referenced by IG.Num.AnalysisRequestDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual bool IG.Num.AnalysisResults.ReqConstraints
getset

Indicates whether calculation of constraint functions is/was requested.

Referenced by IG.Num.OptFileManager.ClientTestCalculateAnalysisResults(), IG.Num.AnalysisRequestDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual bool IG.Num.AnalysisResults.ReqConstraintGradients
getset

Indicates whether calculation of constraint functions gradient is/was requested.

Referenced by IG.Num.OptFileManager.ClientTestCalculateAnalysisResults(), IG.Num.AnalysisRequestDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual bool IG.Num.AnalysisResults.ReqConstraintHessians
getset

Indicates whether calculation of constraint functions Hessian is/was requested.

Referenced by IG.Num.AnalysisRequestDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual int IG.Num.AnalysisResults.ErrorCode
getset

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

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain().

virtual String IG.Num.AnalysisResults.ErrorString
getset

Error string indicating what went wrong.

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain().

virtual bool IG.Num.AnalysisResults.Calculated
getset

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 IG.Num.AnalysisResults.CalculatedObjective
getset

Indicates whether calculation of objective function is/was requested.

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual bool IG.Num.AnalysisResults.CalculatedObjectiveGradient
getset

Indicates whether calculation of objective function gradient is/was requested.

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual bool IG.Num.AnalysisResults.CalculatedObjectiveHessian
getset

Indicates whether calculation of objective function Hessian is/was requested.

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual bool IG.Num.AnalysisResults.CalculatedConstraints
getset

Indicates whether calculation of constraint functions is/was requested.

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual bool IG.Num.AnalysisResults.CalculatedConstraintGradients
getset

Indicates whether calculation of constraint functions gradient is/was requested.

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().

virtual bool IG.Num.AnalysisResults.CalculatedConstraintHessians
getset

Indicates whether calculation of constraint functions Hessian is/was requested.

Referenced by IG.Num.AnalysisResultsDto.CopyFromPlain(), and IG.Num.AnalysisResults.CreateExample().


The documentation for this class was generated from the following file: