function=pnl.FitzHughNagumoIntegrator(
                                 name='FitzHughNagumoIntegrator Function-0',
                                 d_v=1,
                                 initial_v=-1,
                                 initializer=[[0]],
                                 default_variable=[[0]]))
im = pnl.IntegratorMechanism(name='im',
                             function=pnl.AdaptiveIntegrator(
                                 initializer=[[0]],
                                 rate=0.5,
                                 default_variable=[[0]]))

comp.add_node(fn)
comp.add_node(im)

comp.add_projection(projection=pnl.MappingProjection(
    name='MappingProjection from fn[OutputPort-0] to im[InputPort-0]',
    function=pnl.LinearMatrix(matrix=[[1.0]], default_variable=[-1.0])),
                    sender=fn,
                    receiver=im)

comp.scheduler.add_condition(fn, pnl.Always())
comp.scheduler.add_condition(
    im, pnl.All(pnl.EveryNCalls(fn, 20.0), pnl.AfterNCalls(fn, 1600.0)))

comp.scheduler.termination_conds = {
    pnl.TimeScale.RUN: pnl.Never(),
    pnl.TimeScale.TRIAL: pnl.AfterNCalls(fn, 2000)
}
comp.show_graph()
Ejemplo n.º 2
0
)
F = pnl.TransferMechanism(
    name="F",
    function=pnl.Linear(default_variable=[[0]]),
    termination_measure=pnl.Distance(
        metric=pnl.MAX_ABS_DIFF, default_variable=[[[0]], [[0]]]
    ),
)

Inner_Composition.add_node(E)
Inner_Composition.add_node(F)

Inner_Composition.add_projection(
    projection=pnl.MappingProjection(
        name="MappingProjection from E[RESULT] to F[InputPort-0]",
        function=pnl.LinearMatrix(matrix=[[1.0]]),
    ),
    sender=E,
    receiver=F,
)


Inner_Composition.scheduler.termination_conds = {
    pnl.TimeScale.RUN: pnl.Never(),
    pnl.TimeScale.TRIAL: pnl.AllHaveRun(),
}

comp.add_node(A)
comp.add_node(B)
comp.add_node(C)
comp.add_node(D)
Stroop_model.add_node(color_input)
Stroop_model.add_node(color_hidden)
Stroop_model.add_node(OUTPUT)
Stroop_model.add_node(word_input)
Stroop_model.add_node(word_hidden)
Stroop_model.add_node(task_input)
Stroop_model.add_node(TASK)
Stroop_model.add_node(DECISION)
Stroop_model.add_node(Conflict_Monitor, pnl.NodeRole.CONTROLLER_OBJECTIVE)

Stroop_model.add_projection(
    projection=pnl.MappingProjection(
        name=
        "MappingProjection_from_task_input_OutputPort_0__to_TASK_InputPort_0_",
        function=pnl.LinearMatrix(default_variable=[0.0, 0.0],
                                  matrix=[[1.0, 0.0], [0.0, 1.0]]),
    ),
    sender=task_input,
    receiver=TASK,
)
Stroop_model.add_projection(
    projection=pnl.MappingProjection(
        name="MappingProjection_from_OUTPUT_OutputPort_0__to_DECISION_ARRAY_",
        function=pnl.LinearMatrix(default_variable=[0.5, 0.5],
                                  matrix=[[1.0, 0.0], [0.0, 1.0]]),
    ),
    sender=OUTPUT,
    receiver=DECISION,
)
Stroop_model.add_projection(
    projection=pnl.MappingProjection(
Ejemplo n.º 4
0
        b_w=0.8,
        initial_v=-1.2,
        initial_w=-0.6,
        time_step_size=0.001,
    ),
)
syn1 = pnl.TransferMechanism(name="syn1", function=pnl.Exponential)

composition.add_node(fnPop1)
composition.add_node(fnPop2)
composition.add_node(syn1)

composition.add_projection(
    projection=pnl.MappingProjection(
        name="MappingProjection from syn1[OutputPort-0] to fnPop1[InputPort-0]",
        function=pnl.LinearMatrix(matrix=[[1.0]]),
        matrix=[[1.0]],
    ),
    sender=syn1,
    receiver=fnPop1,
)
composition.add_projection(
    projection=pnl.MappingProjection(
        name="MappingProjection from fnPop1[OutputPort-0] to fnPop2[InputPort-0]",
        function=pnl.LinearMatrix(matrix=[[1.0]]),
        matrix=[[1.0]],
    ),
    sender=fnPop1,
    receiver=fnPop2,
)
composition.show_graph()
                                               rate=0.5,
                                               default_variable=[[0]]),
    termination_measure=pnl.Distance(metric=pnl.MAX_ABS_DIFF,
                                     default_variable=[[[0]], [[0]]]),
)
Inner_Composition = pnl.Composition(name="Inner_Composition")

comp.add_node(A)
comp.add_node(B)
comp.add_node(C)
comp.add_node(Inner_Composition)

comp.add_projection(
    projection=pnl.MappingProjection(
        name="MappingProjection_from_A_RESULT__to_B_InputPort_0_",
        function=pnl.LinearMatrix(default_variable=[2.0], matrix=[[1.0]]),
    ),
    sender=A,
    receiver=B,
)
comp.add_projection(
    projection=pnl.MappingProjection(
        name="MappingProjection_from_A_RESULT__to_C_InputPort_0_",
        function=pnl.LinearMatrix(default_variable=[2.0], matrix=[[1.0]]),
    ),
    sender=A,
    receiver=C,
)

comp.scheduler.add_condition(A, pnl.Always())
comp.scheduler.add_condition(B, pnl.EveryNCalls(dependency=A, n=1))