示例#1
0
    def test_composite_condition_multi(self):
        comp = Composition()
        A = TransferMechanism(function=Linear(slope=5.0, intercept=2.0), name='A')
        B = TransferMechanism(function=Linear(intercept=4.0), name='B')
        C = TransferMechanism(function=Linear(intercept=1.5), name='C')
        for m in [A, B, C]:
            comp.add_node(m)
        comp.add_projection(MappingProjection(), A, B)
        comp.add_projection(MappingProjection(), B, C)
        sched = Scheduler(composition=comp)

        sched.add_condition(A, EveryNPasses(1))
        sched.add_condition(B, EveryNCalls(A, 2))
        sched.add_condition(C, All(
            Any(
                AfterPass(6),
                AfterNCalls(B, 2)
            ),
            Any(
                AfterPass(2),
                AfterNCalls(B, 3)
            )
        )
        )

        termination_conds = {}
        termination_conds[TimeScale.RUN] = AfterNTrials(1)
        termination_conds[TimeScale.TRIAL] = AfterNCalls(C, 3)
        output = list(sched.run(termination_conds=termination_conds))
        expected_output = [
            A, A, B, A, A, B, C, A, C, A, B, C
        ]
        assert output == pytest.helpers.setify_expected_output(expected_output)
示例#2
0
    def test_two_ABB(self):
        A = TransferMechanism(
            name='A',
            default_variable=[0],
            function=Linear(slope=2.0),
        )

        B = IntegratorMechanism(name='B',
                                default_variable=[0],
                                function=SimpleIntegrator(rate=.5))

        c = Composition(pathways=[A, B])

        term_conds = {TimeScale.TRIAL: AfterNCalls(B, 2)}
        stim_list = {A: [[1]]}

        sched = Scheduler(composition=c)
        sched.add_condition(A, Any(AtPass(0), AfterNCalls(B, 2)))
        sched.add_condition(B, Any(JustRan(A), JustRan(B)))
        c.scheduler = sched

        c.run(inputs=stim_list, termination_processing=term_conds)

        terminal_mech = B
        expected_output = [
            numpy.array([2.]),
        ]

        for i in range(len(expected_output)):
            numpy.testing.assert_allclose(
                expected_output[i],
                terminal_mech.get_output_values(c)[i])
示例#3
0
    def test_system_run_with_combined_condition(self):

        # Construction
        T = TransferMechanism()
        P = Process(pathway=[T])
        S = System(processes=[P])

        # Runtime param used for noise
        # ONLY mechanism value should reflect runtime param -- attr should be changed back by the time we inspect it
        S.run(inputs={T: 2.0},
              runtime_params={
                  T: {
                      "noise": (10.0, Any(AtTrial(1), AfterTrial(2)))
                  }
              },
              num_trials=5)

        # Runtime param NOT used for noise
        S.run(inputs={T: 2.0})

        assert np.allclose(
            S.results,
            [
                [np.array([2.])],  # Trial 0 - NOT condition 0, NOT condition 1
                [np.array([12.])],  # Trial 1 - condition 0, NOT condition 1
                [np.array([2.])],  # Trial 2 - NOT condition 0, NOT condition 1
                [np.array([12.])],  # Trial 3 - NOT condition 0, condition 1
                [np.array([12.])],  # Trial 4 - NOT condition 0, condition 1
                [np.array([2.])]
            ])  # New run (runtime param no longer applies)
