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/control signal/add control arg #2272

Merged
merged 252 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
252 commits
Select commit Hold shift + click to select a range
a32f213
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Apr 30, 2021
75cf069
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni May 5, 2021
dff1a37
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Jul 8, 2021
cd5e38e
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Oct 23, 2021
9361857
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Oct 30, 2021
0129ff7
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 4, 2021
bbd20f5
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 4, 2021
f9aba91
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 7, 2021
a3c0f6c
• optimizationcontrolmechanism.py:
jdcpni Nov 7, 2021
7069b3a
• optimizationcontrolmechanism.py:
jdcpni Nov 7, 2021
65b960e
• optimizationcontrolmechanism.py:
jdcpni Nov 7, 2021
5cc58f6
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 8, 2021
bc05b51
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 8, 2021
a8d428b
- modified test_mode_based_num_estimates
jdcpni Nov 8, 2021
1218b6f
-
jdcpni Nov 8, 2021
41567bb
-
jdcpni Nov 8, 2021
b65650f
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 8, 2021
822742f
• optimizationcontrolmechanism.py:
jdcpni Nov 9, 2021
5a3efba
• composition.py
jdcpni Nov 9, 2021
7acdebd
• composition.py:
jdcpni Nov 9, 2021
f81baf5
-
jdcpni Nov 9, 2021
cc1e98e
• composition.py
jdcpni Nov 9, 2021
a00b95f
• composition.py:
jdcpni Nov 10, 2021
ed0a720
-
jdcpni Nov 10, 2021
cb0b930
• optimizationcontrolmechanism.py:
jdcpni Nov 10, 2021
8cadf24
-
jdcpni Nov 10, 2021
1cc216e
• optimizationcontrolmechanism.py:
jdcpni Nov 10, 2021
ba278c1
-
jdcpni Nov 10, 2021
b5f1c66
-
jdcpni Nov 10, 2021
0e38f1b
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 10, 2021
b4a9b82
• optimizationcontrolmechanism.py
jdcpni Nov 10, 2021
2050118
-
Nov 10, 2021
b925dab
• optimizationcontrolmechanism.py
jdcpni Nov 11, 2021
bdb12fb
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 11, 2021
c1b3000
• optimizationcontrolmechanism.py
jdcpni Nov 11, 2021
7ca8a0b
-
jdcpni Nov 11, 2021
d1010fd
-
jdcpni Nov 11, 2021
e57cd2d
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 11, 2021
0ff99ec
Merge branch 'fix/ocm/llvm_num_estimates' into refactor/ocm/state_inp…
jdcpni Nov 11, 2021
3607a9a
-
jdcpni Nov 11, 2021
6017b7b
-
jdcpni Nov 11, 2021
2395f7e
• composition.py
jdcpni Nov 11, 2021
f317567
• composition.py
jdcpni Nov 11, 2021
8edacf6
llvm/struct generation: Make sure num_estimats per trial is always in…
jvesely Nov 11, 2021
8ed5e87
-
jdcpni Nov 11, 2021
bcfbae9
Merge branch 'fix/ocm/llvm_num_estimates' into refactor/ocm/state_inp…
jdcpni Nov 11, 2021
8a564aa
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 11, 2021
883b49d
• composition.py:
jdcpni Nov 12, 2021
d2faa86
-
jdcpni Nov 12, 2021
a632f72
• composition.py
jdcpni Nov 12, 2021
0e1a32e
• test_control.py
jdcpni Nov 12, 2021
1d996fb
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 12, 2021
cbe6d24
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 12, 2021
3856bdd
• optimizationfunctions.py:
jdcpni Nov 12, 2021
0eb6514
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 12, 2021
4b2fe4a
-
jdcpni Nov 13, 2021
d580849
• composition.py
jdcpni Nov 13, 2021
79b6ed6
-
jdcpni Nov 15, 2021
1a5dd50
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 15, 2021
34b179e
• composition.py:
jdcpni Nov 15, 2021
dff750a
• composition.py:
jdcpni Nov 16, 2021
38e5bae
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 16, 2021
d487a4c
• composition.py
jdcpni Nov 16, 2021
779add6
-
jdcpni Nov 16, 2021
5c361e2
• composition.py:
jdcpni Nov 17, 2021
0c2de6a
-
jdcpni Nov 17, 2021
a7436db
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 17, 2021
27b2d76
-
jdcpni Nov 17, 2021
0981388
-
jdcpni Nov 17, 2021
698d824
-
jdcpni Nov 17, 2021
900da17
-
jdcpni Nov 17, 2021
aa5a431
-
jdcpni Nov 17, 2021
780be92
-
jdcpni Nov 17, 2021
fa4e038
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 17, 2021
af135d6
-
jdcpni Nov 17, 2021
f13747a
• Passing all test_control tests except test_mode_based_num_estimates
jdcpni Nov 17, 2021
eff7005
• Passing all test_control tests
jdcpni Nov 17, 2021
ea1465e
-
jdcpni Nov 17, 2021
1c39268
• optimizationcontrolmechanism.py
jdcpni Nov 18, 2021
a7f7cf4
-
jdcpni Nov 18, 2021
7a6b5a7
• optimizationcontrolmechanism.py
jdcpni Nov 18, 2021
11cf225
• test_show_graph.py: passes all tests
jdcpni Nov 18, 2021
72b922a
-
jdcpni Nov 18, 2021
b6e697e
• test_report.py: passing all tests
Nov 18, 2021
1609acc
• Passes all tests!
Nov 18, 2021
b889604
-
jdcpni Nov 19, 2021
c4b081e
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 19, 2021
47a757a
-
Nov 19, 2021
78f4ec6
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 19, 2021
faaf256
• composition.py: reorganize with #region and #enregions
jdcpni Nov 19, 2021
fb9c424
• composition.py: reorganize with #region and #enregions
jdcpni Nov 19, 2021
0c96840
• controlmechanism.py, optimizationcontrolmechanism.py:
jdcpni Nov 19, 2021
d40082c
-
jdcpni Nov 19, 2021
1630f87
-
jdcpni Nov 19, 2021
a76a2d0
-
jdcpni Nov 19, 2021
b1f9778
• controlmechanism.py, optimizationcontrolmechanism.py:
jdcpni Nov 19, 2021
451abb3
• controlmechanism.py, optimizationcontrolmechanism.py:
jdcpni Nov 19, 2021
304174e
-
jdcpni Nov 20, 2021
428eed8
• composition.py:
Nov 20, 2021
5c71808
-
jdcpni Nov 20, 2021
3733ea9
- test_control: only test_hanging_control_spec_outer_controller not p…
jdcpni Nov 20, 2021
5851949
-
Nov 20, 2021
e8909b7
-
Nov 20, 2021
2018260
-
Nov 20, 2021
98be7a0
-
jdcpni Nov 20, 2021
636b7c7
-
jdcpni Nov 20, 2021
f3a857a
-
jdcpni Nov 20, 2021
2552f73
• composition.py:
jdcpni Nov 20, 2021
c02735e
• test_paremtercomposition.py:
jdcpni Nov 20, 2021
8568b47
ª Attempt to fix problem with partially overlapping local and ocm con…
jdcpni Nov 21, 2021
1aadd6d
see later commit
jdcpni Nov 21, 2021
da80ad6
see later commit
jdcpni Nov 21, 2021
fa1683f
see later commit
jdcpni Nov 21, 2021
8dee921
see later commit
jdcpni Nov 21, 2021
d17b5cd
- This branch passes all tests except:
jdcpni Nov 21, 2021
2503dfc
- small mods; don't impact anything relevant to prior commit message
jdcpni Nov 21, 2021
6cf4609
- small mods; don't impact anything relevant to prior commit message
jdcpni Nov 21, 2021
cdb6399
- small mods; don't impact anything relevant to prior commit message
jdcpni Nov 21, 2021
5cf0bc2
- finished adding formatting regions to composition.py
jdcpni Nov 21, 2021
46ccc47
-
jdcpni Nov 21, 2021
2b3b857
• composition.py:
jdcpni Nov 21, 2021
bd5cd10
• show_graph.py: addressed bug associated with ocm.allow_direct_probe
jdcpni Nov 22, 2021
6d894a7
• show_graph.py: addressed bug associated with ocm.allow_direct_probe
jdcpni Nov 22, 2021
689d7b6
-
jdcpni Nov 22, 2021
bcddef5
Composition: add_controller: set METHOD as context source early
kmantel Nov 23, 2021
7fd49c6
-
jdcpni Nov 23, 2021
35c97d3
Merge branch 'refactor/ocm/state_input_ports_PROBE_FIX' of https://gi…
jdcpni Nov 23, 2021
79cb012
• composition.py
jdcpni Nov 24, 2021
9bc7b18
• composition.py
jdcpni Nov 24, 2021
0f93f47
• test_partially_overlapping_local_and_control_mech_control_specs_in_…
Nov 25, 2021
47b56b2
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 25, 2021
81f1112
• composition.py
jdcpni Nov 25, 2021
0cd9db3
• composition.py
jdcpni Nov 25, 2021
c808664
• composition.py
jdcpni Nov 25, 2021
0cb21ab
-
jdcpni Nov 25, 2021
28289a0
- confirm that it passes all tests exception test_composition/test_pa…
Nov 25, 2021
1cf9602
• composition.py: some more fixed to add_controller that now fail on…
jdcpni Nov 25, 2021
72c4c41
• Passes *all* current tests
jdcpni Nov 25, 2021
45b25eb
• composition.py:
Nov 25, 2021
a79723b
-
Nov 25, 2021
49350a1
-
jdcpni Nov 26, 2021
f7b9fc5
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 26, 2021
7a6682a
-
jdcpni Nov 26, 2021
8858ab5
• controlmechanism.py:
jdcpni Nov 26, 2021
d1ac2da
-
jdcpni Nov 26, 2021
dbdc2d1
• composition.py: in progress fix of bug in instantiating shadow pro…
jdcpni Nov 27, 2021
6b00fbd
• composition.py:
jdcpni Nov 27, 2021
179e7d0
• optimizationcontrolmechanism.py
jdcpni Nov 27, 2021
88ce1a6
-
jdcpni Nov 27, 2021
5089cf3
• composition.py
jdcpni Nov 27, 2021
97a71c4
• test_show_graph.py: update for fixes
Nov 27, 2021
3bc799e
-
Nov 27, 2021
6a27e4a
• tests: passes all in test_show_graph.py and test_report.py
Nov 27, 2021
8cdad10
Passes all tests
Nov 27, 2021
2d15f6d
- comment clean-up
Nov 27, 2021
787856b
• composition.py
jdcpni Nov 27, 2021
3ed598e
• composition.py, optimizationcontrolmechanism.py:
Nov 28, 2021
38e5f99
• show_graph.py: fixed bug causing extra projections to OCM
jdcpni Nov 28, 2021
658c161
• composition.py:
jdcpni Nov 28, 2021
7396806
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 28, 2021
8b54f03
• optimizationcontrolmechanism.py: add agent_rep_type property
jdcpni Nov 28, 2021
1ecf0fa
• optimizationcontrolmechanism.py:
jdcpni Nov 28, 2021
24a03f3
• optimizationcontrolmechanism.py:
jdcpni Nov 29, 2021
6713df9
-
jdcpni Nov 29, 2021
8b3bdf0
-
jdcpni Nov 29, 2021
d001991
• Passes all tests except test_json with 'model_with_control'
jdcpni Nov 29, 2021
888863a
-
jdcpni Nov 30, 2021
6fb5cf6
• composition.py
jdcpni Nov 30, 2021
c1fd334
• composition.py
jdcpni Nov 30, 2021
00e7da9
• composition.py
jdcpni Nov 30, 2021
77ae108
-
jdcpni Nov 30, 2021
774f6b3
• test_two_origins_two_input_ports: crashes on failure of C->B to up…
jdcpni Nov 30, 2021
c4fedbe
-
jdcpni Nov 30, 2021
e29f618
• composition.py
Dec 1, 2021
d551e9d
• optimizationcontrolmechanism.py
jdcpni Dec 1, 2021
66c05f7
• optimizationcontrolmechanism.py
jdcpni Dec 1, 2021
a401857
• composition.py
jdcpni Dec 1, 2021
a91695e
• composition.py
jdcpni Dec 1, 2021
48012a3
Port: _remove_projection_to_port: don't reduce variable below length 1
kmantel Dec 1, 2021
cb828c8
• composition.py
jdcpni Dec 1, 2021
c6853b6
• show_graph.py
jdcpni Dec 2, 2021
d11e117
• composition.py:
jdcpni Dec 2, 2021
756c076
• show_graph.py
jdcpni Dec 2, 2021
f9924f3
• composition.py
jdcpni Dec 2, 2021
944d214
• composition.py
jdcpni Dec 2, 2021
546378b
• composition.py:
jdcpni Dec 2, 2021
67dd8c7
Merge branch 'refactor/ocm/state_input_ports_PROBE_STATE_FEAT_FCT' of…
jdcpni Dec 2, 2021
7de2c62
• show_graph.py
jdcpni Dec 2, 2021
d4ee355
Merge branch 'refactor/ocm/state_input_ports_PROBE_STATE_FEAT_FCT' of…
jdcpni Dec 2, 2021
be76389
-
jdcpni Dec 2, 2021
399d1f7
• composition.py
jdcpni Dec 2, 2021
bc47b76
-
jdcpni Dec 2, 2021
4afdf0a
-
jdcpni Dec 2, 2021
7423d37
• test_composition.py
jdcpni Dec 2, 2021
4134cde
Merge branch 'refactor/ocm/state_input_ports_PROBE_STATE_FEAT_FCT' of…
jdcpni Dec 2, 2021
de80376
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Dec 2, 2021
4e63090
-
jdcpni Dec 2, 2021
552fc04
-
jdcpni Dec 3, 2021
24a7340
-
jdcpni Dec 3, 2021
1cca7d6
-
jdcpni Dec 3, 2021
9d07c46
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Dec 3, 2021
a9ff72c
• optimizationcontrolmechanism.py: docstring mods
jdcpni Dec 3, 2021
91a4fbe
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Dec 3, 2021
eed7e89
Merge branch 'refactor/ocm/state_input_ports' into devel
jdcpni Dec 3, 2021
6d3dfa7
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Dec 5, 2021
2c20364
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Dec 11, 2021
f050d22
• composition.py:
jdcpni Dec 11, 2021
e574d4f
• composition.py:
jdcpni Dec 11, 2021
a4d6765
• composition.py:
jdcpni Dec 11, 2021
4376f3b
• composition.py:
jdcpni Dec 11, 2021
33efb0f
• composition.py:
jdcpni Dec 11, 2021
99d5847
• controlmechanism.py:
Dec 11, 2021
3153939
• controlmechanism.py:
Dec 11, 2021
27d3571
• composition.py
Dec 11, 2021
99a60f0
• docstring mods
Dec 11, 2021
a16d23c
-
jdcpni Dec 12, 2021
4cfe34a
-
jdcpni Dec 12, 2021
4ba7592
• optimizationcontrolmechanism.py: docstring revs
jdcpni Dec 12, 2021
95be2be
-
jdcpni Dec 12, 2021
6dd5c37
-
jdcpni Dec 12, 2021
7e4afc7
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Dec 12, 2021
028bc03
• test_composition.py:
jdcpni Dec 12, 2021
9faaa46
-
jdcpni Dec 12, 2021
7dfac6d
• composition.py
Dec 12, 2021
6fa1cbc
-
Dec 12, 2021
90b134b
• composition.py:
Dec 12, 2021
eaede0e
-
jdcpni Dec 12, 2021
25c0bdd
Merge branch 'feat/composition/probes' of https://github.com/Princeto…
jdcpni Dec 12, 2021
5dd6dcb
• composition.py:
jdcpni Dec 12, 2021
102acbe
-
jdcpni Dec 13, 2021
2e93dc2
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Dec 13, 2021
c4c6023
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Dec 13, 2021
dd8d944
• CompositionInterfaceMechanism.rst:
jdcpni Dec 13, 2021
b02a3a9
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Dec 26, 2021
a770345
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Dec 28, 2021
7b92ccb
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Jan 2, 2022
d0252c7
• optimizationcontrolmechanism.py:
jdcpni Jan 2, 2022
e90c3aa
-
jdcpni Jan 2, 2022
0ce761f
-
jdcpni Jan 2, 2022
53f73fb
• controlmechanism.py: allow CONTROL as alias for PROJECTIONS in Cont…
jdcpni Jan 2, 2022
0ac8aa0
• controlsignal.py: allow CONTROL as alias for PROJECTIONS in Control…
jdcpni Jan 2, 2022
7e8c738
• controlsignal.py: replaces modulates with control as arg (though st…
jdcpni Jan 2, 2022
73ab0ef
• test_projection_specifications.py:
jdcpni Jan 2, 2022
9b47e1d
-
Jan 2, 2022
99e4007
• gatingsignal.py:
jdcpni Jan 2, 2022
5a72125
-
jdcpni Jan 2, 2022
f1b67fb
-
jdcpni Jan 3, 2022
181ad8c
-
Jan 3, 2022
ecf67af
-
jdcpni Jan 3, 2022
2176cc1
• CONTROL and GATE in place of PROJECTIONS
jdcpni Jan 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,9 @@ class Parameters(ModulatoryMechanism_Base.Parameters):
constructor_argument='control'
)

