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

Evaluation of penalty functions. More...

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

Public Member Functions

 PenaltyEvaluator ()
 Constructs non-initialized penalty evaluator (wihout any penlaty functions). WARNING: Crated penalty evaluator is not initialized and can not be used for evaluation of penalty terms right away. More...
 
 PenaltyEvaluator (double barrierLength, double barrierHeight)
 Constructs penalty evaluator with penalty function (common for all constraints) initialized to the default penalty function with specified characteristic barrier length and height. More...
 
 PenaltyEvaluator (double barrierLength, double barrierHeight, double maxZero)
 Construct penalty evaluator with penalty function (common for all constraints) initialized to the default penalty function with specified characteristic barrier length and height and transition point where penalty function becomes non-zero. More...
 
void SetPenaltyFunction (int which, IRealFunctionPenalty function)
 Sets the penalty function used for evaluation of the specified penalty term. More...
 
void SetPenaltyFunction (int which, double barrierLength, double barrierHeight)
 Sets the penalty function used for evaluation of the specified penalty term. More...
 
void SetPenaltyFunction (int which, double barrierLength, double barrierHeight, double zeroEnd)
 Sets the penalty function used for evaluation of the specified penalty term. More...
 
virtual bool CanSetBarrierLength (int which)
 Returns a flag that tells whether characteristic barrier length can be set for the penalty function of the specified constraint. More...
 
virtual bool CansetBarrierHeight (int which)
 Returns a flag that tells whether characteristic barrier height can be set for the penalty function of the specified constraint. More...
 
virtual bool CanSetMaxZero (int which)
 Returns a flag that tells whether maxmal argument where function is zero can be set for the penalty function of the specified constraint. More...
 
int AddPenaltyFunction (IRealFunctionPenalty func)
 Adds a new penalty function for evaluation of penalty terms to the list. More...
 
IRealFunctionPenalty GetPenaltyFunction (int which)
 Returns penalty function corresonding to the specified constraint. More...
 
bool IsPenaltyValueDefined (int which)
 Returns true if the penalty function value can be calculated for the specified constraint, or false otherwise. More...
 
bool IsPenaltyDerivativeDefined (int which)
 Returns true if the penalty function derivative can be calculated for the specified constraint, or false otherwise. More...
 
bool IsPenaltySecodDerivativeDefined (int which)
 Returns true if the penalty function's second can be calculated for the specified constraint, or false otherwise. More...
 
double PenaltyValue (int which, double constraintFunctionValue)
 Returns value of the penalty function for the specified constraint at the specified value of the corresponding constraint function. More...
 
double PenaltyDerivative (int which, double constraintFunctionValue)
 Returns derivative of the penalty function for the specified constraint at the specified value of the corresponding constraint function, with respect to constraint value. More...
 
double PenaltySecondDerivative (int which, double constraintFunctionValue)
 Returns second derivative of the penalty function for the specified constraint at the specified value of the corresponding constraint function, with respect to constraint value. More...
 

Protected Member Functions

virtual IRealFunctionPenalty CreatePenaltyFunction (double barrierLength, double barrierHeight)
 Creates a new penalty function with the specified characteristic length and height. Created function is power penalty function of power 3. This is used in order to create default penalty functions for this class, such that one does not need to create penalty functions explicitly. Subclasses can (should) override this method in orde to change the type of default penalty function. More...
 
virtual IRealFunctionPenalty CreatePenaltyFunction (double barrierLength, double barrierHeight, double zeroEnd, int power)
 Creates a new penalty function with the specified characteristic length and height. Created function is power penalty function of power 3. This is used in order to create default penalty functions for this class, such that one does not need to create penalty functions explicitly. Subclasses can (should) override this method in orde to change the type of default penalty function. More...
 

Protected Attributes

object _lock = new object()
 
bool _allowSingleFunction = true
 
List< IRealFunctionPenalty_penaltyFunctions = null
 

Properties

object Lock [get]
 Object used for thread locking the current object. More...
 
bool AllowSingleFunction [get, set]
 Whether a single function can be used for evaluating penalty terms corresponding to different constraints. More...
 
List< IRealFunctionPenaltyPenaltyFunctions [get]
 Returns a list of penalty functions used to evaluate penalty terms. More...
 
- Properties inherited from IG.Num.IPenaltyEvaluator
bool AllowSingleFunction [get, set]
 Whether a single function can be used for evaluating penalty terms corresponding to different constraints. More...
 
List< IRealFunctionPenaltyPenaltyFunctions [get]
 Returns a list of penalty functions used to evaluate penalty terms. More...
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 

Detailed Description

Evaluation of penalty functions.

$A Igor Jul10;

Constructor & Destructor Documentation

IG.Num.PenaltyEvaluator.PenaltyEvaluator ( )
inline

