Constraint
Direct Subclass:
Indirect Subclass:
This base class defines a general CPM constraint and provides methods that do not depend on the specific constraint used. This class is never used on its own, as it does not yet contain the actual definition of a constraint (such as a deltaH method).
In general, we distinguish between two types of constraint:
- a HardConstraint is a hard rule that must be fulfilled in order for a copy attempt to succeed;
- a SoftConstraint is an energy term in the Hamiltonian that can make a copy attempt either more or less energetically favourable, but does not by itself determine whether a copy attempt will succeed. An unfavourable outcome may be outbalanced by favourable energies from other terms, and even a copy attempt net unfavourable energy (deltaH > 0) may succeed with a success chance P = exp(-DeltaH/T).
See the subclasses SoftConstraint and HardConstraint for details. Each implemented constraint is in turn a subclass of one of these two.
Constructor Summary
Public Constructor | ||
public abstract |
constructor(conf: object) The constructor of a constraint takes a configuration object. |
Member Summary
Public Members | ||
public |
CPM on which this constraint acts. |
|
public get abstract |
This method is actually implemented in the subclass. |
|
public set |
This function attaches the relevant CPM to this constraint, so that information about this cpm can be requested from the constraint. |
|
public |
Configuration object for this constraint. |
|
public get |
parameters: object: * Get the parameters of this constraint from the conf object. |
Method Summary
Public Methods | ||
public abstract |
cellParameter(param: string, cid: CellId): any Get a cellid or cellkind-specific parameter for a constraint. |
|
public abstract |
The optional confChecker method should verify that all the required conf parameters are actually present in the conf object and have the right format. |
|
public |
paramOfCell(param: string, cid: CellId): any Get a cellId specific parameter, only used if CPMEvol is used: looks whether the requested parameter is overwritten in an @object Cell and otherwise returns @function paramOfKind |
|
public |
paramOfKind(param: string, cid: CellId): any Returns a cellKind specfic variable: Assumes that the parameter is indexable by cellkind. |
Public Constructors
public abstract constructor(conf: object) source
The constructor of a constraint takes a configuration object. This method is usually overwritten by the actual constraint so that the entries of this object can be documented.
Params:
Name | Type | Attribute | Description |
conf | object | configuration settings for this constraint, containing the relevant parameters. |
Public Members
public set CPM(C: CPM) source
This function attaches the relevant CPM to this constraint, so that information about this cpm can be requested from the constraint. If the cpm is of type CPMEvol, the cellParameter call is redirected to check for CellId-specific parameters.
TODO:
- Check why some constraints overwrite this? Because that disables the automatic usage of a confChecker() when it is implemented.
Public Methods
public abstract cellParameter(param: string, cid: CellId): any source
Get a cellid or cellkind-specific parameter for a constraint. This function is here to document its functionality, but it is always overwritten by the constructor (via "set CPM") to point to another function. This is normally @function paramOfKind, which retrieves the parameter from the conf object for the current cellKind. If CPMEvol is used this is instead redirected to @function paramOfCell, which looks whether the parameter is overwritten in an @object Cell and otherwise returns @function paramOfKind
Return:
any | parameter - the requested parameter |
public abstract confChecker() source
The optional confChecker method should verify that all the required conf parameters are actually present in the conf object and have the right format. It is implemented in the subclass that specifies the actual constraint.
public paramOfCell(param: string, cid: CellId): any source
Get a cellId specific parameter, only used if CPMEvol is used: looks whether the requested parameter is overwritten in an @object Cell and otherwise returns @function paramOfKind
Return:
any | parameter - the requested parameter |