示例#4
0
    def test_invtriangle_1(self):
        comp = Composition()
        A = TransferMechanism(function=Linear(slope=5.0, intercept=2.0), name='scheduler-pytests-A')
        B = TransferMechanism(function=Linear(intercept=4.0), name='scheduler-pytests-B')
        C = TransferMechanism(function=Linear(intercept=1.5), name='scheduler-pytests-C')
        for m in [A, B, C]:
            comp.add_node(m)
        comp.add_projection(MappingProjection(), A, C)
        comp.add_projection(MappingProjection(), B, C)

        sched = Scheduler(composition=comp)

        sched.add_condition(A, EveryNPasses(1))
        sched.add_condition(B, EveryNCalls(A, 2))
        sched.add_condition(C, Any(AfterNCalls(A, 3), AfterNCalls(B, 3)))

        termination_conds = {}
        termination_conds[TimeScale.RUN] = AfterNTrials(1)
        termination_conds[TimeScale.TRIAL] = AfterNCalls(C, 4, time_scale=TimeScale.TRIAL)
        output = list(sched.run(termination_conds=termination_conds))

        expected_output = [
            A, set([A, B]), A, C, set([A, B]), C, A, C, set([A, B]), C
        ]
        # pprint.pprint(output)
        assert output == pytest.helpers.setify_expected_output(expected_output)
    def test_composition_run_with_combined_condition(self):

        # Construction
        T = TransferMechanism()
        C = Composition()
        C.add_node(T)

        # Runtime param used for noise
        # ONLY mechanism value should reflect runtime param -- attr should be changed back by the time we inspect it
        C.run(inputs={T: 2.0},
              runtime_params={
                  T: {
                      "noise": (10.0, Any(AtTrial(1), AfterTrial(2)))
                  }
              },
              num_trials=5)

        # Runtime param NOT used for noise
        C.run(inputs={T: 2.0})

        assert np.allclose(
            C.results,
            [
                np.array([[2.]]),  # Trial 0 - NOT condition 0, NOT condition 1
                np.array([[12.]]),  # Trial 1 - condition 0, NOT condition 1
                np.array([[2.]]),  # Trial 2 - NOT condition 0, NOT condition 1
                np.array([[12.]]),  # Trial 3 - NOT condition 0, condition 1
                np.array([[12.]]),  # Trial 4 - NOT condition 0, condition 1
                np.array([[2.]])
            ])  # New run (runtime param no longer applies)
    def test_function_param_with_combined_condition(self):

        T = TransferMechanism()
        C = Composition()
        C.add_node(T)

        assert T.function.slope.base == 1.0
        assert T.parameter_ports['slope'].value == 1.0

        # run with runtime param used for slope only on trial 1 and after 2 (i.e., 3 and 4)
        C.run(inputs={T: 2.0},
              runtime_params={T: {"slope": (10.0, Any(AtTrial(1), AfterTrial(2)))}},
              num_trials=5)
        # slope restored to default
        assert T.function.slope.base == 1.0
        assert T.parameter_ports['slope'].value == 1.0

        # run again to insure restored default for slope after last run
        C.run(inputs={T: 2.0})

        # results reflect runtime_param used for slope only on trials 1, 3 and 4
        assert np.allclose(C.results,[np.array([[2.]]),      # Trial 0 - NOT condition 0, NOT condition 1
                                      np.array([[20.]]),     # Trial 1 - condition 0, NOT condition 1
                                      np.array([[2.]]),      # Trial 2 - NOT condition 0, NOT condition 1
                                      np.array([[20.]]),     # Trial 3 - NOT condition 0, condition 1
                                      np.array([[20.]]),     # Trial 4 - NOT condition 0, condition 1
                                      np.array([[2.]])])     # New run (runtime param no longer applies)
    def test_function_params_with_different_but_overlapping_conditions(self):

        T = TransferMechanism()
        C = Composition()
        C.add_node(T)

        assert T.function.slope.base == 1.0
        assert T.parameter_ports['slope'].value == 1.0

        # run with runtime param used for slope only on trial 1 and after 2 (i.e., 3 and 4)
        C.run(inputs={T: 2.0},
              runtime_params={T: {"slope": (10.0, Any(AtTrial(1), AfterTrial(2))),
                                  "intercept": (1.0, AfterTrial(1))}},
              num_trials=4)
        # slope restored to default
        assert T.function.slope.base == 1.0
        assert T.parameter_ports['slope'].value == 1.0
        assert T.function.intercept.base == 0.0
        assert T.parameter_ports['intercept'].value == 0.0

        # run again to insure restored default for slope after last run
        C.run(inputs={T: 2.0})

        # results reflect runtime_param used for slope only on trials 1, 3 and 4
        assert np.allclose(C.results,[np.array([[2.]]),      # Trial 0 - neither condition met
                                      np.array([[20.]]),     # Trial 1 - slope condition met, intercept not met
                                      np.array([[3.]]),      # Trial 2 - slope condition not met, intercept met
                                      np.array([[21.]]),      # Trial 3 - both conditions met
                                      np.array([[2.]])])     # New run (runtime param no longer applies)
    def test_params_for_modulatory_projection_in_parameter_port(self):

        T1 = TransferMechanism()
        T2 = TransferMechanism()
        CTL = ControlMechanism(control=ControlSignal(projections=('slope',T2)))
        C = Composition(pathways=[[T1,T2,CTL]])

        # Run 0
        C.run(inputs={T1: 2.0},
              runtime_params={
                  T2: {
                      PARAMETER_PORT_PARAMS: {
                          CONTROL_PROJECTION_PARAMS: {
                              'variable':(5, AtTrial(3)), # variable of all Projection to all ParameterPorts
                              'value':(10, AtTrial(4)),
                              'value':(21, AtTrial(5)),
                          },
                          # Test individual Projection specifications outside of type-specific dict
                          CTL.control_signals[0].efferents[0]: {'value':(32, AtTrial(6))},
                          'ControlProjection for TransferMechanism-1[slope]': {'value':(43, AtTrial(7))},
                      }
                  },
              },
              num_trials=8
              )
        CTL.control_signals[0].modulation = OVERRIDE
        # Run 1
        C.run(inputs={T1: 2.0},
              runtime_params={
                  T2: {
                      PARAMETER_PORT_PARAMS: {
                          CONTROL_PROJECTION_PARAMS: {
                              'value':(5, Any(AtTrial(0), AtTrial(2))),
                              'variable':(10, AtTrial(1)),
                              # Test individual Projection specifications inside of type-specific dict
                              'ControlProjection for TransferMechanism-1[slope]': {'value':(19, AtTrial(3))},
                              CTL.control_signals[0].efferents[0]: {'value':(33, AtTrial(4))},
                          },
                      }
                  },
              },
              num_trials=5
              )

        assert np.allclose(C.results,[         # Conditions satisfied:
            np.array([[2]]),   # Run 0, Trial 0: None (2 input; no control since that requires a cycle)
            np.array([[4]]),   # Run 0, Trial 1: None (2 input * 2 control gathered last cycle)
            np.array([[8]]),   # Run 0, Trial 2: None (2 input * 4 control gathered last cycle)
            np.array([[10]]),  # Run 0, Trial 3: ControlProjection variable (2*5)
            np.array([[20]]),  # Run 0, Trial 4: ControlProjection value (2*10)
            np.array([[42]]),  # Run 0, Trial 5: ControlProjection value using Projection type-specific keyword (2*210)
            np.array([[64]]),  # Run 0, Trial 6: ControlProjection value using individual Projection (2*32)
            np.array([[86]]),  # Run 0, Trial 7: ControlProjection value using individual Projection by name (2*43)
            np.array([[10]]),  # Run 1, Tria1 0: ControlProjection value with OVERRIDE using value (2*5)
            np.array([[20]]),  # Run 1, Tria1 1: ControlProjection value with OVERRIDE using variable (2*10)
            np.array([[10]]),  # Run 1, Tria1 2: ControlProjection value with OVERRIDE using value again (in Any) (2*5)
            np.array([[38]]),  # Run 1, Tria1 3: ControlProjection value with OVERRIDE using individ Proj by name (2*19)
            np.array([[66]]),  # Run 1: Trial 4: ControlProjection value with OVERRIDE using individ Proj  (2*33)
        ])
