Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/lccontrolmechanism_objectivemechanism #3134

Merged
merged 28 commits into from
Nov 28, 2024

Conversation

jdcpni
Copy link
Collaborator

@jdcpni jdcpni commented Nov 27, 2024

• lccontrolmechanism.py

  • make objective_mechanism = True by default
    _instantiate_objective_mechanism(): implement override of ControlMechanism to assign CombineMeans as function of default ObjectiveMechanism
  • remove errorneous reference to "ALL" as spec for modulated_mechanisms in docstring

• test_control_mechanism.py

  • test_lc_control_monitored_and_modulated_mechanisms_composition(): augment to test implementation of ObjectiveMechanism

jdcpni added 26 commits October 27, 2024 08:18
…Link into devel

# Conflicts:
#	Scripts/Models (Under Development)/EGO/Using EMComposition/ScriptControl.py
#	Scripts/Models (Under Development)/EGO/Using EMComposition/TestParams.py
…Link into devel

# Conflicts:
#	Scripts/Models (Under Development)/EGO/Using EMComposition/CSW/ScriptControl.py
  - suppress warning about adding CONTROL_OBJECTIVE NodeRole if ObjectiveMechanism is already associated with a ControlMechanism
• lccontrolmechanism.py
  - _instantiate_objective_mechanism():  implement default ObjectiveMechanism with CombineMeans
• lccontrolmechanism.py
  - _instantiate_control_signals:
    complete implementation of ALL
• lccontrolmechanism.py
  - _instantiate_control_signals:
    complete implementation of ALL
• lccontrolmechanism.py
  - _instantiate_control_signals:
    complete implementation of ALL
  test_lc_control_monitored_and_modulated_mechanisms_composition(): augmented to test implementation of ObjectiveMechanism
@@ -2912,7 +2912,7 @@
from psyneulink.core.components.mechanisms.modulatory.modulatorymechanism import ModulatoryMechanism_Base
from psyneulink.core.components.mechanisms.processing.compositioninterfacemechanism import CompositionInterfaceMechanism
from psyneulink.core.components.mechanisms.processing.objectivemechanism import ObjectiveMechanism
from psyneulink.core.components.mechanisms.processing.processingmechanism import ProcessingMechanism
from psyneulink.core.components.mechanisms.processing.processingmechanism import ProcessingMechanism, ProcessingMechanism_Base

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
psyneulink.core.components.mechanisms.processing.processingmechanism
begins an import cycle.
Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.11):

