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

Feat/ocm/state features #2302

Merged
merged 357 commits into from
Feb 3, 2022
Merged

Feat/ocm/state features #2302

merged 357 commits into from
Feb 3, 2022

Conversation

jdcpni
Copy link
Collaborator

@jdcpni jdcpni commented Feb 2, 2022

• mechanism.py:

  • execute(): fix bug in which only primary input_port was tested for path_afferents
    to determine whether to update ports

• controlmechanism.py:

  • _instantiate_input_ports():
    • fix bug in which existing aux_components got over-written when monitor_for_control is specified

• optimizationcontrolmechanism.py:

  • _parse_state_feature_specs():
    • support Port specification dictionary as state_features spec
    • add _assign_state_feature_functions: support tuple format for state_features
    • state_feature_functions -> state_feature_function (user-specified default for state_input_ports)
    • fix bug in which state_input_ports were not getting instantiated
      if objective_mechanism or monitor_for_control were not specifiied

• test_control.py:

  • test_ocm_state_feature_specs_and_warnings_and_errors():
    • add test conditions for monitor_for_control instead of objective_mechanism and neither
  • add test_state_feature_function_specs()

jdcpni and others added 30 commits November 20, 2021 16:11
  _instantiate_control_projections:
     weird requirement for double-call to controller._instantiate_control_signal
  restored parameter spec that causes crash ('threshold',Decision2)
…trol specs

- composition.py
  - _get_control_signals_for_composition:  (see 11/20/21)
      - added (but commented out change) to "if node.controller" to "if not node.controller"
      - changed append to extend
  - _instantiation_control_projection:
      - got rid of try and except double-call to controller._instantiate_control_signals
      -  outdented call to self.controller._activate_projections_for_composition at end

- controlmechanism.py:
    - _check_for_duplicates:  add warning and return duplicates

- optimizationcontrolmechanism._instantiate_control_signals:
    - add call to self.agent_rep._get_control_signals_for_composition() to get local control specs (on mechs in comp)
    - eliminate duplicates with control_signal specs on OCM
    - instantiate local + ocm control_signals

- parameterestimationcomposition.py
  - added context to various calls
   - test_parameterestimationcomposition
   - test_composition/test_partially_overlapping_control_specs (ADDED IN THIS COMMINT)

- All relevant changes to this branch are marked as "11/21/21."
  However, most are commented out as they break other things.

- The tests above both involve local control specifications (on mechanism within a nested comp)
  and on the OCM for the outer composition, some of which are for the same nested mechs

- Both tests fail with:
   "AttributeError: 'NoneType' object has no attribute '_get_by_time_scale'" (in component.py LINE 3276)
   This may be due to a problem with context setting, since the error is because the modulation Parameter
   of the ControlProjection is returning "None" rather than "multiplicative_param" (when called with get(context)),
   whereas "multiplicative_param" is returned with a call to get() (i.e., with no context specified)

- Most of test_partially_overlapping_control_specs is passed if
   changes marked "11/21/21 NEW" in optimizationcontrolmechanism.py (LINE 1390) are implemented,
   but it does not properly route ControlProjections through parameter_CIMS (see last assert in test).
   Furthermore, test_parameterestimationcompsition fails with the mod param error, even though the
   model has similar structure (i.e., outer composition -- in this case a ParameterEstimationComposition)
   with an OCM that is given control specs that overlap with ones in a nested composition.

- There are also several other things in composition I found puzzling and tried modifying, but that cuased failures:
  - _get_control_signals_for_composition():
      - seems "if node.controller" should be "if **not** node.controller" (emphasis added just for comment)
      - "append" should be "extend"
  - _instantiate_control_projection():
      -  call to self.controller._activate_projections_for_composition (at end of method) should not be indented
  - rename _check_projection_initialization_status -> _check_controller_initialization_status
  - add _check_nodes_initialization_status(context=context)
    (and calls it with _check_controller_initialization_status)
  retore append of control_signals in _instantiate_control_projections()
  restore append of control_signals in _instantiate_control_projections()

• test_composition.py:
  add test_partially_overlapping_local_and_control_mech_control_specs_in_unnested_and_nested_comp
