# ModulatoryMechanism¶

Subclasses

## Overview¶

A ModulatoryMechanism is a type of Mechanism that modifies the operation of one or more other Components. In general, a ModulatoryMechanism receives its input from an ObjectiveMechanism, however this need not be the case.

There are two primary types of ModulatoryMechanism:

A single ModulatoryMechanism can be assigned more than one ModulatorySignal of the appropriate type, each of which can be assigned different control_allocations (for ControlSignals) or learning_signals (for LearningSignals). A single ModulatorySignal can also be assigned multiple ModulatoryProjections; however, as described in ModulatoryProjections, they will all be assigned the same variable.

### Naming Conventions for Modulatory Components¶

Modulatory Components and their attributes are named according to the type of modulation using the following templates:

• ModulatoryMechanism name
<Type>Mechanism (e.g., ControlMechanism)
• ModulatorySignal name
<Type>Signal (e.g., ControlSignal)
• ModulatoryProjection name
<Type>Projection (e.g., ControlProjection)
• List of a ModulatoryMechanism’s ModulatorySignals
<Type>Mechanism.<type>_signals (e.g., ControlMechanism.control_signals)
• Value of a ModulatorySignal
<Type>Signal.<type>_signal (e.g., ControlSignal.control_signal)

## Creating a ModulatoryMechanism¶

A ModulatoryMechanism is created by calling the constructor for the desired type. ModulatoryMechanisms of the appropriate subtype can also be created automatically when other Components are created that require them (for example, one or more LearningMechanism are created when a learning pathway is specified for a Composition (see subtypes of ModulatoryMechanisms for more specific information about how to create them).

## Structure¶

A ModulatoryMechanism has the same basic structure as a Mechanism. In addition, every ModulatoryMechanism has a modulation attribute, that determines the default method by which its ModulatorySignals modify the value of the Components that they modulate (see the modulation for a description of how modulation operates, and the documentation for individual subtypes of ModulatoryMechanism for more specific information about their structure and modulatory operation).

## Execution¶

The execution of a ModulatoryMechanism follows the same sequence of actions as a standard Mechanism (Execution). However, in the context of a Composition, its ModulatoryProjections are often feedback connections to other Mechanisms in the Composition, forming a cycle in the Composition, and thus the ModulatoryMechanism may need to be properly initialized (see Cycles and Feedback). Also, a ControlMechanism can be the controller of a Composition in which case its execution is handled separately from other Mechanisms in the Composition (see Controller Execution). As noted below, the modifications made by a ModulatoryMechanism to a parameter that it modulates are not available to that parameter’s Component until after the Modulatory executes, which may not be until the next TRIAL (e.g., the matrix parameter of a MappingProjection that is subject to learning in a Composition; or a parameter modulated by a ControlMechanism that is the controller of a Composition that executes last (see Controller Execution).

Note

A Port that receives a ModulatoryProjection from a ModulatoryMechanism does not update its value until its owner Mechanism executes (see Lazy Evaluation for an explanation of “lazy” updating). This means that even if a ModulatoryMechanism has executed, a parameter that it modulates will not assume its new value until the Mechanism to which it belongs has executed.

## Class Reference¶

class psyneulink.core.components.mechanisms.modulatory.modulatorymechanism.ModulatoryMechanism_Base(default_variable, size, modulation, params, name, prefs, context=None, function=None, **kwargs)

Subclass of Mechanism that modulates the value(s) of one or more other Component(s). See Mechanism and subclasses for arguments and additional attributes.

Note

ModulatoryMechanism is an abstract class and should never be instantiated by a call to its constructor. They should be instantiated using the constructor for a subclass.

modulation

str – determines how the output of the ModulatoryMechanism’s ModulatorySignal(s) are used to modulate the value of the Port(s) to which their ModulatoryProjection(s) project.