示例#9
0
    def test_five_ABABCDE(self):
        A = TransferMechanism(
            name='A',
            default_variable=[0],
            function=Linear(slope=2.0),
        )

        B = TransferMechanism(
            name='B',
            default_variable=[0],
            function=Linear(slope=2.0),
        )

        C = IntegratorMechanism(name='C',
                                default_variable=[0],
                                function=SimpleIntegrator(rate=.5))

        D = TransferMechanism(
            name='D',
            default_variable=[0],
            function=Linear(slope=1.0),
        )

        E = TransferMechanism(
            name='E',
            default_variable=[0],
            function=Linear(slope=2.0),
        )

        c = Composition(pathways=[[A, C, D], [B, C, E]])

        term_conds = {TimeScale.TRIAL: AfterNCalls(E, 1)}
        stim_list = {A: [[1]], B: [[2]]}

        sched = Scheduler(composition=c)
        sched.add_condition(C, Any(EveryNCalls(A, 1), EveryNCalls(B, 1)))
        sched.add_condition(D, EveryNCalls(C, 1))
        sched.add_condition(E, EveryNCalls(C, 1))
        c.scheduler = sched

        c.run(inputs=stim_list, termination_processing=term_conds)

        terminal_mechs = [D, E]
        expected_output = [
            [
                numpy.array([3.]),
            ],
            [
                numpy.array([6.]),
            ],
        ]

        for m in range(len(terminal_mechs)):
            for i in range(len(expected_output[m])):
                numpy.testing.assert_allclose(
                    expected_output[m][i],
                    terminal_mechs[m].get_output_values(c)[i])
