Main Page Namespace List Class Hierarchy Alphabetical List Compound List Namespace Members Compound Members Related Pages
ObjCryst::Restraint Class Reference
Restraint: generic class defining both hard (constraints) and soft (restraints) limits associated with a RefinableObj.
More...
#include <RefinableObj.h>
Inheritance diagram for ObjCryst::Restraint::
List of all members.
Public Methods |
| Restraint (const RefParType *type, const REAL hardMin, const REAL hardMax, const bool hasMinLimit, const bool hasMaxLimit, const REAL softRange, const REAL restraintWeigth=1, const bool enableRestraint=false) |
| Constructor for the base Restrain class, setting hard&soft limits. More...
|
virtual | ~Restraint () |
| Destructor.
|
void | Init (const RefParType *type, const REAL hardMin, const REAL hardMax, const bool hasMinLimit, const bool hasMaxLimit, const REAL softRange, const REAL restraintWeigth=1, const bool enableRestraint=false) |
| Initializer for the base Restrain class, setting hard&soft limits. More...
|
virtual REAL | GetValue () const=0 |
| Get the current value.
|
virtual REAL | GetRestraintCost (const REAL looseness=1.) const |
| Get the value of the penalty (cost) associated to the restraint. More...
|
Protected Attributes |
const RefParType * | mpRefParType |
| Type of value constrained/restrained.
|
REAL | mMin |
| Hard lower and upper limits.
|
REAL | mMax |
| Hard lower and upper limits.
|
bool | mHasMin |
| Has lower and/or upper limits ?
|
bool | mHasMax |
| Has lower and/or upper limits ?
|
REAL | mRestraintRange |
| Soft lower and upper limits.
|
bool | mEnableRestraint |
| Is this restraint enabled ?
|
REAL | mWeight |
| weight for the restraint. This shoud be set by the RefinableObj.
|
Detailed Description
Restraint: generic class defining both hard (constraints) and soft (restraints) limits associated with a RefinableObj.
These can be restrictions on a single parameter (see RefinablePar), but inheritance allows involving several parameters.
There are two kind of restrictions: first, the 'hard' limits [hardmin,hardmax] in which the value should be ideally located. And the soft limits, which correspond to penalty applied beyond the 'hard' limits. There is no restriction within hard limits, and if the optimization algorithm allows restraints, then the value may go outside this range, but with a cost (penalty) which is taken into account by the algorithm when evaluating the configuration.
It is the duty of the algorithm to enable or disable restraints, and to evaluate them (more or less loosely).
This is an abstract base class
Constructor & Destructor Documentation
ObjCryst::Restraint::Restraint |
( |
const RefParType * |
type, |
|
|
const REAL |
hardMin, |
|
|
const REAL |
hardMax, |
|
|
const bool |
hasMinLimit, |
|
|
const bool |
hasMaxLimit, |
|
|
const REAL |
softRange, |
|
|
const REAL |
restraintWeigth = 1, |
|
|
const bool |
enableRestraint = false |
|
) |
|
|
|
Constructor for the base Restrain class, setting hard&soft limits.
-
Parameters:
-
type: |
the type of value which is constrained/restrained. |
hardMin,hardMax: |
the hard limits between which the value should ideally be. |
hasMinLimit,hasMaxLimit: |
set to 'true' if the parameter has upper and/or lower limit. |
softRange: |
when the value goes below min or above max limits, the penalty will be equal to 1 at min-softRange and at max+softRange. Thus softRange must be strictly positive. |
enableRestraint: |
if true, then the value may go beyond the hard limits, with penalty defined by the soft limits. Else no value beyond the hard limits should be accepted. |
restraintWeigth: |
the weight associated to this restraint. This should be tuned by the RefinableObj owner. |
|
Member Function Documentation
virtual REAL ObjCryst::Restraint::GetRestraintCost |
( |
const REAL |
looseness = 1. |
) |
const [virtual] |
|
|
Get the value of the penalty (cost) associated to the restraint.
If the parameter is within limits, the cost is null. If it is below the min (and if there is a lower limit), the cost is equal to:
And if there is a higher limit and the value is above it:
If restraints are disabled, the returned cost is always null. |
void ObjCryst::Restraint::Init |
( |
const RefParType * |
type, |
|
|
const REAL |
hardMin, |
|
|
const REAL |
hardMax, |
|
|
const bool |
hasMinLimit, |
|
|
const bool |
hasMaxLimit, |
|
|
const REAL |
softRange, |
|
|
const REAL |
restraintWeigth = 1, |
|
|
const bool |
enableRestraint = false |
|
) |
|
|
|
Initializer for the base Restrain class, setting hard&soft limits.
-
Parameters:
-
type: |
the type of value which is constrained/restrained. |
hardMin,hardMax: |
the hard limits between which the value should ideally be. |
hasMinLimit,hasMaxLimit: |
set to 'true' if the parameter has upper and/or lower limit. |
softRange: |
when the value goes below min or above max limits, the penalty will be equal to 1 at min-softRange and at max+softRange. Thus softRange must be strictly positive. |
enableRestraint: |
if true, then the value may go beyond the hard limits, with penalty defined by the soft limits. Else no value beyond the hard limits should be accepted. |
restraintWeigth: |
the weight associated to this restraint. This should be tuned by the RefinableObj owner. |
|
The documentation for this class was generated from the following file:
Generated on Tue Feb 5 17:37:25 2002 for ObjCryst++ by
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001