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

Docs/cim figure #2252

Merged
merged 289 commits into from
Dec 19, 2021
Merged

Docs/cim figure #2252

merged 289 commits into from
Dec 19, 2021

Conversation

jdcpni
Copy link
Collaborator

@jdcpni jdcpni commented Dec 19, 2021

• compositioninterfacemechanism.py: add figure and example

jdcpni and others added 30 commits November 10, 2021 20:09
…ut_ports

# Conflicts:
#	psyneulink/core/components/mechanisms/modulatory/control/optimizationcontrolmechanism.py
  - __init__: moved controller instantiation until after nodes, projections and pathways
  - __init__: restored add_controller position
…teger

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
…ut_ports

# Conflicts:
#	psyneulink/core/llvm/builder_context.py
  - _update_controller: added
  - add_controller and _analyze_graph(): call _update_controller
  _update_controller:  fixed to loop through all input_ports of comp INPUT nodes
  - test_agent_rep_assignement_as_controller_and_replacement:
      updated to test that shadowing projections to state_input_ports
      are properly added and deleted
…Link into refactor/ocm/state_input_ports

� Conflicts:
�	tests/composition/test_control.py
  - _function: refactored to put use aggregation_function at end
  - _grid_evaluate:  still needs to return all_samples
…rincetonUniversity/PsyNeuLink into refactor/ocm/state_input_ports

� Conflicts:
�	psyneulink/core/components/mechanisms/modulatory/control/optimizationcontrolmechanism.py
  - added call to _update_controller to add_node
  - moved test for projections to controller.state_input_ports to run()
  moved calls to _update_controller to _complete_init_of_partially_initialized_nodes
  moved _update_controller to ocm._update_state_input_ports

• optimizationcontrolmechanism.py:
  added _update_state_input_ports [**still needed work**]
  moved calls to _update_controller to _complete_init_of_partially_initialized_nodes
  moved _update_controller to ocm._update_state_input_ports
  _instantiate_controller_shadow_projections [still needs to be implemented]

• optimizationcontrolmechanism.py:
  added _update_state_input_ports [**still needed work**]
  added needs_update_controller
  - implemented self.needs_update_controller
  - moved implementation of controlsignal projections
    from add_controller to _instantiate_control_projections
    that is called in _complete_init_of_partially_initialized_nodes

Note: still need to set  self.needs_update_controller to False
      after instantiating state_input_ports and projections to them
jdcpni and others added 26 commits December 16, 2021 21:56
…m/PrincetonUniversity/PsyNeuLink into feat/comp/mult_proj_between_nodes

� Conflicts:
�	psyneulink/core/components/mechanisms/mechanism.py
�	psyneulink/core/compositions/composition.py
  add_projection:  working on adding support for projection sets
  - add _get_nested_nodes_with_same_roles_at_all_levels
  - add_linear_processing_pathway:
    call _get_nested_nodes_with_same_roles_at_all_levels
  - add_linear_processing_pathway:  add support for inline specification of set of Projections
  add_linear_processing_pathway: refactored to support inline specification of sets of Projections
  add_linear_processing_pathway: docstring edits for Projection set specification
…m/PrincetonUniversity/PsyNeuLink into feat/comp/mult_proj_between_nodes

� Conflicts:
�	psyneulink/core/compositions/composition.py
  - add test_add_multiple_projections_for_nested_compositions - IN PROGRESS
  - add test_add_multiple_projections_for_nested_compositions - passes
@github-actions
Copy link

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