# MODIFIED 1/2/22 OLD: - MUCH OF THIS SEEMS TO BE COVERED ELSEWHERE; COMMENTING OUT ONLY CAUSES PROBLEMS WITH
# test_control_signal_and_control_projection_names AND
# test_json_results_equivalence (stroop_conflict_monitoring_py)
def _parse_output_ports(self, output_ports):
def is_2tuple(o):
return isinstance(o, tuple) and len(o) == 2
Expand All @@ -1231,19 +1234,28 @@ def is_2tuple(o):
MECHANISM: output_ports[i][1]
}
# handle dict of form {PROJECTIONS: <2 item tuple>, <param1>: <value1>, ...}
elif (
isinstance(output_ports[i], dict)
and PROJECTIONS in output_ports[i]
and is_2tuple(output_ports[i][PROJECTIONS])
):
full_spec_dict = {
NAME: output_ports[i][PROJECTIONS][0],
MECHANISM: output_ports[i][PROJECTIONS][1],
**{k: v for k, v in output_ports[i].items() if k != PROJECTIONS}
}
output_ports[i] = full_spec_dict
elif isinstance(output_ports[i], dict):
# Handle CONTROL as synonym of PROJECTIONS
if CONTROL in output_ports[i]:
# MODIFIED 1/3/22 NEW:
# CONTROL AND PROJECTIONS can't both be used
if PROJECTIONS in output_ports[i]:
raise ControlMechanismError(f"Both 'CONTROL' and 'PROJECTIONS' entries found in "
f"specification dict for {ControlSignal.__name__} of "
f"'{self.name}': ({output_ports[i]}).")
# MODIFIED 1/3/22 END
# Replace CONTROL with PROJECTIONS
output_ports[i][PROJECTIONS] = output_ports[i].pop(CONTROL)
if (PROJECTIONS in output_ports[i] and is_2tuple(output_ports[i][PROJECTIONS])):
full_spec_dict = {
NAME: output_ports[i][PROJECTIONS][0],
MECHANISM: output_ports[i][PROJECTIONS][1],
**{k: v for k, v in output_ports[i].items() if k != PROJECTIONS}
}
output_ports[i] = full_spec_dict

return output_ports
# MODIFIED 1/2/22 END

def _validate_input_ports(self, input_ports):
if input_ports is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
from psyneulink.core.components.ports.modulatorysignals.gatingsignal import GatingSignal
from psyneulink.core.globals.defaults import defaultGatingAllocation
from psyneulink.core.globals.keywords import \
GATING, GATING_PROJECTION, GATING_SIGNAL, GATING_SIGNALS, \
GATE, GATING, GATING_PROJECTION, GATING_SIGNAL, GATING_SIGNALS, \
INIT_EXECUTE_METHOD_ONLY, MONITOR_FOR_CONTROL, PROJECTION_TYPE
from psyneulink.core.globals.parameters import Parameter
from psyneulink.core.globals.preferences.basepreferenceset import is_pref_set
Expand Down Expand Up @@ -399,6 +399,13 @@ class Parameters(ControlMechanism.Parameters):
:default value: numpy.array([0.5])
:type: ``numpy.ndarray``

output_ports
see `output_ports <Mechanism_Base.output_ports>`

:default value: None
:type:
:read only: True

gating_allocation
see `gating_allocation <GatingMechanism.gating_allocation>`

Expand All @@ -413,6 +420,63 @@ class Parameters(ControlMechanism.Parameters):
pnl_internal=True
)

output_ports = Parameter(
None,
stateful=False,
loggable=False,
read_only=True,
structural=True,
parse_spec=True,
aliases=['control', 'control_signals', 'gate', 'gating_signal'],
constructor_argument='gate'
)

def _parse_output_ports(self, output_ports):
from psyneulink.core.globals.keywords import NAME, MECHANISM, PROJECTIONS
# # FIX: 1/2/22 - ANY WAY TO CALL SUPER TO CALL ControlMechanism.parameters.output_ports._parse_output_ports
# super().output_ports._parse_output_ports(output_ports)

def is_2tuple(o):
return isinstance(o, tuple) and len(o) == 2

if not isinstance(output_ports, list):
output_ports = [output_ports]

for i in range(len(output_ports)):
# handle 2-item tuple
if is_2tuple(output_ports[i]):

# this is an odd case that uses two names in the name entry
# unsure what it means
if isinstance(output_ports[i][0], list):
continue

output_ports[i] = {
NAME: output_ports[i][0],
MECHANISM: output_ports[i][1]
}
# handle dict of form {PROJECTIONS: <2 item tuple>, <param1>: <value1>, ...}
elif isinstance(output_ports[i], dict):
# Handle GATE as synonym of PROJECTIONS
if GATE in output_ports[i]:
# GATE AND PROJECTIONS can't both be used
if PROJECTIONS in output_ports[i]:
raise GatingMechanismError(f"Both 'PROJECTIONS' and 'GATE' entries found in "
f"specification dict for {GatingSignal.__name__} of "
f"'{self.name}': ({output_ports[i]}).")
# Replace GATE with PROJECTIONS
output_ports[i][PROJECTIONS] = output_ports[i].pop(GATE)
if (PROJECTIONS in output_ports[i] and is_2tuple(output_ports[i][PROJECTIONS])):
full_spec_dict = {
NAME: output_ports[i][PROJECTIONS][0],
MECHANISM: output_ports[i][PROJECTIONS][1],
**{k: v for k, v in output_ports[i].items() if k != PROJECTIONS}
}
output_ports[i] = full_spec_dict

return output_ports


@tc.typecheck
def __init__(self,
default_gating_allocation=None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,20 +582,16 @@
which is used to compute the `net_outcome <ControlMechanism.net_outcome>` of executing its `agent_rep
<OptimizationControlMechanism.agent_rep>`.

COMMENT:
FIX: 1/1/22
.. note::
, and the `allow_probes
<Composition.allow_probes>` attribute of the Composition for which the OptimizationControlMechanism is the
`controller <Composition.controller>`. The latter allows the values of the items listed in `monitor_for_control
<ControlMechanism.monitor_for_control>` to be `INPUT <NodeRole.INTERNAL>` or `INTERNAL <NodeRole.INTERNAL>` `Nodes
<Composition_Nodes>` of a `nested Composition <Composition_Nested>` to be monitored and included in the computation
of `outcome <ControlMechanism.outcome>` (ordinarily, those must be `OUTPUT <NodeRole.OUTPUT>` Nodes of a nested
Composition). This can be thought of as providing access to "latent variables" of the Composition being evaluated;
that is, ones that do not contribute directly to the Composition's `results <Composition_Execution_Results>`. This
applies both to items that are monitored directly by the OptimizationControlMechanism or via its ObjectiveMechanism.
COMMENT

If a `Node <Composition_Nodes>` other than an `OUTPUT <NodeRole.OUTPUT>` of a `nested <Composition_Nested>`
Composition is `specified to be monitored <ControlMechanism_Monitor_for_Control>`, it is assigned as a `PROBE
<NodeRole.PROBE>` of that nested Composition. Although `PROBE <NodeRole.PROBE>` Nodes are generally treated
like `OUTPUT <NodeRole.OUTPUT>` Nodes (since they project out of the Composition to which they belong), their
`value <Mechanism_Base.value>` is not included in the `output_values <Composition.output_values>` or `results
<Composition.results>` attributes of the Composition for which the OptimizationControlMechanism is the
`controller <Composition.controller>`, unless that Composition's `include_probes_in_output
<Composition.include_probes_in_output>` attribute is set to True (see `Composition_Probes` for additional
information).

.. _OptimizationControlMechanism_Function:

Expand Down Expand Up @@ -2322,14 +2318,6 @@ def _gen_llvm_output_port_parse_variable(self, ctx, builder, params, context, va
builder.store(builder.load(val_ptr), dest_ptr)
return oport_input

# Deprecated - this is now a Parameter
# @property
# def state_feature_values(self):
# if hasattr(self.agent_rep, 'model_based_optimizer') and self.agent_rep.model_based_optimizer is self:
# return self.agent_rep._get_predicted_input()
# else:
# return np.array(np.array(self.variable[1:]).tolist())

@property
def agent_rep_type(self):
from psyneulink.core.compositions.compositionfunctionapproximator import CompositionFunctionApproximator
Expand Down
Loading