Constructs non-initialized penalty evaluator (wihout any penlaty functions). WARNING: Crated penalty evaluator is not initialized and can not be used for evaluation of penalty terms right away.

IG.Num.PenaltyEvaluator.PenaltyEvaluator ( double  barrierLength,
double  barrierHeight 
)
inline

Constructs penalty evaluator with penalty function (common for all constraints) initialized to the default penalty function with specified characteristic barrier length and height.

Parameters
barrierLengthCharacteristic barrrier length. Within this length the created penalty function grows approximately from 0 to characteristic height.
barrierHeightCharacteristic barrier height.
IG.Num.PenaltyEvaluator.PenaltyEvaluator ( double  barrierLength,
double  barrierHeight,
double  maxZero 
)
inline

Construct penalty evaluator with penalty function (common for all constraints) initialized to the default penalty function with specified characteristic barrier length and height and transition point where penalty function becomes non-zero.

Parameters
barrierLengthCharacteristic barrrier length. Within this length the created penalty function grows approximately from 0 to characteristic height.
barrierHeightCharacteristic barrier height.
maxZeroMaximal argument for which the created function is 0.

Member Function Documentation

virtual IRealFunctionPenalty IG.Num.PenaltyEvaluator.CreatePenaltyFunction ( double  barrierLength,
double  barrierHeight 
)
inlineprotectedvirtual

Creates a new penalty function with the specified characteristic length and height. Created function is power penalty function of power 3. This is used in order to create default penalty functions for this class, such that one does not need to create penalty functions explicitly. Subclasses can (should) override this method in orde to change the type of default penalty function.

Parameters
barrierLengthCharacteristic barrrier length. Within this length the created penalty function grows approximately from 0 to characteristic height.
barrierHeightCharacteristic height.
Returns
Created penalty function.

References IG.Num.Func.GetPenaltyPower().

virtual IRealFunctionPenalty IG.Num.PenaltyEvaluator.CreatePenaltyFunction ( double  barrierLength,
double  barrierHeight,
double  zeroEnd,
int  power 
)
inlineprotectedvirtual

Creates a new penalty function with the specified characteristic length and height. Created function is power penalty function of power 3. This is used in order to create default penalty functions for this class, such that one does not need to create penalty functions explicitly. Subclasses can (should) override this method in orde to change the type of default penalty function.

Parameters
barrierLengthCharacteristic barrrier length. Within this length the created penalty function grows approximately from 0 to characteristic height.
barrierHeightCharacteristic height.
zeroEndMaximal argument for which the created function is 0.
powerPower. Must be greater than 0. For 2 first derivative is continuous in transition points, for 3 second derivative is also continuous, etc.
Returns
Created penalty function.

References IG.Num.Func.GetPenaltyPower().

void IG.Num.PenaltyEvaluator.SetPenaltyFunction ( int  which,
IRealFunctionPenalty  function 
)
inline

Sets the penalty function used for evaluation of the specified penalty term.

Parameters
whichSpecifies which conatraint the penalty function applies to (zero based). In order to use one penalty function for all constraints, just set the penalty function with index 0.
functionFunction to be used for evaluation of the specified penalty term.

Implements IG.Num.IPenaltyEvaluator.

void IG.Num.PenaltyEvaluator.SetPenaltyFunction ( int  which,
double  barrierLength,
double  barrierHeight 
)
inline

Sets the penalty function used for evaluation of the specified penalty term.

Parameters
whichSpecifies which conatraint the penalty function applies to (zero based). In order to use one penalty function for all constraints, just set the penalty function with index 0.
barrierLengthCharacteristic barrier length of the created function. This is the length at which function grows from approximately 0 to characteristic height.
barrierHeightCharacteristic barrier height of the created function.

Implements IG.Num.IPenaltyEvaluator.

References IG.Num.IRealFunctionPenalty.BarrierHeight, IG.Num.IRealFunctionPenalty.BarrierLength, IG.Num.IRealFunctionPenalty.CanSetBarrierHeight, and IG.Num.IRealFunctionPenalty.CanSetBarrierLength.

void IG.Num.PenaltyEvaluator.SetPenaltyFunction ( int  which,
double  barrierLength,
double  barrierHeight,
double  zeroEnd 
)
inline

Sets the penalty function used for evaluation of the specified penalty term.

Parameters
whichSpecifies which conatraint the penalty function applies to (zero based). In order to use one penalty function for all constraints, just set the penalty function with index 0.
barrierLengthCharacteristic barrier length of the created function. This is the length at which function grows from approximately 0 to characteristic height.
barrierHeightCharacteristic barrier height of the created function.
zeroEndMaximal argumet for which penalty function is still 0.

Implements IG.Num.IPenaltyEvaluator.