diff -r docs-base/ControlMechanism.html docs-head/ControlMechanism.html
386c386
< its corresponding <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">input_ports</span></code></a>.  When the Composition is run, the <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a>(s) of the OutputPort(s) monitored are evaluated using the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism" title="psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>'s <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a>, and the result is assigned to its <em>OUTCOME</em> <a class="reference internal" href="ObjectiveMechanism.html#objectivemechanism-output"><span class="std std-ref">output_port</span></a>.  That <code class="xref any docutils literal notranslate"><span class="pre">value</span></code> is then passed to the ControlMechanism’s
---
> its corresponding <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">input_ports</span></code></a>.  When the Composition is run, the <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a>(s) of the OutputPort(s) monitored are evaluated using the <a class="reference internal" href="LCControlMechanism.html#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>'s <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a>, and the result is assigned to its <em>OUTCOME</em> <a class="reference internal" href="ObjectiveMechanism.html#objectivemechanism-output"><span class="std std-ref">output_port</span></a>.  That <code class="xref any docutils literal notranslate"><span class="pre">value</span></code> is then passed to the ControlMechanism’s
diff -r docs-base/LCControlMechanism.html docs-head/LCControlMechanism.html
269c269
< <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a> of the ObjectiveMechanism’s <em>OUTCOME</em> <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort</span></a> must be a scalar (that is used as the
---
> <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a> of the ObjectiveMechanism’s <em>OUTCOME</em> <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort</span></a> must be a scalar, that is used as the
282,285c282,285
< <a class="reference internal" href="Mechanism.html#psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> a class of <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> that implements a <a class="reference internal" href="Functions.html#function-modulatory-params"><span class="std std-ref">multiplicative_param</span></a>.  The <strong>modulate_mechanisms</strong> argument must be either a list of such Mechanisms, or
< a <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> (to modulate all of the <a class="reference internal" href="ProcessingMechanism.html"><span class="doc">ProcessingMechanisms</span></a> in a Composition – see below).
< see below). If a Mechanism specified in the <strong>modulated_mechanisms</strong> argument does not implement a multiplicative_param,
< it is ignored. A <a class="reference internal" href="ControlProjection.html"><span class="doc">ControlProjection</span></a> is automatically created that projects from the LCControlMechanism to the
---
> <a class="reference internal" href="Mechanism.html#psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> a class of <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> that implements a <a class="reference internal" href="Functions.html#function-modulatory-params"><span class="std std-ref">multiplicative_param</span></a>. If a Mechanism specified in the <strong>modulated_mechanisms</strong> argument does not implement a
> multiplicative_param, it is ignored. The <strong>modulate_mechanisms</strong> argument must be either a list of suitable Mechanisms,
> or a <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> (to modulate all of the <a class="reference internal" href="ProcessingMechanism.html"><span class="doc">ProcessingMechanisms</span></a> in a Composition – see below).
> A <a class="reference internal" href="ControlProjection.html"><span class="doc">ControlProjection</span></a> is automatically created that projects from the LCControlMechanism to the
287c287
< <strong>modulated_mechanisms</strong> argument.  The Mechanisms modulated by an LCControlMechanism are listed in its
---
> <strong>modulated_mechanisms</strong> argument. The Mechanisms modulated by an LCControlMechanism are listed in its
289c289
< <p>If <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> is assigned as the value of <strong>modulate_mechanisms</strong>, then the LCControlMechanism will modulate all
---
> <p>If a <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> is assigned as the value of <strong>modulate_mechanisms</strong>, then the LCControlMechanism will modulate all
291c291
< a the <a class="reference internal" href="ControlMechanism.html#psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism" title="psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a> of another <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanism</span></a>.  Note that only the
---
> as the <a class="reference internal" href="ControlMechanism.html#psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism" title="psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a> of another <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanism</span></a>.  Note that only the
308c308,309
< <p>If an ObjectiveMechanism is <code class="xref any docutils literal notranslate"><span class="pre">automatically</span> <span class="pre">created</span></code> specified the
---
> <p>If an ObjectiveMechanism is <a class="reference internal" href="#lccontrolmechanism-objectivemechanism-creation"><span class="std std-ref">automatically created</span></a> for an
> LCControlMechanism, it receives its inputs from the <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort(s)</span></a> specified the
322c323
< creating its <code class="xref any docutils literal notranslate"><span class="pre">objective_mechanism</span></code>.  In particular, whereas an
---
> creating its <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>.  In particular, whereas an
324c325
< an LCControlMechanism uses <a class="reference internal" href="TransformFunctions.html#psyneulink.core.components.functions.transformfunctions.CombineMeans" title="psyneulink.core.components.functions.transformfunctions.CombineMeans"><code class="xref any py py-class docutils literal notranslate"><span class="pre">CombineMeans</span></code></a> as the <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> of its <code class="xref any docutils literal notranslate"><span class="pre">objective_mechanism</span></code>.  As a consequence, if an ObjectiveMechanism is explicitly specified in
---
> an LCControlMechanism uses <a class="reference internal" href="TransformFunctions.html#psyneulink.core.components.functions.transformfunctions.CombineMeans" title="psyneulink.core.components.functions.transformfunctions.CombineMeans"><code class="xref any py py-class docutils literal notranslate"><span class="pre">CombineMeans</span></code></a> as the <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> of its <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>.  As a consequence, if an ObjectiveMechanism is explicitly specified in
330c331
< <p>The ObjectiveFunction is listed in the LCControlMechanism’s <code class="xref any docutils literal notranslate"><span class="pre">objective_mechanism</span></code> attribute.  The OutputPorts it monitors are listed in the
---
> <p>The ObjectiveFunction is listed in the LCControlMechanism’s <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a> attribute.  The OutputPorts it monitors are listed in the
430c431
< <em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.</span></span><span class="sig-name descname"><span class="pre">LCControlMechanism</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">default_variable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">default_allocation</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">objective_mechanism</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">monitor_for_control</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">modulated_mechanisms</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">modulation</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">integration_method</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'RK4'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initial_w_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initial_v_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_step_size_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.05</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">t_0_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">a_v_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">0.3333333333333333</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b_v_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</s
...

See CI logs for the full diff.

assert T_1.parameter_ports[pnl.SLOPE].mod_afferents[0] in LC.control_signals[0].efferents
assert T_2.parameter_ports[pnl.SLOPE].mod_afferents[0] in LC.control_signals[0].efferents

result = C.run(inputs={T_1:[1,2]})#, T_2:[3,4,5]

Check notice

Code scanning / CodeQL

Unused local variable Note test

Variable result is not used.
Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.11):

