import SoftConstraint from 'Artistoo/src/hamiltonian/SoftConstraint.js'
public class | source

SoftConstraint

Extends:

Constraint → SoftConstraint

Indirect Subclass:

ActivityMultiBackground

Extension of class Constraint used for a soft constraint. See description in Constraint for details. This class is not used on its own but serves as a base class for a soft constraint.

Member Summary

Public Members
public get

Let the CPM know that this is a soft constraint, so return 'soft'.

Method Summary

Public Methods
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.

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

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.

Public Members

public get CONSTRAINT_TYPE: string: string source

Let the CPM know that this is a soft constraint, so return 'soft'.

Override:

Constraint#CONSTRAINT_TYPE

Return:

string

"soft"

Public Methods

public abstract deltaH(src_i: IndexCoordinate, tgt_i: IndexCoordinate, src_type: CellId, tgt_type: CellId): number source

Soft constraints must have a deltaH method to compute the Hamiltonian. This method must be implemented in any SoftConstraint subclass before it works.

Params:

NameTypeAttributeDescription
src_i IndexCoordinate

coordinate of the source pixel that tries to copy.

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