import ChemotaxisConstraint from 'Artistoo/src/hamiltonian/ChemotaxisConstraint.js'
ChemotaxisConstraint
Extends:
This class implements a constraint for cells moving up a chemotactic gradient. It checks the chemokine gradient in the direction of the attempted copy, and rewards copy attempts that go up the gradient. This effect is stronger when the gradient is steep. Copy attempts going to a lower chemokine value are punished.
The grid with the chemokine must be supplied, see the constructor.
Example:
// Build a chemotaxis field
let CPM = require( "path/to/build" )
let chemogrid = new CPM.Grid2D( [200,200], [true,true], "Float32" )
chemogrid.setpix( [100,100], 100 )
// Build a CPM with the constraint
let C = new CPM.CPM( [200,200], {
T : 20,
J : [[0,20],[20,10]],
V : [0,500],
LAMBDA_V : [0,5]
})
C.add( new CPM.ChemotaxisConstraint( {
LAMBDA_CH : [0,5000],
CH_FIELD : chemogrid
} ) )
Constructor Summary
Public Constructor | ||
public |
constructor(conf: object) The constructor of the ChemotaxisConstraint requires a conf object with a parameter and a chemotactic field. |
Member Summary
Public Members | ||
public set |
Set the CPM attached to this constraint. |
|
public |
conf: * |
|
public |
The field where the chemokine lives. |
Method Summary
Public Methods | ||
public |
|
|
public |
This method checks that all required parameters are present in the object supplied to the constructor, and that they are of the right format. |
|
public |
deltaH(sourcei: IndexCoordinate, targeti: IndexCoordinate, src_type: CellId, tgt_type: CellId): number Method to compute the Hamiltonian for this constraint. |
Private Methods | ||
private |
deltaHCoarse(sourcei: IndexCoordinate, targeti: IndexCoordinate, src_type: CellId, tgt_type: CellId): number Method to compute the Hamiltonian if the chemotactic field is a CoarseGrid. |
Inherited Summary
From class Constraint | ||
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 get |
parameters: object: * Get the parameters of this constraint from the conf object. |
|
public |
CPM on which this constraint acts. |
|
public |
Configuration object for this constraint. |
|
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. |
From class SoftConstraint | ||
public get |
Let the CPM know that this is a soft constraint, so return 'soft'. |
|
public abstract |
deltaH(src_i: IndexCoordinate, tgt_i: IndexCoordinate, src_type: CellId, tgt_type: CellId): number Soft constraints must have a deltaH method to compute the Hamiltonian. |
Public Constructors
public constructor(conf: object) source
The constructor of the ChemotaxisConstraint requires a conf object with a parameter and a chemotactic field.
Override:
Constraint#constructorParams:
Name | Type | Attribute | Description |
conf | object | parameter object for this constraint |
|
conf.LAMBDA_CH | PerKindNonNegative | chemotactic sensitivity per cellkind. |
|
conf.CH_FIELD | CoarseGrid | Grid2D | the chemotactic field where the chemokine lives. |
TODO:
- what kinds of grids are allowed for the chemotactic field? Do we need to check somewhere that its properties "match" that of the CPM? (That is, the same resolution and torus properties)?
Public Members
public conf: * source
Configuration object for this constraint.
Override:
Constraint#confTODO:
- is this ever used?
Public Methods
public confChecker() source
This method checks that all required parameters are present in the object supplied to the constructor, and that they are of the right format. It throws an error when this is not the case.
Override:
Constraint#confCheckerpublic deltaH(sourcei: IndexCoordinate, targeti: IndexCoordinate, src_type: CellId, tgt_type: CellId): number source
Method to compute the Hamiltonian for this constraint.
Override:
SoftConstraint#deltaHParams:
Name | Type | Attribute | Description |
sourcei | IndexCoordinate | coordinate of the source pixel that tries to copy. |
|
targeti | IndexCoordinate | coordinate of the target pixel the source is trying to copy into. |
|
src_type | CellId | cellid of the source pixel. |
|
tgt_type | CellId | cellid of the target pixel. This argument is not actually used by this method, but is supplied for compatibility; the CPM will always call the deltaH method with all 4 arguments. |
Private Methods
private deltaHCoarse(sourcei: IndexCoordinate, targeti: IndexCoordinate, src_type: CellId, tgt_type: CellId): number source
Method to compute the Hamiltonian if the chemotactic field is a CoarseGrid. This method is used instead of the regular deltaH whenever this is true.
Params:
Name | Type | Attribute | Description |
sourcei | IndexCoordinate | coordinate of the source pixel that tries to copy. |
|
targeti | IndexCoordinate | coordinate of the target pixel the source is trying to copy into. |
|
src_type | CellId | cellid of the source pixel. |
|
tgt_type | CellId | cellid of the target pixel. This argument is not actually used by this method, but is supplied for compatibility; the CPM will always call the deltaH method with all 4 arguments. |