diff -r docs-base/ControlMechanism.html docs-head/ControlMechanism.html
386c386
< its corresponding <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">input_ports</span></code></a>.  When the Composition is run, the <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a>(s) of the OutputPort(s) monitored are evaluated using the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism" title="psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>'s <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a>, and the result is assigned to its <em>OUTCOME</em> <a class="reference internal" href="ObjectiveMechanism.html#objectivemechanism-output"><span class="std std-ref">output_port</span></a>.  That <code class="xref any docutils literal notranslate"><span class="pre">value</span></code> is then passed to the ControlMechanism’s
---
> its corresponding <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">input_ports</span></code></a>.  When the Composition is run, the <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a>(s) of the OutputPort(s) monitored are evaluated using the <a class="reference internal" href="LCControlMechanism.html#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>'s <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a>, and the result is assigned to its <em>OUTCOME</em> <a class="reference internal" href="ObjectiveMechanism.html#objectivemechanism-output"><span class="std std-ref">output_port</span></a>.  That <code class="xref any docutils literal notranslate"><span class="pre">value</span></code> is then passed to the ControlMechanism’s
diff -r docs-base/LCControlMechanism.html docs-head/LCControlMechanism.html
269c269
< <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a> of the ObjectiveMechanism’s <em>OUTCOME</em> <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort</span></a> must be a scalar (that is used as the
---
> <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a> of the ObjectiveMechanism’s <em>OUTCOME</em> <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort</span></a> must be a scalar, that is used as the
282,285c282,285
< <a class="reference internal" href="Mechanism.html#psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> a class of <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> that implements a <a class="reference internal" href="Functions.html#function-modulatory-params"><span class="std std-ref">multiplicative_param</span></a>.  The <strong>modulate_mechanisms</strong> argument must be either a list of such Mechanisms, or
< a <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> (to modulate all of the <a class="reference internal" href="ProcessingMechanism.html"><span class="doc">ProcessingMechanisms</span></a> in a Composition – see below).
< see below). If a Mechanism specified in the <strong>modulated_mechanisms</strong> argument does not implement a multiplicative_param,
< it is ignored. A <a class="reference internal" href="ControlProjection.html"><span class="doc">ControlProjection</span></a> is automatically created that projects from the LCControlMechanism to the
---
> <a class="reference internal" href="Mechanism.html#psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> a class of <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> that implements a <a class="reference internal" href="Functions.html#function-modulatory-params"><span class="std std-ref">multiplicative_param</span></a>. If a Mechanism specified in the <strong>modulated_mechanisms</strong> argument does not implement a
> multiplicative_param, it is ignored. The <strong>modulate_mechanisms</strong> argument must be either a list of suitable Mechanisms,
> or a <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> (to modulate all of the <a class="reference internal" href="ProcessingMechanism.html"><span class="doc">ProcessingMechanisms</span></a> in a Composition – see below).
> A <a class="reference internal" href="ControlProjection.html"><span class="doc">ControlProjection</span></a> is automatically created that projects from the LCControlMechanism to the
287c287
< <strong>modulated_mechanisms</strong> argument.  The Mechanisms modulated by an LCControlMechanism are listed in its
---
> <strong>modulated_mechanisms</strong> argument. The Mechanisms modulated by an LCControlMechanism are listed in its
289c289
< <p>If <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> is assigned as the value of <strong>modulate_mechanisms</strong>, then the LCControlMechanism will modulate all
---
> <p>If a <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> is assigned as the value of <strong>modulate_mechanisms</strong>, then the LCControlMechanism will modulate all
291c291
< a the <a class="reference internal" href="ControlMechanism.html#psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism" title="psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a> of another <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanism</span></a>.  Note that only the
---
> as the <a class="reference internal" href="ControlMechanism.html#psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism" title="psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a> of another <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanism</span></a>.  Note that only the
308c308,309
< <p>If an ObjectiveMechanism is <code class="xref any docutils literal notranslate"><span class="pre">automatically</span> <span class="pre">created</span></code> specified the
---
> <p>If an ObjectiveMechanism is <a class="reference internal" href="#lccontrolmechanism-objectivemechanism-creation"><span class="std std-ref">automatically created</span></a> for an
> LCControlMechanism, it receives its inputs from the <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort(s)</span></a> specified the
322c323
< creating its <code class="xref any docutils literal notranslate"><span class="pre">objective_mechanism</span></code>.  In particular, whereas an
---
> creating its <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>.  In particular, whereas an
324c325
< an LCControlMechanism uses <a class="reference internal" href="TransformFunctions.html#psyneulink.core.components.functions.transformfunctions.CombineMeans" title="psyneulink.core.components.functions.transformfunctions.CombineMeans"><code class="xref any py py-class docutils literal notranslate"><span class="pre">CombineMeans</span></code></a> as the <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> of its <code class="xref any docutils literal notranslate"><span class="pre">objective_mechanism</span></code>.  As a consequence, if an ObjectiveMechanism is explicitly specified in
---
> an LCControlMechanism uses <a class="reference internal" href="TransformFunctions.html#psyneulink.core.components.functions.transformfunctions.CombineMeans" title="psyneulink.core.components.functions.transformfunctions.CombineMeans"><code class="xref any py py-class docutils literal notranslate"><span class="pre">CombineMeans</span></code></a> as the <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> of its <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>.  As a consequence, if an ObjectiveMechanism is explicitly specified in
330c331
< <p>The ObjectiveFunction is listed in the LCControlMechanism’s <code class="xref any docutils literal notranslate"><span class="pre">objective_mechanism</span></code> attribute.  The OutputPorts it monitors are listed in the
---
> <p>The ObjectiveFunction is listed in the LCControlMechanism’s <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a> attribute.  The OutputPorts it monitors are listed in the
430c431
< <em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.</span></span><span class="sig-name descname"><span class="pre">LCControlMechanism</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">default_variable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">default_allocation</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">objective_mechanism</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">monitor_for_control</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">modulated_mechanisms</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">modulation</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">integration_method</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'RK4'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initial_w_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initial_v_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_step_size_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.05</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">t_0_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">a_v_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">0.3333333333333333</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b_v_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</s
...