示例#10
0
    def test_multisource_2(self):
        comp = Composition()
        A1 = TransferMechanism(function=Linear(slope=5.0, intercept=2.0), name='A1')
        A2 = TransferMechanism(function=Linear(slope=5.0, intercept=2.0), name='A2')
        B1 = TransferMechanism(function=Linear(intercept=4.0), name='B1')
        B2 = TransferMechanism(function=Linear(intercept=4.0), name='B2')
        B3 = TransferMechanism(function=Linear(intercept=4.0), name='B3')
        C1 = TransferMechanism(function=Linear(intercept=1.5), name='C1')
        C2 = TransferMechanism(function=Linear(intercept=.5), name='C2')
        for m in [A1, A2, B1, B2, B3, C1, C2]:
            comp.add_node(m)
        comp.add_projection(MappingProjection(), A1, B1)
        comp.add_projection(MappingProjection(), A1, B2)
        comp.add_projection(MappingProjection(), A2, B1)
        comp.add_projection(MappingProjection(), A2, B2)
        comp.add_projection(MappingProjection(), A2, B3)
        comp.add_projection(MappingProjection(), B1, C1)
        comp.add_projection(MappingProjection(), B2, C1)
        comp.add_projection(MappingProjection(), B1, C2)
        comp.add_projection(MappingProjection(), B3, C2)

        sched = Scheduler(composition=comp)

        sched.add_condition_set({
            A1: Always(),
            A2: Always(),
            B1: EveryNCalls(A1, 2),
            B3: EveryNCalls(A2, 2),
            B2: All(EveryNCalls(A1, 4), EveryNCalls(A2, 4)),
            C1: Any(AfterNCalls(B1, 2), AfterNCalls(B2, 2)),
            C2: Any(AfterNCalls(B2, 2), AfterNCalls(B3, 2)),
        })

        termination_conds = {}
        termination_conds[TimeScale.RUN] = AfterNTrials(1)
        termination_conds[TimeScale.TRIAL] = All(AfterNCalls(C1, 1), AfterNCalls(C2, 1))
        output = list(sched.run(termination_conds=termination_conds))

        expected_output = [
            set([A1, A2]), set([A1, A2]), set([B1, B3]), set([A1, A2]), set([A1, A2]), set([B1, B2, B3]), set([C1, C2])
        ]
        assert output == pytest.helpers.setify_expected_output(expected_output)
示例#11
0
    def test_linear_ABB(self):
        comp = Composition()
        A = TransferMechanism(function=Linear(slope=5.0, intercept=2.0), name='scheduler-pytests-A')
        B = TransferMechanism(function=Linear(intercept=4.0), name='scheduler-pytests-B')
        for m in [A, B]:
            comp.add_node(m)
        comp.add_projection(MappingProjection(), A, B)

        sched = Scheduler(composition=comp)

        sched.add_condition(A, Any(AtPass(0), EveryNCalls(B, 2)))
        sched.add_condition(B, Any(EveryNCalls(A, 1), EveryNCalls(B, 1)))

        termination_conds = {}
        termination_conds[TimeScale.RUN] = AfterNTrials(1)
        termination_conds[TimeScale.TRIAL] = AfterNCalls(B, 8, time_scale=TimeScale.TRIAL)
        output = list(sched.run(termination_conds=termination_conds))

        expected_output = [A, B, B, A, B, B, A, B, B, A, B, B]
        assert output == pytest.helpers.setify_expected_output(expected_output)
示例#12
0
    def test_four_ABBCD(self):
        A = TransferMechanism(
            name='A',
            default_variable=[0],
            function=Linear(slope=2.0),
        )

        B = IntegratorMechanism(name='B',
                                default_variable=[0],
                                function=SimpleIntegrator(rate=.5))

        C = IntegratorMechanism(name='C',
                                default_variable=[0],
                                function=SimpleIntegrator(rate=.5))

        D = TransferMechanism(
            name='D',
            default_variable=[0],
            function=Linear(slope=1.0),
        )

        p = Process(default_variable=[0], pathway=[A, B, D], name='p')

        q = Process(default_variable=[0], pathway=[A, C, D], name='q')

        s = System(processes=[p, q], name='s')

        term_conds = {TimeScale.TRIAL: AfterNCalls(D, 1)}
        stim_list = {A: [[1]]}

        sched = Scheduler(system=s)
        sched.add_condition(B, EveryNCalls(A, 1))
        sched.add_condition(C, EveryNCalls(A, 2))
        sched.add_condition(D, Any(EveryNCalls(B, 3), EveryNCalls(C, 3)))
        s.scheduler_processing = sched

        s.run(inputs=stim_list, termination_processing=term_conds)

        terminal_mechs = [D]
        expected_output = [
            [
                numpy.array([4.]),
            ],
        ]

        for m in range(len(terminal_mechs)):
            for i in range(len(expected_output[m])):
                numpy.testing.assert_allclose(
                    expected_output[m][i],
                    terminal_mechs[m].get_output_values(s)[i])
示例#13
0
    def test_params_for_input_port_and_projection_variable_and_value(self):

        SAMPLE_INPUT = TransferMechanism()
        TARGET_INPUT = TransferMechanism()
        CM = ComparatorMechanism()
        P1 = MappingProjection(sender=SAMPLE_INPUT, receiver=CM.input_ports[SAMPLE], name='SAMPLE PROJECTION')
        P2 = MappingProjection(sender=TARGET_INPUT, receiver=CM.input_ports[TARGET], name='TARGET PROJECTION')
        C = Composition(nodes=[SAMPLE_INPUT, TARGET_INPUT, CM], projections=[P1,P2])

        SAMPLE_INPUT.function.slope.base = 3
        CM.input_ports[SAMPLE].function.scale.base = 2

        TARGET_INPUT.input_port.function.scale.base = 4
        CM.input_ports[TARGET].function.scale.base = 1.5

        C.run(inputs={SAMPLE_INPUT: 2.0,
                      TARGET_INPUT: 5.0},
              runtime_params={
                  CM: {
                      CM.input_ports[SAMPLE]: {'variable':(83,AtTrial(0))}, # InputPort object outside INPUT_PORT_PARAMS
                      'TARGET': {'value':(999, Any(AtTrial(1),AtTrial(2)))},# InputPort by name outsideINPUT_PORT_PARAMS
                      INPUT_PORT_PARAMS: {
                          'scale': (15, AtTrial(2)),                       # all InputPorts
                          MAPPING_PROJECTION_PARAMS:{'value':(20, Any(AtTrial(3), AtTrial(4))), # all MappingProjections
                                                     'SAMPLE PROJECTION': {'value':(42, AfterTrial(3))}, # By name
                                                     P2:{'value':(156, AtTrial(5))}}                     # By Projection
                      }}},
              num_trials=6
              )
        assert np.allclose(C.results,[   # Conditions satisfied:          CM calculates: TARGET-SAMPLE:
            np.array([[-136.0]]), # Trial 0: CM SAMPLE InputPort variable (5*4*2.5 - 83*2)
            np.array([[987]]),    # Trial 1: CM TARGET InputPort value    (999 - 2*3*2)
            np.array([[909]]),    # Trial 2: CM TARGET InputPort value + CM Inputports SAMPLE fct scale: (999 - 2*3*15)
            np.array([[-10]]),    # Trial 3: Both CM MappingProjections value, scale default (20*1.5 - 20*2)
            np.array([[-54]]),    # Trial 4: Same as 3, but superceded by value for SAMPLE Projection (20*1.5 - 42*2)
            np.array([[150]]),    # Trial 5: Same as 4, but superceded by value for TARGET Projection ((156*1.5-42*2))
        ])
示例#14
0
        def test_All_end_after_one_finished(self):
            comp = Composition()
            A = TransferMechanism(function=Linear(slope=5.0, intercept=2.0), name='A')
            for m in [A]:
                comp.add_node(m)
            sched = Scheduler(composition=comp)

            sched.add_condition(A, EveryNPasses(1))

            termination_conds = {}
            termination_conds[TimeScale.RUN] = AfterNTrials(1)
            termination_conds[TimeScale.TRIAL] = Any(AfterNCalls(A, 5), AtPass(10))
            output = list(sched.run(termination_conds=termination_conds))

            expected_output = [A for _ in range(5)]
            assert output == pytest.helpers.setify_expected_output(expected_output)
示例#15
0
    def test_three_ABAC_convenience(self):
        A = IntegratorMechanism(name='A',
                                default_variable=[0],
                                function=SimpleIntegrator(rate=.5))

        B = TransferMechanism(
            name='B',
            default_variable=[0],
            function=Linear(slope=2.0),
        )
        C = TransferMechanism(
            name='C',
            default_variable=[0],
            function=Linear(slope=2.0),
        )

        p = Process(default_variable=[0], pathway=[A, B], name='p')

        q = Process(default_variable=[0], pathway=[A, C], name='q')

        s = System(processes=[p, q], name='s')

        term_conds = {TimeScale.TRIAL: AfterNCalls(C, 1)}
        stim_list = {A: [[1]]}

        s.scheduler_processing.add_condition(
            B, Any(AtNCalls(A, 1), EveryNCalls(A, 2)))
        s.scheduler_processing.add_condition(C, EveryNCalls(A, 2))

        s.run(inputs=stim_list, termination_processing=term_conds)

        terminal_mechs = [B, C]
        expected_output = [
            [
                numpy.array([1.]),
            ],
            [
                numpy.array([2.]),
            ],
        ]

        for m in range(len(terminal_mechs)):
            for i in range(len(expected_output[m])):
                numpy.testing.assert_allclose(
                    expected_output[m][i],
                    terminal_mechs[m].get_output_values(s)[i])
示例#16
0
    def test_three_integrators(self):
        A = IntegratorMechanism(name='A',
                                default_variable=[0],
                                function=SimpleIntegrator(rate=1))

        B = IntegratorMechanism(name='B',
                                default_variable=[0],
                                function=SimpleIntegrator(rate=1))

        C = IntegratorMechanism(name='C',
                                default_variable=[0],
                                function=SimpleIntegrator(rate=1))

        p = Process(default_variable=[0], pathway=[A, C], name='p')

        q = Process(default_variable=[0], pathway=[B, C], name='q')

        s = System(processes=[p, q], name='s')

        term_conds = {TimeScale.TRIAL: AfterNCalls(C, 2)}
        stim_list = {A: [[1]], B: [[1]]}

        sched = Scheduler(system=s)
        sched.add_condition(B, EveryNCalls(A, 2))
        sched.add_condition(C, Any(EveryNCalls(A, 1), EveryNCalls(B, 1)))
        s.scheduler_processing = sched

        s.run(inputs=stim_list, termination_processing=term_conds)

        mechs = [A, B, C]
        expected_output = [
            [
                numpy.array([2.]),
            ],
            [
                numpy.array([1.]),
            ],
            [
                numpy.array([4.]),
            ],
        ]

        for m in range(len(mechs)):
            for i in range(len(expected_output[m])):
                numpy.testing.assert_allclose(expected_output[m][i],
                                              mechs[m].get_output_values(s)[i])
示例#17
0
    def test_10b(self):
        comp = Composition()
        A = TransferMechanism(function=Linear(slope=5.0, intercept=2.0), name='scheduler-pytests-A')
        A._is_finished = False
        B = TransferMechanism(function=Linear(intercept=4.0), name='scheduler-pytests-B')

        for m in [A, B]:
            comp.add_node(m)
        comp.add_projection(MappingProjection(), A, B)

        sched = Scheduler(composition=comp)

        sched.add_condition(A, EveryNPasses(1))
        sched.add_condition(B, Any(WhenFinished(A), AfterNCalls(A, 3)))

        termination_conds = {}
        termination_conds[TimeScale.RUN] = AfterNTrials(1)
        termination_conds[TimeScale.TRIAL] = AfterNCalls(B, 4)
        output = list(sched.run(termination_conds=termination_conds))

        expected_output = [A, A, A, B, A, B, A, B, A, B]
        assert output == pytest.helpers.setify_expected_output(expected_output)
示例#18
0
    def test_params_for_output_port_variable_and_value(self):

        T1 = TransferMechanism(output_ports=['FIRST', 'SECOND'])
        T2 = TransferMechanism()
        T3 = TransferMechanism()
        # C = Composition(pathways=[[T1.output_ports['FIRST'],T2],
        #                           [T1.output_ports['SECOND'],T3]])
        # FIX 5/8/20 [JDC]: NEED TO ADD PROJECTIONS SINCE CAN'T SPECIFIY OUTPUT PORT IN PATHWAY
        P1 = MappingProjection(sender=T1.output_ports['FIRST'], receiver=T2)
        P2 = MappingProjection(sender=T1.output_ports['SECOND'], receiver=T2)
        C = Composition(nodes=[T1,T2], projections=[P1,P2])

        T1.output_ports['SECOND'].function.slope.base = 1.5

        # Run 0: Test of both OutputPort variables assigned
        C.run(inputs={T1: 10.0},
              runtime_params={
                  T1: {OUTPUT_PORT_PARAMS: {'variable': 2}}}
              )
        assert T1.value == 0.0 # T1 did not execute since both of its OutputPorts were assigned a variable
        assert T2.value == 5   # (2*1 + 2*1.5)

        # Run 1: Test of both OutputPort values assigned
        C.run(inputs={T1: 11.0},
              runtime_params={
                  T1: {OUTPUT_PORT_PARAMS: {'value': 3}}}
              )
        assert T1.value == 0.0 # T1 did not execute since both of its OutputPorts were assigned a value
        assert T2.value == 6   # (3 + 3)

        # Run 2: Test of on OutputPort variable and the other value assigned
        C.run(inputs={T1: 12.0},
              runtime_params={
                  T1: {OUTPUT_PORT_PARAMS: {
                          'FIRST': {'value': 5},
                          'SECOND': {'variable': 13}}}}
              )
        assert T1.value == 0.0 # T1 did not execute since both of its OutputPorts were assigned a variable or value
        assert T2.value == 24.5   # (5 + 13*1.5)

        # Run 3: Tests of numerical accuracy over all permutations of assignments
        C.run(inputs={T1: 2.0},
              runtime_params={
                  T1: {
                      OUTPUT_PORT_PARAMS: {
                          'variable':(1.7, AtTrial(1)), # variable of all Projection to all ParameterPorts
                          'value':(3, AtTrial(2)),
                          'FIRST': {'variable':(5, Any(AtTrial(3),AtTrial(5),AtTrial(9),AtTrial(11))),
                                    'value':(7, Any(AtTrial(6),AtTrial(8),AtTrial(10),AtTrial(12)))
                                    },
                          'SECOND': {'variable': (11, Any(AtTrial(4),AtTrial(5),AtTrial(10),AtTrial(11),AtTrial(12))),
                                     'value': (13, Any(AtTrial(7),AtTrial(8),AtTrial(9),AtTrial(11),AtTrial(12)))
                                     },
                      },
                  },
                  T2: {
                      'slope': 3
                  },
              },
              num_trials=13
              )
        assert np.allclose(C.results,[         # OutputPort Conditions satisfied:
            np.array([[5]]),      # Run 0, Trial 0:  See above
            np.array([[6]]),      # Run 1, Trial 0:  See above
            np.array([[24.5]]),   # Run 2, Trial 0:  See above
            np.array([[15]]),     # Run 3, Trial 0:  None (2*1 + 2*1.5) * 3
            np.array([[12.75]]),  # Run 3, Trial 1:  variable general (1.7*1 + 1.7*1.5) * 3
            np.array([[18]]),     # Run 3, Trial 2:  value general (3*1 + 3*1) * 3
            np.array([[24]]),     # Run 3, Trial 3:  FIRST variable (5*1 + 2*1.5) * 3
            np.array([[55.5]]),   # Run 3, Trial 4:  SECOND variable (2*1 + 11*1.5) * 3
            np.array([[64.5]]),   # Run 3, Trial 5:  FIRST and SECOND variable (5*1 + 11*1.5) * 3
            np.array([[30]]),     # Run 3, Trial 6:  FIRST value (7 + 2*1.5) * 3
            np.array([[45]]),     # Run 3, Trial 7:  SECOND value (2*1 + 13) * 3
            np.array([[60]]),     # Run 3, Trial 8:  FIRST and SECOND value (7+13) * 3
            np.array([[54]]),     # Run 3, Trial 9:  FIRST variable and SECOND value (5*1 + 13) * 3
            np.array([[70.5]]),   # Run 3, Trial 10: FIRST value and SECOND variable (7 + 11*1.5) * 3
            np.array([[54]]),     # Run 3, Trial 11: FIRST and SECOND variable and SECOND value (5*1 + 13) * 3
            np.array([[60]]),     # Run 3, Trial 12: FIRST and SECOND value and SECOND variable (7+13) * 3
        ])