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

Refactor/state and projection/specification bug fix 2 #495

Merged
merged 338 commits into from
Oct 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
338 commits
Select commit Hold shift + click to select a range
339e6b8
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Sep 24, 2017
951b83f
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Sep 24, 2017
ac69082
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Sep 26, 2017
6d3d77e
• ObjectiveMechanism, ControlMechanism
jdcpni Sep 26, 2017
f7fddd2
• ObjectiveMechanism, ControlMechanism
jdcpni Sep 28, 2017
b058609
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Sep 28, 2017
d4bf7d2
• Library
jdcpni Sep 29, 2017
2ce6dda
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Sep 29, 2017
f0794c3
• Mechanism
jdcpni Sep 29, 2017
f404e81
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Sep 29, 2017
39bf4c5
• State
jdcpni Sep 29, 2017
d00036a
-
jdcpni Sep 29, 2017
695a672
-
jdcpni Sep 29, 2017
225fc41
-
jdcpni Sep 29, 2017
4e9332e
-
jdcpni Sep 29, 2017
96153fc
-
jdcpni Sep 30, 2017
8540488
-
jdcpni Sep 30, 2017
f6acca6
-
jdcpni Oct 1, 2017
f535278
-
jdcpni Oct 1, 2017
3dd0c5c
-
jdcpni Oct 1, 2017
c7959f6
-
jdcpni Oct 1, 2017
552f666
-
jdcpni Oct 2, 2017
be3b8fd
-
jdcpni Oct 2, 2017
65e067b
-
jdcpni Oct 2, 2017
baf4b4a
• Projection (and subclasses)
jdcpni Oct 2, 2017
4e0e0f3
-
jdcpni Oct 2, 2017
280bdf6
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Oct 2, 2017
f84b5a2
• Projection
jdcpni Oct 3, 2017
1c5c95f
• Projection
jdcpni Oct 3, 2017
02fe48d
-
jdcpni Oct 3, 2017
4e1dfb3
-
jdcpni Oct 3, 2017
98d1b17
-
jdcpni Oct 4, 2017
e9c0d45
-
jdcpni Oct 4, 2017
ee1d6f5
-
jdcpni Oct 4, 2017
b64184e
-
jdcpni Oct 4, 2017
9e1cba7
-
jdcpni Oct 4, 2017
2739fe4
-
jdcpni Oct 4, 2017
7aa1c9d
-
jdcpni Oct 4, 2017
80063eb
-
jdcpni Oct 4, 2017
55f72da
-
jdcpni Oct 4, 2017
8e5d127
-
jdcpni Oct 4, 2017
14803d2
-
jdcpni Oct 4, 2017
34b2709
-
jdcpni Oct 4, 2017
1d574f5
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Oct 4, 2017
6f48d5e
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Oct 4, 2017
fc0d88f
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Oct 4, 2017
201e97e
• Refactor parsing of State and Projection
jdcpni Oct 4, 2017
ba776f2
-
jdcpni Oct 4, 2017
0be777f
-
jdcpni Oct 4, 2017
8028f05
-
jdcpni Oct 4, 2017
b8ac005
-
jdcpni Oct 4, 2017
1b3fa59
-
jdcpni Oct 5, 2017
aaeb5a5
-
jdcpni Oct 5, 2017
417db78
-
jdcpni Oct 5, 2017
0320d8d
-
jdcpni Oct 5, 2017
4b73bf1
Merge branches 'devel' and 'refactor/State_and_Projection/specificati…
jdcpni Oct 5, 2017
15191d5
-
jdcpni Oct 5, 2017
2f4f14c
-
jdcpni Oct 5, 2017
b3a3cce
-
jdcpni Oct 5, 2017
a88a292
-
jdcpni Oct 5, 2017
c71ed64
-
jdcpni Oct 5, 2017
753ddce
-
jdcpni Oct 5, 2017
aca7a3e
-
jdcpni Oct 5, 2017
41ca347
-
jdcpni Oct 5, 2017
4f9ce0e
-
jdcpni Oct 5, 2017
0b8268c
-
jdcpni Oct 5, 2017
e2e2ab6
-
jdcpni Oct 5, 2017
fcba19a
-
jdcpni Oct 6, 2017
48957da
-
jdcpni Oct 6, 2017
86b667e
-
jdcpni Oct 6, 2017
2ece2b3
-
jdcpni Oct 6, 2017
81f1f5e
-
jdcpni Oct 7, 2017
52128c0
-
jdcpni Oct 7, 2017
c92431f
-
jdcpni Oct 7, 2017
4021dc5
-
jdcpni Oct 7, 2017
7c6abe8
-
jdcpni Oct 7, 2017
c72b977
-
jdcpni Oct 8, 2017
7b3c8c6
Merge branches 'devel' and 'refactor/State_and_Projection/specificati…
jdcpni Oct 8, 2017
b88bcb9
Merge branches 'devel' and 'feat/RecurrentTransferMechanism/add_learn…
Oct 9, 2017
b027960
-
jdcpni Oct 9, 2017
2aabb74
-
jdcpni Oct 9, 2017
d4270e9
-
jdcpni Oct 9, 2017
a1e0ce3
-
jdcpni Oct 9, 2017
5707be6
-
jdcpni Oct 9, 2017
0db9d8d
-
jdcpni Oct 9, 2017
b7cb84d
-
jdcpni Oct 10, 2017
acab695
-
jdcpni Oct 10, 2017
ca7d56a
-
jdcpni Oct 10, 2017
a6a872a
-
jdcpni Oct 10, 2017
fc4ae71
Merge branches 'devel' and 'refactor/State_and_Projection/specificati…
jdcpni Oct 10, 2017
c167827
-
jdcpni Oct 11, 2017
9674ad1
-
jdcpni Oct 11, 2017
19e7889
-
jdcpni Oct 11, 2017
2f2257e
-
jdcpni Oct 11, 2017
e9cdb65
Merge branches 'devel' and 'refactor/State_and_Projection/specificati…
jdcpni Oct 11, 2017
ddb6d36
-
jdcpni Oct 11, 2017
ddc2f83
-
jdcpni Oct 11, 2017
3dd33a5
-
jdcpni Oct 11, 2017
c10e77a
Merge branches 'devel' and 'refactor/State_and_Projection/specificati…
jdcpni Oct 11, 2017
f5928a1
-
jdcpni Oct 11, 2017
3c8f310
-
jdcpni Oct 11, 2017
bea7fcc
-
jdcpni Oct 11, 2017
917fe32
-
jdcpni Oct 11, 2017
0780711
-
jdcpni Oct 12, 2017
83d17ff
-
jdcpni Oct 12, 2017
791525d
-
jdcpni Oct 12, 2017
e2394ca
-
jdcpni Oct 12, 2017
12c3c8c
-
jdcpni Oct 12, 2017
9e37bea
-
jdcpni Oct 13, 2017
92fd0e9
-
jdcpni Oct 13, 2017
36239db
-
jdcpni Oct 13, 2017
d8a7122
-
jdcpni Oct 13, 2017
ea4252e
-
jdcpni Oct 13, 2017
fe37c45
-
jdcpni Oct 13, 2017
23e106c
-
jdcpni Oct 13, 2017
5a42393
-
jdcpni Oct 13, 2017
cd8ee58
-
jdcpni Oct 13, 2017
b82e5c4
-
jdcpni Oct 14, 2017
7c2f46d
-
jdcpni Oct 14, 2017
3b0da3f
-
jdcpni Oct 14, 2017
8ae182c
-
jdcpni Oct 14, 2017
a5e8244
-
jdcpni Oct 14, 2017
c71b2b5
-
jdcpni Oct 14, 2017
015b4dc
Merge branches 'devel' and 'feat/RecurrentTransferMechanism/add_learn…
Oct 15, 2017
54e548e
Merge branches 'devel' and 'feat/RecurrentTransferMechanism/add_learn…
Oct 15, 2017
f8641ce
Merge branches 'devel' and 'feat/RecurrentTransferMechanism/add_learn…
Oct 15, 2017
027adf7
-
jdcpni Oct 15, 2017
fa2d11f
-
jdcpni Oct 15, 2017
83b824f
-
jdcpni Oct 16, 2017
ffd4bcf
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 16, 2017
36a52ea
-
jdcpni Oct 16, 2017
19b70ff
-
jdcpni Oct 16, 2017
804e9f3
-
jdcpni Oct 16, 2017
827737f
-
jdcpni Oct 16, 2017
c4d4d65
-
jdcpni Oct 16, 2017
45772d8
-
jdcpni Oct 16, 2017
b246b41
-
jdcpni Oct 17, 2017
817db94
Merge branches 'devel' and 'feat/RecurrentTransferMechanism/add_learn…
Oct 17, 2017
df58e78
Merge branches 'devel' and 'feat/RecurrentTransferMechanism/add_learn…
Oct 17, 2017
fff4eca
-
jdcpni Oct 17, 2017
02c8a39
-
jdcpni Oct 17, 2017
74f45b4
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 17, 2017
cf5a645
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 17, 2017
ff1a140
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 17, 2017
5eda4eb
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 17, 2017
86cad9f
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 17, 2017
493a07b
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 17, 2017
5395263
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 18, 2017
8102a87
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 18, 2017
3b8210b
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 18, 2017
67e7d8e
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 18, 2017
a95b8b2
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 18, 2017
dac7eb2
Merge branch 'TEMP' into refactor/State_and_Projection/specification
jdcpni Oct 19, 2017
c789388
Merge commit '13f1092a7' into refactor/State_and_Projection/specifica…
kmantel Oct 19, 2017
06a9001
Merge branch 'refactor/State_and_Projection/specification' of https:/…
kmantel Oct 19, 2017
dd1c99b
Merge branch 'refactor/State_and_Projection/specification' of https:/…
jdcpni Oct 19, 2017
53aa1a3
• System
jdcpni Oct 19, 2017
8aa182a
• System
jdcpni Oct 19, 2017
db6ca4f
• System
jdcpni Oct 19, 2017
606f38b
• System
jdcpni Oct 19, 2017
0b102bf
Merge branch 'devel' into refactor/State_and_Projection/specification
kmantel Oct 19, 2017
999847f
- Version diverged from merge with new devel:
jdcpni Oct 19, 2017
2d52c95
- Version diverged from merge with new devel:
jdcpni Oct 19, 2017
d26cebd
- Version diverged from merge with new devel:
jdcpni Oct 19, 2017
c69e826
- Version diverged from merge with new devel:
jdcpni Oct 20, 2017
f116515
- Version diverged from merge with new devel:
jdcpni Oct 20, 2017
0824d54
- Version diverged from merge with new devel:
jdcpni Oct 20, 2017
9bb9a92
- Version diverged from merge with new devel:
jdcpni Oct 20, 2017
670e968
• TEST SCRIPTS:
jdcpni Oct 20, 2017
00c2a24
• TEST SCRIPTS:
jdcpni Oct 20, 2017
7e32438
- EVC scripts working
jdcpni Oct 20, 2017
b4e6ed7
- Gating script now just failing test on Function Error
jdcpni Oct 20, 2017
0a06e02
• TEST SCRIPTS:
jdcpni Oct 20, 2017
02c7b66
Merge branch 'refactor/State_and_Projection/specification-MERGED' of …
jdcpni Oct 20, 2017
55abce5
• TEST SCRIPTS:
jdcpni Oct 20, 2017
08f8af1
• TEST SCRIPTS:
jdcpni Oct 20, 2017
e6c93a9
-
jdcpni Oct 20, 2017
3702a78
-
jdcpni Oct 20, 2017
8ba1647
Merge branch 'refactor/State_and_Projection/specification' into refac…
kmantel Oct 20, 2017
c4ceb7f
-
jdcpni Oct 20, 2017
85c9dfa
-
jdcpni Oct 20, 2017
bb8d567
-
jdcpni Oct 20, 2017
7f955c9
-
jdcpni Oct 20, 2017
2c14b07
-
jdcpni Oct 20, 2017
f70957e
-
jdcpni Oct 20, 2017
8e421c1
Merge branch 'refactor/State_and_Projection/specification' of https:/…
jdcpni Oct 20, 2017
731c3c8
Merge branch 'refactor/State_and_Projection/specification-MERGED' of …
jdcpni Oct 20, 2017
98499a0
• Passes all tests
jdcpni Oct 20, 2017
abef6df
Merge branches 'devel' and 'refactor/State_and_Projection/specificati…
jdcpni Oct 20, 2017
42b616b
• GatingMechanism
jdcpni Oct 21, 2017
2a28b88
• GatingMechanism
jdcpni Oct 22, 2017
6217520
• GatingMechanism
jdcpni Oct 22, 2017
69a8db8
• GatingMechanism
jdcpni Oct 22, 2017
dc44407
-
jdcpni Oct 22, 2017
189e55d
-
jdcpni Oct 22, 2017
111fcd9
-
jdcpni Oct 22, 2017
ebfa197
-
jdcpni Oct 22, 2017
6a05cf7
-
jdcpni Oct 23, 2017
8b7cbae
-
jdcpni Oct 23, 2017
62f4898
-
jdcpni Oct 23, 2017
37bd8e4
-
jdcpni Oct 23, 2017
79ac057
-
jdcpni Oct 23, 2017
df08932
-
jdcpni Oct 23, 2017
8793a40
-
jdcpni Oct 23, 2017
c4fd151
-
jdcpni Oct 23, 2017
3df4138
Merge branches 'devel' and 'feat/RecurrentTransferMechanism/add_learn…
Oct 23, 2017
0530d71
Merge remote-tracking branch 'origin/refactor/State_and_Projection/sp…
jdcpni Oct 23, 2017
8e47474
-
jdcpni Oct 23, 2017
b232f84
• TEST SCRIPTS:
jdcpni Oct 23, 2017
0b8e4a4
Merge branch 'refactor/State_and_Projection/specification_GATING' of …
jdcpni Oct 23, 2017
f036334
-
jdcpni Oct 23, 2017
434e740
-
jdcpni Oct 23, 2017
751da17
-
jdcpni Oct 23, 2017
64fc618
-
jdcpni Oct 24, 2017
9d31e75
-
jdcpni Oct 24, 2017
381c42e
-
jdcpni Oct 24, 2017
1e13a94
-
jdcpni Oct 24, 2017
23d9cfc
-
jdcpni Oct 24, 2017
9e7a120
-
jdcpni Oct 24, 2017
6c1b3f1
-
jdcpni Oct 24, 2017
bbbc86d
-
jdcpni Oct 24, 2017
1fcfd9f
• GatingMechanism
jdcpni Oct 24, 2017
78138f2
-
jdcpni Oct 24, 2017
e088543
-
jdcpni Oct 24, 2017
eef2136
-
jdcpni Oct 24, 2017
bb6b623
-
jdcpni Oct 24, 2017
9c0c095
-
jdcpni Oct 24, 2017
9acd48c
-
jdcpni Oct 24, 2017
913f2b1
-
jdcpni Oct 24, 2017
5f1365d
-
jdcpni Oct 24, 2017
0207bc1
-
jdcpni Oct 24, 2017
bde64fa
-
jdcpni Oct 24, 2017
270df48
-
jdcpni Oct 25, 2017
228d029
-
jdcpni Oct 25, 2017
52bd069
-
jdcpni Oct 25, 2017
7b07d3c
-
jdcpni Oct 25, 2017
999ac37
-
jdcpni Oct 25, 2017
4af5089
• LearningMechanism, ControlMechanism, GatingMechanism:
jdcpni Oct 25, 2017
386636d
• LearningMechanism, ControlMechanism, GatingMechanism:
jdcpni Oct 25, 2017
c3ece82
• LearningMechanism, ControlMechanism, GatingMechanism:
jdcpni Oct 26, 2017
e27f65f
-
jdcpni Oct 26, 2017
cf6497e
-
jdcpni Oct 26, 2017
3854f2d
-
jdcpni Oct 26, 2017
283c18b
-
jdcpni Oct 26, 2017
4e4ecce
updating kwta and transfer pytests with correct error message text
KristenManning Oct 26, 2017
74ccbf8
-
jdcpni Oct 26, 2017
b923c01
Merge branch 'refactor/State_and_Projection/specification_BUG_FIX_1' …
jdcpni Oct 26, 2017
068bd0d
-
jdcpni Oct 26, 2017
20e8c20
• Component
jdcpni Oct 26, 2017
853320a
-
jdcpni Oct 26, 2017
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
6 changes: 3 additions & 3 deletions Scripts/DEMO SCRIPTS/documentation_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ def mechanisms():
# FIXME: ObjectiveMechanismError: "PROGRAM ERROR: call to
# State._parse_state_spec() for OutputState of ComparatorMechanism-1
# should have returned dict or State, but returned <class 'str'> instead"
my_comparator_mech = ComparatorMechanism(sample=my_action_select_mech,
target=my_reward_mech,
input_states=[[0], [0]])
my_comparator_mech = ComparatorMechanism(default_variable = [[0], [0]],
sample=my_action_select_mech,
target=my_reward_mech)
# which function keyword argument description is correct?
# endregion