See CI logs for the full diff.

Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.11):

diff -r docs-base/ControlMechanism.html docs-head/ControlMechanism.html
386c386
< its corresponding <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">input_ports</span></code></a>.  When the Composition is run, the <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a>(s) of the OutputPort(s) monitored are evaluated using the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism" title="psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>'s <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a>, and the result is assigned to its <em>OUTCOME</em> <a class="reference internal" href="ObjectiveMechanism.html#objectivemechanism-output"><span class="std std-ref">output_port</span></a>.  That <code class="xref any docutils literal notranslate"><span class="pre">value</span></code> is then passed to the ControlMechanism’s
---
> its corresponding <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">input_ports</span></code></a>.  When the Composition is run, the <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a>(s) of the OutputPort(s) monitored are evaluated using the <a class="reference internal" href="LCControlMechanism.html#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>'s <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a>, and the result is assigned to its <em>OUTCOME</em> <a class="reference internal" href="ObjectiveMechanism.html#objectivemechanism-output"><span class="std std-ref">output_port</span></a>.  That <code class="xref any docutils literal notranslate"><span class="pre">value</span></code> is then passed to the ControlMechanism’s
diff -r docs-base/LCControlMechanism.html docs-head/LCControlMechanism.html
269c269
< <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a> of the ObjectiveMechanism’s <em>OUTCOME</em> <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort</span></a> must be a scalar (that is used as the
---
> <a class="reference internal" href="OutputPort.html#psyneulink.core.components.ports.outputport.OutputPort.value" title="psyneulink.core.components.ports.outputport.OutputPort.value"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">value</span></code></a> of the ObjectiveMechanism’s <em>OUTCOME</em> <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort</span></a> must be a scalar, that is used as the
282,285c282,285
< <a class="reference internal" href="Mechanism.html#psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> a class of <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> that implements a <a class="reference internal" href="Functions.html#function-modulatory-params"><span class="std std-ref">multiplicative_param</span></a>.  The <strong>modulate_mechanisms</strong> argument must be either a list of such Mechanisms, or
< a <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> (to modulate all of the <a class="reference internal" href="ProcessingMechanism.html"><span class="doc">ProcessingMechanisms</span></a> in a Composition – see below).
< see below). If a Mechanism specified in the <strong>modulated_mechanisms</strong> argument does not implement a multiplicative_param,
< it is ignored. A <a class="reference internal" href="ControlProjection.html"><span class="doc">ControlProjection</span></a> is automatically created that projects from the LCControlMechanism to the
---
> <a class="reference internal" href="Mechanism.html#psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> a class of <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> that implements a <a class="reference internal" href="Functions.html#function-modulatory-params"><span class="std std-ref">multiplicative_param</span></a>. If a Mechanism specified in the <strong>modulated_mechanisms</strong> argument does not implement a
> multiplicative_param, it is ignored. The <strong>modulate_mechanisms</strong> argument must be either a list of suitable Mechanisms,
> or a <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> (to modulate all of the <a class="reference internal" href="ProcessingMechanism.html"><span class="doc">ProcessingMechanisms</span></a> in a Composition – see below).
> A <a class="reference internal" href="ControlProjection.html"><span class="doc">ControlProjection</span></a> is automatically created that projects from the LCControlMechanism to the
287c287
< <strong>modulated_mechanisms</strong> argument.  The Mechanisms modulated by an LCControlMechanism are listed in its
---
> <strong>modulated_mechanisms</strong> argument. The Mechanisms modulated by an LCControlMechanism are listed in its
289c289
< <p>If <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> is assigned as the value of <strong>modulate_mechanisms</strong>, then the LCControlMechanism will modulate all
---
> <p>If a <a class="reference internal" href="Composition.html"><span class="doc">Composition</span></a> is assigned as the value of <strong>modulate_mechanisms</strong>, then the LCControlMechanism will modulate all
291c291
< a the <a class="reference internal" href="ControlMechanism.html#psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism" title="psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a> of another <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanism</span></a>.  Note that only the
---
> as the <a class="reference internal" href="ControlMechanism.html#psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism" title="psyneulink.core.components.mechanisms.modulatory.control.controlmechanism.ControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a> of another <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanism</span></a>.  Note that only the
308c308,309
< <p>If an ObjectiveMechanism is <code class="xref any docutils literal notranslate"><span class="pre">automatically</span> <span class="pre">created</span></code> specified the
---
> <p>If an ObjectiveMechanism is <a class="reference internal" href="#lccontrolmechanism-objectivemechanism-creation"><span class="std std-ref">automatically created</span></a> for an
> LCControlMechanism, it receives its inputs from the <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort(s)</span></a> specified the
322c323
< creating its <code class="xref any docutils literal notranslate"><span class="pre">objective_mechanism</span></code>.  In particular, whereas an
---
> creating its <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>.  In particular, whereas an
324c325
< an LCControlMechanism uses <a class="reference internal" href="TransformFunctions.html#psyneulink.core.components.functions.transformfunctions.CombineMeans" title="psyneulink.core.components.functions.transformfunctions.CombineMeans"><code class="xref any py py-class docutils literal notranslate"><span class="pre">CombineMeans</span></code></a> as the <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> of its <code class="xref any docutils literal notranslate"><span class="pre">objective_mechanism</span></code>.  As a consequence, if an ObjectiveMechanism is explicitly specified in
---
> an LCControlMechanism uses <a class="reference internal" href="TransformFunctions.html#psyneulink.core.components.functions.transformfunctions.CombineMeans" title="psyneulink.core.components.functions.transformfunctions.CombineMeans"><code class="xref any py py-class docutils literal notranslate"><span class="pre">CombineMeans</span></code></a> as the <a class="reference internal" href="ObjectiveMechanism.html#psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function" title="psyneulink.core.components.mechanisms.processing.objectivemechanism.ObjectiveMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> of its <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a>.  As a consequence, if an ObjectiveMechanism is explicitly specified in
330c331
< <p>The ObjectiveFunction is listed in the LCControlMechanism’s <code class="xref any docutils literal notranslate"><span class="pre">objective_mechanism</span></code> attribute.  The OutputPorts it monitors are listed in the
---
> <p>The ObjectiveFunction is listed in the LCControlMechanism’s <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism" title="psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.LCControlMechanism.objective_mechanism"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">objective_mechanism</span></code></a> attribute.  The OutputPorts it monitors are listed in the
430c431
< <em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">psyneulink.library.components.mechanisms.modulatory.control.agt.lccontrolmechanism.</span></span><span class="sig-name descname"><span class="pre">LCControlMechanism</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">default_variable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">default_allocation</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">objective_mechanism</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">monitor_for_control</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">modulated_mechanisms</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">modulation</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">integration_method</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'RK4'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initial_w_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initial_v_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_step_size_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.05</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">t_0_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">a_v_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">0.3333333333333333</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b_v_FitzHughNagumo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</s
...

See CI logs for the full diff.

@coveralls
Copy link

coveralls commented Nov 28, 2024

Coverage Status

coverage: 83.949% (+0.06%) from 83.892%
when pulling 30f3445 on fix/lccontrolmechanism_objectivemechanism
into f91e2a1 on devel.

@jdcpni jdcpni merged commit 8d2fafc into devel Nov 28, 2024
71 checks passed
@jdcpni jdcpni deleted the fix/lccontrolmechanism_objectivemechanism branch November 28, 2024 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants