import ActivityConstraint from 'Artistoo/src/hamiltonian/ActivityConstraint.js'
public class

# ActivityConstraint

#### Extends:

ConstraintSoftConstraint → ActivityConstraint

#### Direct Subclass:

ActivityMultiBackground

This class implements the activity constraint of Potts models published in:

Niculescu I, Textor J, de Boer RJ (2015) Crawling and Gliding: A Computational Model for Shape-Driven Cell Migration. PLoS Comput Biol 11(10): e1004280.

Pixels recently added to a cell get an "activity", which then declines with every MCS. Copy attempts from more active into less active pixels have a higher success rate, which puts a positive feedback on protrusive activity and leads to cell migration.

This constraint is generally used together with Adhesion, VolumeConstraint, and PerimeterConstraint.

#### Example:

// Build a CPM and add the constraint
let CPM = require( "path/to/build" )
let C = new CPM.CPM( [200,200], {
T : 20,
J : [[0,20],[20,10]],
V : [0,500],
LAMBDA_V : [0,5],
P : [0,260],
LAMBDA_P : [0,2]
})
LAMBDA_ACT : [0,500],
MAX_ACT : [0,30],
ACT_MEAN : "geometric"
} ) )

// Or add automatically by entering the parameters in the CPM
let C2 = new CPM.CPM( [200,200], {
T : 20,
J : [[0,20],[20,10]],
V : [0,500],
LAMBDA_V : [0,5],
P : [0,260],
LAMBDA_P : [0,2],
LAMBDA_ACT : [0,500],
MAX_ACT : [0,30],
ACT_MEAN : "geometric"
})

## Constructor Summary

 Public Constructor public constructor(conf: object) The constructor of the ActivityConstraint requires a conf object with parameters.

## Member Summary

 Public Members public Wrapper: select function to compute activities based on ACT_MEAN in conf. public Activity of all cellpixels with a non-zero activity is stored in this object, with the IndexCoordinate of each pixel as key and its current activity as value.

## Method Summary

 Public Methods 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. public The postMCSListener of the ActivityConstraint ensures that pixel activities decline with one after every MCS. public postSetpixListener(i: IndexCoordinate, t_old: CellId, t: CellId) The postSetpixListener of the ActivityConstraint ensures that pixels are given their maximal activity when they are freshly added to a CPM. public pxact Current activity (under the Act model) of the pixel at position i.
 Private Methods private Activity mean computation methods for arithmetic mean. private Activity mean computation methods for geometric mean.

## Inherited Summary

 From class Constraint public get abstract This method is actually implemented in the subclass. public set CPM(C: CPM) 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 C: CPM 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

### publicconstructor(conf: object) source

The constructor of the ActivityConstraint requires a conf object with parameters.

#### Override:

Constraint#constructor

#### Params:

 Name Type Attribute Description conf object parameter object for this constraint conf.ACT_MEAN string optional default: "geometric" should local mean activity be measured with an "arithmetic" or a "geometric" mean? conf.LAMBDA_ACT PerKindNonNegative strength of the activityconstraint per cellkind. conf.MAX_ACT PerKindNonNegative how long do pixels remember their activity? Given per cellkind.

## Public Members

### publicactivityAt: function source

Wrapper: select function to compute activities based on ACT_MEAN in conf. Default is to use the activityAtGeom for a geometric mean.

### publiccellpixelsact: object source

Activity of all cellpixels with a non-zero activity is stored in this object, with the IndexCoordinate of each pixel as key and its current activity as value. When the activity reaches 0, the pixel is removed from the object until it is added again.

## Public Methods

### publicconfChecker() 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#confChecker

### publicdeltaH(sourcei: IndexCoordinate, targeti: IndexCoordinate, src_type: CellId, tgt_type: CellId): number source

Method to compute the Hamiltonian for this constraint.

#### Override:

SoftConstraint#deltaH

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

#### Return:

 number the change in Hamiltonian for this copy attempt and this constraint.

### publicpostMCSListener() source

The postMCSListener of the ActivityConstraint ensures that pixel activities decline with one after every MCS.

#### Listen:

 timeStep because when the CPM has finished an MCS, the activities must go down.

### publicpostSetpixListener(i: IndexCoordinate, t_old: CellId, t: CellId) source

The postSetpixListener of the ActivityConstraint ensures that pixels are given their maximal activity when they are freshly added to a CPM.

#### Params:

 Name Type Attribute Description i IndexCoordinate the coordinate of the pixel that is changed. t_old CellId the cellid of this pixel before the copy t CellId the cellid of this pixel after the copy.

#### Listen:

 setpixi because when a new pixel is set (which is determined in the CPM), its activity must change so that this class knows about the update.

### publicpxact(i: IndexCoordinate): number source

Current activity (under the Act model) of the pixel at position i.

#### Params:

 Name Type Attribute Description i IndexCoordinate the position of the pixel to evaluate the activity of.

#### Return:

 number the current activity of this pixel, which is >= 0.

## Private Methods

### privateactivityAtArith(i: IndexCoordinate): number source

Activity mean computation methods for arithmetic mean. It computes the mean activity of a pixel and all its neighbors belonging to the same cell.

This method is generally called indirectly via activityAt, which is set based on the value of ACT_MEAN in the configuration object given to the constructor.

#### Params:

 Name Type Attribute Description i IndexCoordinate pixel to evaluate local activity at.

#### Return:

 number the arithmetic mean of activities in this part of the cell.

### privateactivityAtGeom(i: IndexCoordinate): number source

Activity mean computation methods for geometric mean. It computes the mean activity of a pixel and all its neighbors belonging to the same cell.

This method is generally called indirectly via activityAt, which is set based on the value of ACT_MEAN in the configuration object given to the constructor.

#### Params:

 Name Type Attribute Description i IndexCoordinate pixel to evaluate local activity at.

#### Return:

 number the geometric mean of activities in this part of the cell.