Expand Down
9 changes: 7 additions & 2 deletions Scripts/Models/GilzenratModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from psyneulink.components.process import Process
from psyneulink.components.system import System
from psyneulink.library.subsystems.agt.lccontrolmechanism import LCControlMechanism
from psyneulink.components.projections.pathway.mappingprojection import MappingProjection
from psyneulink.globals.keywords import PROJECTION_TYPE, RECEIVER, SENDER, MATRIX

# --------------------------------- Global Variables ----------------------------------------

Expand All @@ -38,7 +40,8 @@

# numerical integration
time_step_size = 0.02
number_of_trials = int(20/time_step_size)
# number_of_trials = int(20/time_step_size)
number_of_trials = 1

# noise
standard_deviation = 0.22*(time_step_size**0.5)
Expand Down Expand Up @@ -99,7 +102,9 @@
objective_mechanism=ObjectiveMechanism(
function=Linear,
monitored_output_states=[(decision_layer, None, None, np.array([[0.3],[0.0]]))],
input_states=[[0]],
# monitored_output_states=[{PROJECTION_TYPE: MappingProjection,
# SENDER: decision_layer,
# MATRIX: np.array([[0.3],[0.0]])}],
name='LC ObjectiveMechanism'
),
modulated_mechanisms=[decision_layer, response],
Expand Down
27 changes: 19 additions & 8 deletions psyneulink/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ class `UserList <https://docs.python.org/3.6/library/collections.html?highlight=
from psyneulink.globals.log import Log
from psyneulink.globals.preferences.componentpreferenceset import ComponentPreferenceSet, kpVerbosePref
from psyneulink.globals.preferences.preferenceset import PreferenceEntry, PreferenceLevel, PreferenceSet
from psyneulink.globals.utilities import ContentAddressableList, ReadOnlyOrderedDict, convert_to_np_array, is_same_function_spec, iscompatible, kwCompatibilityLength
from psyneulink.globals.utilities import ContentAddressableList, ReadOnlyOrderedDict, convert_to_np_array, \
is_same_function_spec, iscompatible, kwCompatibilityLength, is_matrix

__all__ = [
'Component', 'COMPONENT_BASE_CLASS', 'component_keywords', 'ComponentError', 'ComponentLog', 'ExecutionStatus',
Expand Down Expand Up @@ -2080,7 +2081,6 @@ def _validate_params(self, request_set, target_set=None, context=None):

# Check if param value is of same type as one with the same name in paramClassDefaults;
# don't worry about length

if iscompatible(param_value, self.paramClassDefaults[param_name], **{kwCompatibilityLength:0}):
# If param is a dict, check that entry exists in paramClassDefaults
# IMPLEMENTATION NOTE:
Expand Down Expand Up @@ -2161,16 +2161,27 @@ def _validate_params(self, request_set, target_set=None, context=None):
elif hasattr(param_value, FUNCTION) and callable(param_value.function):
target_set[param_name] = param_value

# It has already passed as the name of a valid param, so let it pass;
# value should be validated in subclass _validate_params override
elif isinstance(param_name, str):
# FIX: 10/3/17 - THIS IS A HACK; IT SHOULD BE HANDLED EITHER
# FIX: MORE GENERICALLY OR LOCALLY (E.G., IN OVERRIDE OF _validate_params)
if param_name == 'matrix':
if is_matrix(self.paramClassDefaults[param_name]):
# FIX: ?? ASSIGN VALUE HERE, OR SIMPLY ALLOW AND ASSUME IT WILL BE PARSED ELSEWHERE
# param_value = self.paramClassDefaults[param_name]
# target_set[param_name] = param_value
target_set[param_name] = param_value
else:
raise ComponentError("Value of {} param for {} ({}) must be a valid matrix specification".
format(param_name, self.name, param_value))
target_set[param_name] = param_value

# Parameter is not a valid type
else:
if type(self.paramClassDefaults[param_name]) is type:
type_name = 'the name of a subclass of ' + self.paramClassDefaults[param_name].__base__.__name__
else:
type_name = self.paramClassDefaults[param_name].__class__.__name__
if param_name == 'matrix':
raise ComponentError("Value of {} param for {} ({}) must be a valid matrix specification".
format(param_name, self.name, param_value))
raise ComponentError("Value of {} param for {} ({}) must be compatible with {}".
raise ComponentError("Value of {} param for {} ({}) is not compatible with {}".
format(param_name, self.name, param_value, type_name))

def _get_param_value_from_tuple(self, param_spec):
Expand Down
41 changes: 32 additions & 9 deletions psyneulink/components/mechanisms/processing/objectivemechanism.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@
from psyneulink.components.mechanisms.processing.processingmechanism import ProcessingMechanism_Base
from psyneulink.components.states.outputstate import OutputState, PRIMARY_OUTPUT_STATE, standard_output_states
from psyneulink.components.states.state import _parse_state_spec
from psyneulink.globals.keywords import CONTROL, EXPONENTS, FUNCTION, INPUT_STATES, LEARNING, MATRIX, OBJECTIVE_MECHANISM, SENDER, TIME_SCALE, VARIABLE, WEIGHTS, kwPreferenceSetName, DEFAULT_MATRIX
from psyneulink.globals.keywords import CONTROL, EXPONENTS, FUNCTION, INPUT_STATES, LEARNING, MATRIX, \
OBJECTIVE_MECHANISM, SENDER, TIME_SCALE, VARIABLE, WEIGHTS, kwPreferenceSetName, DEFAULT_MATRIX, DEFAULT_VARIABLE
from psyneulink.globals.preferences.componentpreferenceset import is_pref_set, kpReportOutputPref
from psyneulink.globals.preferences.preferenceset import PreferenceEntry, PreferenceLevel
from psyneulink.globals.utilities import ContentAddressableList
Expand Down Expand Up @@ -640,7 +641,7 @@ class ClassDefaults(ProcessingMechanism_Base.ClassDefaults):
# FIX: TYPECHECK MONITOR TO LIST OR ZIP OBJECT
@tc.typecheck
def __init__(self,
input_states=None,
default_variable=None,
function=LinearCombination,
output_states:tc.optional(tc.any(list, dict))=[OUTCOME],
params=None,
Expand All @@ -651,16 +652,38 @@ def __init__(self,

if MONITORED_OUTPUT_STATES in kwargs and kwargs[MONITORED_OUTPUT_STATES] is not None:
name_string = name or 'an ' + ObjectiveMechanism.__name__
if input_states:
# warnings.warn("Both \'{}\' and \'{}\' args were specified in constuctor for {}; "
# "an attempt will be made to merge them but this may produce unexpected results.".
# format(MONITORED_OUTPUT_STATES, INPUT_STATES, name_string))
input_states.append(kwargs[MONITORED_OUTPUT_STATES])
# FIX: 10/26/17: TRY TO INTEGRATE input_states AND monitored_output_states
# FIX: OR DOCUMENT OTHERWISE (I.E., USE OF default_variable
# if input_states:
# raise ObjectiveMechanismError("Both \'{}\' and \'{}\' args were specified in constuctor for {}.".
# format(MONITORED_OUTPUT_STATES, INPUT_STATES, name_string))
# # warnings.warn("Both \'{}\' and \'{}\' args were specified in constuctor for {}; "
# # "an attempt will be made to merge them but this may produce unexpected results.".
# # format(MONITORED_OUTPUT_STATES, INPUT_STATES, name_string))
# # if not len(input_states) == len(kwargs[MONITORED_OUTPUT_STATES]):
# # raise ObjectiveMechanismError("The {} arg specified for {} ({}) must be the same length as {} ({})".
# # format(INPUT_STATES,name,input_states,
# # MONITORED_OUTPUT_STATES,
# # kwargs[MONITORED_OUTPUT_STATES] ))
input_states = kwargs[MONITORED_OUTPUT_STATES]
del kwargs[MONITORED_OUTPUT_STATES]
if kwargs:
if INPUT_STATES in kwargs:
raise ObjectiveMechanismError("\'{}\' argument is not supported for an {} "
"(found in constructor for: \'{}\'); \'{}\' should be used instead".
format(INPUT_STATES,
self.__class__.__name__,
name_string,
MONITORED_OUTPUT_STATES))
# if DEFAULT_VARIABLE in kwargs:
# raise ObjectiveMechanismError("\'{}\' argument is not supported for an {} "
# "(found in constructor for: \'{}\'); \'{}\' should be used instead".
# format(INPUT_STATES,
# self.__class__.__name__,
# name_string,
# MONITORED_OUTPUT_STATES))
raise ObjectiveMechanismError("\'Invalid arguments used in constructor for {}".
format(kwargs.keys(), name_string))
format(kwargs.keys(), name))

# Assign args to params and functionParams dicts (kwConstants must == arg names)
params = self._assign_args_to_param_dicts(input_states=input_states,
Expand All @@ -676,7 +699,7 @@ def __init__(self,
self.standard_output_states,
indices=PRIMARY_OUTPUT_STATE)

super().__init__(variable=None,
super().__init__(variable=default_variable,
input_states=input_states,
output_states=output_states,
params=params,
Expand Down
Loading