References IG.Num.IRealFunctionPenalty.BarrierHeight, IG.Num.IRealFunctionPenalty.BarrierLength, IG.Num.IRealFunctionPenalty.CanSetBarrierHeight, IG.Num.IRealFunctionPenalty.CanSetBarrierLength, IG.Num.IRealFunctionPenalty.CanSetMaxZero, and IG.Num.IRealFunctionPenalty.MaxZero.

virtual bool IG.Num.PenaltyEvaluator.CanSetBarrierLength ( int  which)
inlinevirtual

Returns a flag that tells whether characteristic barrier length can be set for the penalty function of the specified constraint.

Parameters
whichSpecified the constraiint in question.

Implements IG.Num.IPenaltyEvaluator.

References IG.Num.IRealFunctionPenalty.CanSetBarrierLength.

virtual bool IG.Num.PenaltyEvaluator.CansetBarrierHeight ( int  which)
inlinevirtual

Returns a flag that tells whether characteristic barrier height can be set for the penalty function of the specified constraint.

Parameters
whichSpecified the constraiint in question.

Implements IG.Num.IPenaltyEvaluator.

References IG.Num.IRealFunctionPenalty.CanSetBarrierHeight.

virtual bool IG.Num.PenaltyEvaluator.CanSetMaxZero ( int  which)
inlinevirtual

Returns a flag that tells whether maxmal argument where function is zero can be set for the penalty function of the specified constraint.

Parameters
whichSpecified the constraiint in question.

Implements IG.Num.IPenaltyEvaluator.

References IG.Num.IRealFunctionPenalty.CanSetMaxZero.

int IG.Num.PenaltyEvaluator.AddPenaltyFunction ( IRealFunctionPenalty  func)
inline

Adds a new penalty function for evaluation of penalty terms to the list.

Parameters
funcFunction to be added.
Returns
Index of the added penalty function (0 if this is the first function on the list).

Implements IG.Num.IPenaltyEvaluator.

IRealFunctionPenalty IG.Num.PenaltyEvaluator.GetPenaltyFunction ( int  which)
inline

Returns penalty function corresonding to the specified constraint.

Parameters
whichIndex of penalty function (or the corresponding constraint).

Implements IG.Num.IPenaltyEvaluator.

bool IG.Num.PenaltyEvaluator.IsPenaltyValueDefined ( int  which)
inline

Returns true if the penalty function value can be calculated for the specified constraint, or false otherwise.

Parameters
whichSpecifies the constraint in question.

Implements IG.Num.IPenaltyEvaluator.

bool IG.Num.PenaltyEvaluator.IsPenaltyDerivativeDefined ( int  which)
inline

Returns true if the penalty function derivative can be calculated for the specified constraint, or false otherwise.

Parameters
whichSpecifies the constraint in question.

Implements IG.Num.IPenaltyEvaluator.

bool IG.Num.PenaltyEvaluator.IsPenaltySecodDerivativeDefined ( int  which)
inline

Returns true if the penalty function's second can be calculated for the specified constraint, or false otherwise.

Parameters
whichSpecifies the constraint in question.

Implements IG.Num.IPenaltyEvaluator.

double IG.Num.PenaltyEvaluator.PenaltyValue ( int  which,
double  constraintFunctionValue 
)
inline

Returns value of the penalty function for the specified constraint at the specified value of the corresponding constraint function.

Parameters
whichSpecifies the constraint in question.
constraintFunctionValueValue of constraint function.

Implements IG.Num.IPenaltyEvaluator.

double IG.Num.PenaltyEvaluator.PenaltyDerivative ( int  which,
double  constraintFunctionValue 
)
inline

Returns derivative of the penalty function for the specified constraint at the specified value of the corresponding constraint function, with respect to constraint value.

Parameters
whichSpecifies the constraint in question.
constraintFunctionValueValue of constraint function.

Implements IG.Num.IPenaltyEvaluator.

double IG.Num.PenaltyEvaluator.PenaltySecondDerivative ( int  which,
double  constraintFunctionValue 
)
inline

Returns second derivative of the penalty function for the specified constraint at the specified value of the corresponding constraint function, with respect to constraint value.

Parameters
whichSpecifies the constraint in question.
constraintFunctionValueValue of constraint function.

Implements IG.Num.IPenaltyEvaluator.

Member Data Documentation

object IG.Num.PenaltyEvaluator._lock = new object()
protected
bool IG.Num.PenaltyEvaluator._allowSingleFunction = true
protected
List<IRealFunctionPenalty> IG.Num.PenaltyEvaluator._penaltyFunctions = null
protected

Property Documentation

object IG.Num.PenaltyEvaluator.Lock
get

Object used for thread locking the current object.

bool IG.Num.PenaltyEvaluator.AllowSingleFunction
getset

Whether a single function can be used for evaluating penalty terms corresponding to different constraints.

List<IRealFunctionPenalty> IG.Num.PenaltyEvaluator.PenaltyFunctions
get

Returns a list of penalty functions used to evaluate penalty terms.


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