…unnested_and_nested_comp():

  - added clear_registry() to allow names to be reused in both runs of test
  docstring:  added projections entry to list of attributes
  - add_controller:  added call to _add_node_aux_components() for controller
  _add_node_aux_components(): added deletion of item from aux_components if instantiated
  - comment out _add_node_aux_components() (causing new failures)
  - move _instantiate_control_projections to be with _instantiate_control_projections,
       after self.add_node(self.controller.objective_mechanism (to be more orderly)
jdcpni and others added 22 commits January 30, 2022 21:03
  - _parse_state_feature_specs():  support port specification dictionary as spec
  - _parse_state_feature_specs():
    fix bug in which state_input_ports were not getting instantiated
    if objective_mechanism or monitor_for_control were not specifiied
  - _parse_state_feature_specs():
    fix bug in which state_input_ports were not getting instantiated
    if objective_mechanism or monitor_for_control were not specifiied
  - test_ocm_state_feature_specs_and_warnings_and_errors():
    - add test conditions for monitor_for_control instead of objective_mechanism and neither
  - add _assign_state_feature_functions: support tuple format for state_features
…Link into feat/ocm/state_features

� Conflicts:
�	psyneulink/core/components/mechanisms/modulatory/control/optimizationcontrolmechanism.py
�	tests/composition/test_control.py
  - add test_state_feature_function_specs()
  - execute(): fix bug in which only primary input_port is tested for path_afferents
               to determine whether to update ports
  - _assign_state_feature_function():  tuple overrides InputPort specification dict
@github-actions
Copy link

github-actions bot commented Feb 2, 2022

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

diff -r docs-base/ControlMechanism.html docs-head/ControlMechanism.html
1018c1018
< <dd><p>Subclassess can override for class-specific implementation (see OptimizationControlMechanism for example)</p>
---
> <dd><p>Subclasses can override for class-specific implementation (see OptimizationControlMechanism for example)</p>
diff -r docs-base/OptimizationControlMechanism.html docs-head/OptimizationControlMechanism.html
240c240
< <li><p><a class="reference internal" href="#optimizationcontrolmechanism-state-feature-functions-arg"><span class="std std-ref">State Feature Functions</span></a></p></li>
---
> <li><p><a class="reference internal" href="#optimizationcontrolmechanism-state-feature-function-arg"><span class="std std-ref">State Feature Functions</span></a></p></li>
447c447
< (e.g., modulate and/or intergrate them) before them as <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_feature_values</span> <span class="pre">state_feature_values</span></code></a> (see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-functions-arg"><span class="std std-ref">below</span></a>). Note that assigning <strong>state_features</strong> explicilty
---
> (e.g., modulate and/or intergrate them) before them as <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_feature_values</span> <span class="pre">state_feature_values</span></code></a> (see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-function-arg"><span class="std std-ref">below</span></a>). Note that assigning <strong>state_features</strong> explicitly
509c509,514
< <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_port</span></code></a> (see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-functions-arg"><span class="std std-ref">state feature functions</span></a> for additional details).</p></li>
---
> <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_port</span></code></a> (see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-function-arg"><span class="std std-ref">state_feature_function</span></a> for additional details).</p></li>
> </ul>
> <ul class="simple">
> <li><p><em>specification dictionary</em> – an <a class="reference internal" href="InputPort.html#inputport-specification-dictionary"><span class="std std-ref">InputPort specification dictionary</span></a>
> can be used to configure the corresponding <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_port</span></code></a>,
> if <a class="reference internal" href="Parameters.html#psyneulink.core.globals.parameters.Parameter" title="psyneulink.core.globals.parameters.Parameter"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Parameters</span></code></a> other than its <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> need to be specified (e.g., its <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.name" title="psyneulink.core.components.ports.inputport.InputPort.name"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">name</span></code></a> or more than a single <a class="reference internal" href="Mechanism.html#id14" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">afferent</span> <span class="pre">Projection</span></code></a>).</p></li>
580,590c585,593
< <ul id="optimizationcontrolmechanism-state-feature-functions-arg">
< <li><p><strong>state_feature_functions</strong> – specifies the <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function(s)</span></code></a> assigned to the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> created for each of the corresponding <strong>state_features</strong>.
< If <strong>state_feature_functions</strong> is not specified, the identity function is assigned to all of the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> (whether those were created automatically or explicitly specified;
< see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-arg"><span class="std std-ref">above</span></a>).  However, other functions can be specified
< individually for the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> associated with each
< state_feature. This can be useful, for example to provide an average or integrated value of prior inputs, to
< select specific inputs for use (see <code class="xref any docutils literal notranslate"><span class="pre">hint</span></code> above), and/or use a
< generative model of the environment to provide inputs to the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">agent_rep</span></code></a>
< during the optimization process. This can be done by specifying the <strong>state_feature_functions</strong> argument with a
< dict with keys that match each of the specifications in the <strong>state_features</strong> argument, and corresponding values
< that specify the function to use for each.</p>
---
> <ul id="optimizationcontrolmechanism-state-feature-function-arg">
> <li><p><strong>state_feature_function</strong> – specifies a <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> to be used as the default function for
> <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a>.  If it is not specified, <a class="reference internal" href="CombinationFunctions.html#psyneulink.core.components.functions.combinationfunctions.LinearCombination" title="psyneulink.core.components.functions.combinationfunctions.LinearCombination"><code class="xref any py py-class docutils literal notranslate"><span class="pre">LinearCombination</span></code></a>
> (the standard default <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> for an <a class="reference internal" href="InputPort.html"><span class="doc">InputPort</span></a>) is used. If it <em>is</em> specified, and functions are specified for
> any individual <code class="xref any docutils literal notranslate"><span class="pre">state_input_ports</span> <span class="pre">&lt;OptimizationControlMechanism.state_input_ports</span></code> using either an <a class="reference internal" href="InputPort.html#inputport-specification-dictionary"><span class="std std-ref">InputPort
> specification dictionary</span></a> or a <a class="reference internal" href="#optimization-control-mechanism-tuple-state-feature"><span class="std std-ref">2-item tuple</span></a> in the <strong>state_features</strong> argument (see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-arg"><span class="std std-ref">state_features</span></a>), those override the function specified in <strong>state_features</strong>.
> Specifying functions for <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> can be useful,
> for example to provide an average or integrated value of prior inputs to the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">agent_rep</span></code></a>'s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.evaluate" title="psyneulink.core.compositions.composition.Composition.evaluate"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">evaluate</span></code></a> method during the optimization
> process, or to use a generative model of the environment to provide those inputs.</p>
594,597c597,598
< <p>A dict can be used to specify <strong>state_feature_functions</strong> only if <strong>state_features</strong> are specified explicitly
< (see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-arg"><span class="std std-ref">above</span></a>). The dict must contain one entry for
< each of the items specified in <strong>state_features</strong>, and the value returned by each function must preserve the
< shape of its input, which must match that of the corresponding input to the Composition’s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.run" title="psyneulink.core.compositions.composition.Composition.run"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">run</span></code></a> method (see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-shapes"><span class="std std-ref">note</span></a> above).</p>
---
> <p>The value returned by a function assigned to the <strong>state_feature_function</strong> agument must preserve the
> shape of its input, and must also accommodate the shape of the inputs to all of the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> to which it is assigned (see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-shapes"><span class="std std-ref">note</span></a> above).</p>
901c902
< <em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.</span></span><span class="sig-name descname"><span class="pre">OptimizationControlMechanism</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">agent_rep=None</span></em>, <em class="sig-param"><span class="pre">state_features=None</span></em>, <em class="sig-param"><span class="pre">state_feature_functions=None</span></em>, <em class="sig-param"><span class="pre">monitor_for_control=None</span></em>, <em class="sig-param"><span class="pre">objective_mechanism=None</span></em>, <em class="sig-param"><span class="pre">function=GridSearch</span></em>, <em class="sig-param"><span class="pre">num_estimates=1</span></em>, <em class="sig-param"><span class="pre">random_variables=ALL</span></em>, <em class="sig-param"><span class="pre">initial_seed=None</span></em>, <em class="sig-param"><span class="pre">same_seed_for_all_parameter_combinations=False</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">num_trials_per_estimate=None</span></em>, <em class="sig-param"><span class="pre">search_function=None</span></em>, <em class="sig-param"><span class="pre">search_termination_function=None</span></em>, <em class="sig-param"><span class="pre">search_space=None</span></em>, <em class="sig-param"><span class="pre">control_signals=None</span></em>, <em class="sig-param"><span class="pre">modulation=MULTIPLICATIVE</span></em>, <em class="sig-param"><span class="pre">combine_costs=np.sum</span></em>, <em class="sig-param"><span class="pre">compute_reconfiguration_cost=None</span></em>, <em class="sig-param"><span class="pre">compute_net_outcome=lambda</span> <span class="pre">x</span></em>, <em class="sig-param"><span class="pre">y:x-y</span></em><span class="sig-paren">)</span><a class="headerlink" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism" title="Permalink to this definition">¶</a></dt>
---
> <em
...

See CI logs for the full diff.

@github-actions
Copy link

github-actions bot commented Feb 2, 2022

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

diff -r docs-base/ControlMechanism.html docs-head/ControlMechanism.html
1018c1018
< <dd><p>Subclassess can override for class-specific implementation (see OptimizationControlMechanism for example)</p>
---
> <dd><p>Subclasses can override for class-specific implementation (see OptimizationControlMechanism for example)</p>
diff -r docs-base/OptimizationControlMechanism.html docs-head/OptimizationControlMechanism.html
240c240
< <li><p><a class="reference internal" href="#optimizationcontrolmechanism-state-feature-functions-arg"><span class="std std-ref">State Feature Functions</span></a></p></li>
---
> <li><p><a class="reference internal" href="#optimizationcontrolmechanism-state-feature-function-arg"><span class="std std-ref">State Feature Functions</span></a></p></li>
447c447
< (e.g., modulate and/or intergrate them) before them as <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_feature_values</span> <span class="pre">state_feature_values</span></code></a> (see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-functions-arg"><span class="std std-ref">below</span></a>). Note that assigning <strong>state_features</strong> explicilty
---
> (e.g., modulate and/or intergrate them) before them as <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_feature_values</span> <span class="pre">state_feature_values</span></code></a> (see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-function-arg"><span class="std std-ref">below</span></a>). Note that assigning <strong>state_features</strong> explicitly
509c509,515
< <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_port</span></code></a> (see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-functions-arg"><span class="std std-ref">state feature functions</span></a> for additional details).</p></li>
---
> <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_port</span></code></a>;  this takes precedence over any other
> state_feature_function specifications (see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-function-arg"><span class="std std-ref">state_feature_function</span></a> for additional details).</p></li>
> </ul>
> <ul class="simple">
> <li><p><em>specification dictionary</em> – an <a class="reference internal" href="InputPort.html#inputport-specification-dictionary"><span class="std std-ref">InputPort specification dictionary</span></a>
> can be used to configure the corresponding <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_port</span></code></a>,
> if <a class="reference internal" href="Parameters.html#psyneulink.core.globals.parameters.Parameter" title="psyneulink.core.globals.parameters.Parameter"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Parameters</span></code></a> other than its <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> need to be specified (e.g., its <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.name" title="psyneulink.core.components.ports.inputport.InputPort.name"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">name</span></code></a> or more than a single <a class="reference internal" href="Mechanism.html#id14" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">afferent</span> <span class="pre">Projection</span></code></a>).</p></li>
580,590c586,595
< <ul id="optimizationcontrolmechanism-state-feature-functions-arg">
< <li><p><strong>state_feature_functions</strong> – specifies the <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function(s)</span></code></a> assigned to the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> created for each of the corresponding <strong>state_features</strong>.
< If <strong>state_feature_functions</strong> is not specified, the identity function is assigned to all of the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> (whether those were created automatically or explicitly specified;
< see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-arg"><span class="std std-ref">above</span></a>).  However, other functions can be specified
< individually for the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> associated with each
< state_feature. This can be useful, for example to provide an average or integrated value of prior inputs, to
< select specific inputs for use (see <code class="xref any docutils literal notranslate"><span class="pre">hint</span></code> above), and/or use a
< generative model of the environment to provide inputs to the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">agent_rep</span></code></a>
< during the optimization process. This can be done by specifying the <strong>state_feature_functions</strong> argument with a
< dict with keys that match each of the specifications in the <strong>state_features</strong> argument, and corresponding values
< that specify the function to use for each.</p>
---
> <ul id="optimizationcontrolmechanism-state-feature-function-arg">
> <li><p><strong>state_feature_function</strong> – specifies a <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> to be used as the default function
> for <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a>.  If it is not specified, and no other
> <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> is specified (e.g., in an InputPort specification dictionary &lt;InputPort_Specification_Dictionary&gt;`,
> then <a class="reference internal" href="CombinationFunctions.html#psyneulink.core.components.functions.combinationfunctions.LinearCombination" title="psyneulink.core.components.functions.combinationfunctions.LinearCombination"><code class="xref any py py-class docutils literal notranslate"><span class="pre">LinearCombination</span></code></a> (the standard default <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> for an <a class="reference internal" href="InputPort.html"><span class="doc">InputPort</span></a>) is used. If it <em>is</em> specified,
> and functions are specified for any individual <code class="xref any docutils literal notranslate"><span class="pre">state_input_ports</span> <span class="pre">&lt;OptimizationControlMechanism.state_input_ports</span></code>
> using either an <a class="reference internal" href="InputPort.html#inputport-specification-dictionary"><span class="std std-ref">InputPort specification dictionary</span></a> or a <a class="reference internal" href="#optimization-control-mechanism-tuple-state-feature"><span class="std std-ref">2-item tuple</span></a> in the <strong>state_features</strong> argument (see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-arg"><span class="std std-ref">state_features</span></a>), those override the function specified in <strong>state_features</strong>.
> Specifying functions for <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> can be useful,
> for example to provide an average or integrated value of prior inputs to the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">agent_rep</span></code></a>'s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.evaluate" title="psyneulink.core.compositions.composition.Composition.evaluate"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">evaluate</span></code></a> method during the optimization
> process, or to use a generative model of the environment to provide those inputs.</p>
594,597c599,600
< <p>A dict can be used to specify <strong>state_feature_functions</strong> only if <strong>state_features</strong> are specified explicitly
< (see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-arg"><span class="std std-ref">above</span></a>). The dict must contain one entry for
< each of the items specified in <strong>state_features</strong>, and the value returned by each function must preserve the
< shape of its input, which must match that of the corresponding input to the Composition’s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.run" title="psyneulink.core.compositions.composition.Composition.run"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">run</span></code></a> method (see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-shapes"><span class="std std-ref">note</span></a> above).</p>
---
> <p>The value returned by a function assigned to the <strong>state_feature_function</strong> agument must preserve the
> shape of its input, and must also accommodate the shape of the inputs to all of the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> to which it is assigned (see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-shapes"><span class="std std-ref">note</span></a> above).</p>
901c904
< <em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.</span></span><span class="sig-name descname"><span class="pre">OptimizationControlMechanism</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">agent_rep=None</span></em>, <em class="sig-param"><span class="pre">state_features=None</span></em>, <em class="sig-param"><span class="pre">state_feature_functions=None</span></em>, <em class="sig-param"><span class="pre">monitor_for_control=None</span></em>, <em class="sig-param"><span class="pre">objective_mechanism=None</span></em>, <em class="sig-param"><span class="pre">function=GridSearch</span></em>, <em class="sig-param"><span class="pre">num_estimates=1</span></em>, <em class="sig-param"><span class="pre">random_variables=ALL</span></em>, <em class="sig-param"><span class="pre">initial_seed=None</span></em>, <em class="sig-param"><span class="pre">same_seed_for_all_parameter_combinations=False</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="pre">num_trials_per_estimate=None</span></em>, <em class="sig-param"><span class="pre">search_function=None</span></em>, <em class="sig-param"><span class="pre">search_termination_function=None</span></em>, <em class="sig-param"><span class="pre">search_space=None</span></em>, <em class="sig-param"><span class="pre">control_signals=None</span></em>, <em class="sig-param"><span class="pre">modulation=MULTIPLICATIVE</span></em>, <em class="sig-param"><span class="pre">combine_costs=np.sum</span></em>, <em class="sig-param"><span class="pre">compute_reconfiguration_cost=None</span></em>, <em class="sig-param"><span class="pre">compute_net_outcome=lambda</span> <span class="pre">x</span></em>
...

See CI logs for the full diff.

@coveralls
Copy link

coveralls commented Feb 2, 2022

Coverage Status

Coverage increased (+0.02%) to 84.571% when pulling c8b7786 on feat/ocm/state_features into 3a8bf9d on devel.

@github-actions
Copy link

github-actions bot commented Feb 2, 2022

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

diff -r docs-base/ControlMechanism.html docs-head/ControlMechanism.html
1018c1018
< <dd><p>Subclassess can override for class-specific implementation (see OptimizationControlMechanism for example)</p>
---
> <dd><p>Subclasses can override for class-specific implementation (see OptimizationControlMechanism for example)</p>
diff -r docs-base/OptimizationControlMechanism.html docs-head/OptimizationControlMechanism.html
240c240
< <li><p><a class="reference internal" href="#optimizationcontrolmechanism-state-feature-functions-arg"><span class="std std-ref">State Feature Functions</span></a></p></li>
---
> <li><p><a class="reference internal" href="#optimizationcontrolmechanism-state-feature-function-arg"><span class="std std-ref">State Feature Functions</span></a></p></li>
447c447
< (e.g., modulate and/or intergrate them) before them as <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_feature_values</span> <span class="pre">state_feature_values</span></code></a> (see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-functions-arg"><span class="std std-ref">below</span></a>). Note that assigning <strong>state_features</strong> explicilty
---
> (e.g., modulate and/or intergrate them) before them as <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_feature_values"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_feature_values</span> <span class="pre">state_feature_values</span></code></a> (see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-function-arg"><span class="std std-ref">below</span></a>). Note that assigning <strong>state_features</strong> explicitly
507,509c507,517
< <li><p><em>2-item tuple</em> – the first item must be a <a class="reference internal" href="Port.html"><span class="doc">Port</span></a> or <a class="reference internal" href="Mechanism.html"><span class="doc">Mechanism</span></a> specification, as described below; the
< second item must be a <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> that is assigned as the <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> of the corresponding
< <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_port</span></code></a> (see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-functions-arg"><span class="std std-ref">state feature functions</span></a> for additional details).</p></li>
---
> <li><p><em>2-item tuple</em> – the first item must be a <a class="reference internal" href="Port.html"><span class="doc">Port</span></a> or <a class="reference internal" href="Mechanism.html"><span class="doc">Mechanism</span></a> specification, as described below;
> the second item must be a <a class="reference internal" href="Function.html"><span class="doc">Function</span></a>, that is assigned as the <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> of the
> corresponding <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_port</span></code></a>;
> this takes precedence over any other state_feature_function specifications (e.g., in an <a class="reference internal" href="InputPort.html#inputport-specification-dictionary"><span class="std std-ref">InputPort
> specification dictionary</span></a> or the <strong>state_feature_function</strong> argument
> of the OptimizationControlMechanism’s constructor; see <a class="reference internal" href="#optimizationcontrolmechanism-state-feature-function-arg"><span class="std std-ref">state_feature_function</span></a> for additional details).</p></li>
> </ul>
> <ul class="simple">
> <li><p><em>specification dictionary</em> – an <a class="reference internal" href="InputPort.html#inputport-specification-dictionary"><span class="std std-ref">InputPort specification dictionary</span></a>
> can be used to configure the corresponding <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_port</span></code></a>,
> if <a class="reference internal" href="Parameters.html#psyneulink.core.globals.parameters.Parameter" title="psyneulink.core.globals.parameters.Parameter"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Parameters</span></code></a> other than its <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> need to be specified (e.g., its <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.name" title="psyneulink.core.components.ports.inputport.InputPort.name"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">name</span></code></a> or more than a single <a class="reference internal" href="Mechanism.html#id14" title="psyneulink.core.components.mechanisms.mechanism.Mechanism_Base.afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">afferent</span> <span class="pre">Projection</span></code></a>).</p></li>
580,590c588,597
< <ul id="optimizationcontrolmechanism-state-feature-functions-arg">
< <li><p><strong>state_feature_functions</strong> – specifies the <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function(s)</span></code></a> assigned to the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> created for each of the corresponding <strong>state_features</strong>.
< If <strong>state_feature_functions</strong> is not specified, the identity function is assigned to all of the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> (whether those were created automatically or explicitly specified;
< see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-arg"><span class="std std-ref">above</span></a>).  However, other functions can be specified
< individually for the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> associated with each
< state_feature. This can be useful, for example to provide an average or integrated value of prior inputs, to
< select specific inputs for use (see <code class="xref any docutils literal notranslate"><span class="pre">hint</span></code> above), and/or use a
< generative model of the environment to provide inputs to the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">agent_rep</span></code></a>
< during the optimization process. This can be done by specifying the <strong>state_feature_functions</strong> argument with a
< dict with keys that match each of the specifications in the <strong>state_features</strong> argument, and corresponding values
< that specify the function to use for each.</p>
---
> <ul id="optimizationcontrolmechanism-state-feature-function-arg">
> <li><p><strong>state_feature_function</strong> – specifies a <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> to be used as the default
> function for <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a>. This is assigned as
> the <a class="reference internal" href="InputPort.html#psyneulink.core.components.ports.inputport.InputPort.function" title="psyneulink.core.components.ports.inputport.InputPort.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> to any state_input_ports for which no other <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> is specified;
> i.e., in an InputPort specification dictionary &lt;InputPort_Specification_Dictionary&gt;` or <a class="reference internal" href="#optimization-control-mechanism-tuple-state-feature"><span class="std std-ref">2-item tuple</span></a> in the <strong>state_features</strong> argument (see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-arg"><span class="std std-ref">state_features</span></a>).  If either of the latter is specified, they override
> the specification in <strong>state_feature_function</strong>.  If it is <em>not</em> specified, then <a class="reference internal" href="CombinationFunctions.html#psyneulink.core.components.functions.combinationfunctions.LinearCombination" title="psyneulink.core.components.functions.combinationfunctions.LinearCombination"><code class="xref any py py-class docutils literal notranslate"><span class="pre">LinearCombination</span></code></a>
> (the standard default <a class="reference internal" href="Function.html"><span class="doc">Function</span></a> for an <a class="reference internal" href="InputPort.html"><span class="doc">InputPort</span></a>) is assigned to any <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> that are not otherwise assigned a <a class="reference internal" href="Function.html"><span class="doc">Function</span></a>.
> Specifying functions for <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">state_input_ports</span></code></a> can be useful,
> for example to provide an average or integrated value of prior inputs to the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep" title="psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.agent_rep"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">agent_rep</span></code></a>'s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.evaluate" title="psyneulink.core.compositions.composition.Composition.evaluate"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">evaluate</span></code></a> method during the optimization
> process, or to use a generative model of the environment to provide those inputs.</p>
594,597c601,602
< <p>A dict can be used to specify <strong>state_feature_functions</strong> only if <strong>state_features</strong> are specified explicitly
< (see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-arg"><span class="std std-ref">above</span></a>). The dict must contain one entry for
< each of the items specified in <strong>state_features</strong>, and the value returned by each function must preserve the
< shape of its input, which must match that of the corresponding input to the Composition’s <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.run" title="psyneulink.core.compositions.composition.Composition.run"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">run</span></code></a> method (see <a class="reference internal" href="#optimizationcontrolmechanism-state-features-shapes"><span class="std std-ref">note</span></a> above).</p>
---
> <p>The value returned by a function assigned to the <strong>state_feature_function</strong> argument must preserve the
> shape of its input, and must also accommodate the shape of the inputs to all of the <a class="reference internal" href="#psyneulink.core.components.mechanisms.modulatory.control.optimizationcontrolmechanism.OptimizationControlMechanism.state_input_ports" title="psyneulink.core.components.mech
...

See CI logs for the full diff.

@jdcpni jdcpni merged commit 1b23904 into devel Feb 3, 2022
@jdcpni jdcpni deleted the feat/ocm/state_features branch February 3, 2022 02:54
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.

None yet

3 participants