diff -r docs-base/CompositionInterfaceMechanism.html docs-head/CompositionInterfaceMechanism.html
235,236c235
< constructed (and should never be constructed manually):  <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.input_CIM" title="psyneulink.core.compositions.composition.Composition.input_CIM"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">input_CIM</span></code></a>, <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.parameter_CIM" title="psyneulink.core.compositions.composition.Composition.parameter_CIM"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">parameter_CIM</span></code></a> and <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.output_CIM" title="psyneulink.core.compositions.composition.Composition.output_CIM"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">output_CIM</span></code></a> (see <a class="reference internal" href="Composition.html#composition-cims"><span class="std std-ref">CompositionInterfaceMechanisms</span></a> for additional details).
< They can be seen graphically using the <code class="xref any docutils literal notranslate"><span class="pre">show_cim</span></code> option of the Composition’s <a class="reference internal" href="Visualization.html#showgraph-show-graph-method"><span class="std std-ref">show_graph</span></a> method.</p>
---
> constructed (and should never be constructed manually):  <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.input_CIM" title="psyneulink.core.compositions.composition.Composition.input_CIM"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">input_CIM</span></code></a>, <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.parameter_CIM" title="psyneulink.core.compositions.composition.Composition.parameter_CIM"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">parameter_CIM</span></code></a> and <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.output_CIM" title="psyneulink.core.compositions.composition.Composition.output_CIM"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">output_CIM</span></code></a> (see <a class="reference internal" href="Composition.html#composition-cims"><span class="std std-ref">CompositionInterfaceMechanisms</span></a> for additional details).</p>
244c243,272
< <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort</span></a>) pair used to transmit the information to or from the CompositionInterfaceMechanism.</p>
---
> <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort</span></a>) pair used to transmit the information to or from the CompositionInterfaceMechanism.
> CompositionIntefaceMechanisms can be seen graphically using the <code class="xref any docutils literal notranslate"><span class="pre">show_cim</span></code> option of the
> Composition’s <a class="reference internal" href="Visualization.html#showgraph-show-graph-method"><span class="std std-ref">show_graph</span></a> method (see figure below).</p>
> <figure class="align-default" id="id1">
> <a class="reference internal image-reference" href="_static/CIM_figure.svg"><img alt="_static/CIM_figure.svg" src="_static/CIM_figure.svg" /></a>
> <figcaption>
> <p><span class="caption-text"><strong>Examples of Projections to nested Compositions routed through CompositionInterfaceMechanisms.</strong>  <em>Panel A:</em>
> Simple example showing a basic configuration.  <em>Panel B:</em>  More complex configuration, generated from script below,
> showing Projections automatically created from the Node of an outer Composition (<em>X</em>) to two <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.NodeRole.INPUT" title="psyneulink.core.compositions.composition.NodeRole.INPUT"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">INPUT</span></code></a> <a class="reference internal" href="Composition.html#composition-nodes"><span class="std std-ref">Nodes</span></a> of a <a class="reference internal" href="Composition.html#composition-nested"><span class="std std-ref">nested Composition</span></a>, a <a class="reference internal" href="ControlProjection.html"><span class="doc">ControlProjection</span></a>
> from a <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanism</span></a> in the outer Composition to a Node it modulates in the nested one, and from a <a class="reference internal" href="Composition.html#id18" title="psyneulink.core.compositions.composition.NodeRole.PROBE"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">PROBE</span></code></a> Node (<em>B</em>) in the nested Composition to the <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanism</span></a> that monitors it.</span><a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>
> <div class="legend">
> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">A</span> <span class="o">=</span> <span class="n">ProcessingMechanism</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;A&#39;</span><span class="p">)</span>
> <span class="n">B</span> <span class="o">=</span> <span class="n">ProcessingMechanism</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;B&#39;</span><span class="p">)</span>
> <span class="n">C</span> <span class="o">=</span> <span class="n">ProcessingMechanism</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;C&#39;</span><span class="p">)</span>
> <span class="n">D</span> <span class="o">=</span> <span class="n">ProcessingMechanism</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;D&#39;</span><span class="p">)</span>
> <span class="n">E</span> <span class="o">=</span> <span class="n">ProcessingMechanism</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;E&#39;</span><span class="p">)</span>
> <span class="n">F</span> <span class="o">=</span> <span class="n">ProcessingMechanism</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;F&#39;</span><span class="p">)</span>
> <span class="n">nested_comp</span> <span class="o">=</span> <span class="n">Composition</span><span class="p">(</span><span class="n">pathways</span><span class="o">=</span><span class="p">[[</span><span class="n">A</span><span class="p">,</span><span class="n">B</span><span class="p">,</span><span class="n">C</span><span class="p">],</span> <span class="p">[</span><span class="n">D</span><span class="p">,</span><span class="n">E</span><span class="p">,</span><span class="n">F</span><span class="p">]],</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;NESTED COMPOSITION&#39;</span><span class="p">)</span>
> <span class="n">X</span> <span class="o">=</span> <span class="n">ProcessingMechanism</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;INPUT NODE&#39;</span><span class="p">)</span>
> <span class="n">Y</span> <span class="o">=</span> <span class="n">ProcessingMechanism</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;OUTPUT NODE&#39;</span><span class="p">)</span>
> <span class="n">C</span> <span class="o">=</span> <span class="n">ControlMechanism</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;CONTROL MECHANISM&#39;</span><span class="p">,</span>
>                      <span class="n">monitor_for_control</span><span class="o">=</span><span class="n">B</span><span class="p">,</span>
>                      <span class="n">control</span><span class="o">=</span><span class="p">(</span><span class="s2">&quot;slope&quot;</span><span class="p">,</span> <span class="n">E</span><span class="p">))</span>
> <span class="n">outer_comp</span> <span class="o">=</span> <span class="n">Composition</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;OUTER COMPOSITION&#39;</span><span class="p">,</span> <span class="n">pathways</span><span class="o">=</span><span class="p">[</span><span class="n">X</span><span class="p">,</span> <span class="n">nested_comp</span><span class="p">,</span> <span class="n">Y</span><span class="p">,</span> <span class="n">C</span><span class="p">])</span>
> <span class="n">outer_comp</span><span class="o">.</span><span class="n">show_graph</span><span class="p">(</span><span class="n">show_cim</span><span class="o">=</span><span class="n">NESTED</span><span class="p">,</span> <span class="n">show_node_structure</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
> </pre></div>
> </div>
> </div>
> </figcaption>
> </figure>
Only in docs-head/_static: CIM_FIgure.svg
diff -r docs-base/searchindex.js docs-head/searchindex.js
1c1
< Search.setIndex({docnames:["AGT","AGTControlMechanism","AutoAssociativeLearningMechanism","AutoAssociativeProjection","AutodiffComposition","BasicsAndPrimer","BotvinickConflictMonitoringModel","BustamanteStroopXORLVOCModel","Cohen_HustonModel","CombinationFunctions","ComparatorMechanism","Compilation","Component","Components","Composition","CompositionFunctionApproximator","CompositionInterfaceMechanism","Compositions","Condition","Context","ContrastiveHebbianMechanism","ContributorsGuide","ControlMechanism","ControlMechanisms","ControlProjection","ControlProjections","ControlSignal","ConventionsAndDefinitions","Core","DDM","DefaultControlMechanism","Defaults","DistributionFunctions","EVC","EVCAuxiliary","EVCControlMechanism","EpisodicMemoryMechanism","Function","Functions","GatingMechanism","GatingMechanisms","GatingProjection","GatingProjections","GatingSignal","GilzenratModel","InputPort","IntegratorFunctions","IntegratorMechanism","IntegratorMechanisms","KWTAMechanism","Keywords","KohonenMechanism","LCAMechanism","LCControlMechanism","LCMechanism","LeabraMechanism","LearningFunctions","LearningMechanism","LearningMechanisms","LearningProjection","LearningProjections","LearningSignal","Library","Log","MappingProjection","MaskedMappingProjection","Mechanism","Mechanisms","MemoryFunctions","Models","ModulatoryMechanism","ModulatoryMechanisms","ModulatoryProjection","ModulatoryProjections","ModulatorySignal","MontagueModel","NieuwenhuisModel","NonStatefulFunctions","ObjectiveFunctions","ObjectiveMechanism","ObjectiveMechanisms","OptimizationControlMechanism","OptimizationFunctions","OutputPort","PCTC_model","ParameterEstimationComposition","ParameterPort","Parameters","Pathway","PathwayProjection","PathwayProjections","Port","PredictionErrorMechanism","Preferences","ProcessingMechanism","ProcessingMechanisms","Projection","Projections","QuickReference","RecurrentTransferMechanism","RefactoredLearningGuide","Registry","RegressionCFA","Report","Scheduler","Scheduling","SelectionFunctions","Services","StatefulFunction","StatefulFunctions","Subystems","Time","TransferFunctions","TransferMechanism","TransferMechanisms","UserDefinedFunction","UserGuide","UserGuide_TBD","Visualization","globals","index","index_logo_with_text","json"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,sphinx:56},filenames:["AGT.rst","AGTControlMechanism.rst","AutoAssociativeLearningMechanism.rst","AutoAssociativeProjection.rst","AutodiffComposition.rst","BasicsAndPrimer.rst","BotvinickConflictMonitoringModel.rst","BustamanteStroopXORLVOCModel.rst","Cohen_HustonModel.rst","CombinationFunctions.rst","ComparatorMechanism.rst","Compilation.rst","Component.rst","Components.rst","Composition.rst","CompositionFunctionApproximator.rst","CompositionInterfaceMechanism.rst","Compositions.rst","Condition.rst","Context.rst","ContrastiveHebbianMechanism.rst","ContributorsGuide.rst","ControlMechanism.rst","ControlMechanisms.rst","ControlProjection.rst","ControlProjections.rst","ControlSignal.rst","ConventionsAndDefinitions.rst","Core.rst","DDM.rst","DefaultControlMechanism.rst","Defaults.rst","DistributionFunctions.rst","EVC.rst","EVCAuxiliary.rst","EVCControlMechanism.rst","EpisodicMemoryMechanism.rst","Function.rst","Functions.rst","GatingMechanism.rst","GatingMechanisms.rst","GatingProjection.rst","GatingProjections.rst","GatingSignal.rst","GilzenratModel.rst","InputPort.rst","IntegratorFunctions.rst","IntegratorMechanism.rst","IntegratorMechanisms.rst","KWTAMechanism.rst","Keywords.rst","KohonenMechanism.rst","LCAMechanism.rst","LCControlMechanism.rst","LCMechanism.rst","LeabraMechanism.rst","LearningFunctions.rst","LearningMechanism.rst","LearningMechanisms.rst","LearningProjection.rst","LearningProjections.rst","LearningSignal.rst","Library.rst","Log.rst","MappingProjection.rst","MaskedMappingProjection.rst","Mechanism.rst","Mechanisms.rst","MemoryFunctions.rst","Models.rst","ModulatoryMechanism.rst","ModulatoryMechanisms.rst","ModulatoryProjection.rst","ModulatoryProjections.rst","ModulatorySignal.rst","MontagueModel.rst","NieuwenhuisModel.rst","NonStatefulFunctions.rst","ObjectiveFunctions.rst","ObjectiveMechanism.rst","ObjectiveMechanisms.rst","OptimizationControlMechanism.rst","OptimizationFunctions.rst","OutputPort.rst","PCTC_model.rst","ParameterEstimationComposition.rst","ParameterPort.rst","Parameters.rst","Pathway.rst","PathwayProjection.rst","PathwayProjections.rst","Port.rst","PredictionErrorMechanism.rst","Preferences.rst","ProcessingMechanism.rst","ProcessingMechanisms.rst","Projection.rst","Projections.rst","QuickReference.rst","RecurrentTransferMechanism.rst","RefactoredLearningGuide.rst","Registry.rst","RegressionCFA.rst","Report.rst","Scheduler.rst","Scheduling.rst","SelectionFunctions.rst","Services.rst","StatefulFunction.rst","StatefulFunctions.rst","Subystems.rst","Time.rst","TransferFunctions.rst","TransferMechanism.rst","TransferMechanisms.rst","UserDefinedFunction.rst","UserGuide.rst","UserGuide_TBD.rst","Visualization.rst","globals.rst","index.rst","index_logo_with_text.rst","json.rst"],objects:{"psyneulink.core.components":{component:[12,0,0,"-"]},"psyneulink.core.components.component":{Component:[12,1,1,""]},"psyneulink.core.components.component.Component":{"function":[12,4,1,""],_check_args:[12,2,1,""],_check_for_composition:[12,2,1,""],_deferred_init:[12,2,1,""],_dependent_components:[12,3,1,""],_get_param_value_from_tuple:[12,2,1,""],_handle_default_variable:[12,2,1,""],_handle_size:[12,2,1,""],_instantiate_defaults:[12,2,1,""],_instantiate_function:[12,2,1,""],_instantiate_parameter_classes:[12,2,1,""],_model_spec_class_name_is_generic:[12,4,1,""],_model_spec_generic_type_name:[12,4,1,""],_model_spec_parameter_blacklist:[12,3,1,""],_parameter_components:[12,3,1,""],_parse_arg_generic:[12,2,1,""],_parse_arg_variable:[12,2,1,""],_parse_function_variable:[12,2,1,""],_set_multiple_parameter_values:[12,2,1,""],_specified_variable_shape_flexibility:[12,4,1,""],_validate:[12,2,1,""],_validate_and_assign_runtime_params:[12,2,1,""],_validate_function:[12,2,1,""],_validate_params:[12,2,1,""],_validate_variable:[12,2,1,""],all_dependent_parameters:[12,2,1,""],current_execution_time:[12,4,1,""],defaults:[12,4,1,""],execute:[12,2,1,""],execute_until_finished:[12,4,1,""],execution_count:[12,4,1,""],function_parameters:[12,3,1,""],initialization_status:[12,4,1,""],is_finished:[12,2,1,""],log:[12,4,1,""],log_values:[12,2,1,""],loggable_items:[12,3,1,""],logged_items:[12,3,1,""],max_executions_before_finished:[12,4,1,""],most_recent_context:[12,3,1,""],name:[12,4,1,""],num_exec
...

See CI logs for the full diff.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.005%) to 83.989% when pulling 0149297 on docs/cim_figure into 57f9f28 on devel.

@jdcpni jdcpni merged commit 4bcf8e8 into devel Dec 19, 2021
@jdcpni jdcpni deleted the docs/cim_figure branch December 19, 2021 03:59
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

4 participants