# create chunks based on its interactions with audio-visual stimuli. chunk_db = Chunks() ### Agent Assembly ### # The assembly process should be familiar from the free association example, # with only a couple of mild novelties. alice = Structure(name=agent("alice")) with alice: stimulus = Construct(name=buffer("stimulus"), process=Stimulus()) nacs = Structure(name=subsystem("nacs"), assets=Assets(chunk_db=chunk_db)) with nacs: # Although the entry point for the NACS are chunks, in this example we # start with features as there are no constructs that initially # activate chunks in the NACS activation cycle. Construct(name=features("main"), process=MaxNodes(sources=[buffer("stimulus")])) Construct(name=flow_bt("main"), process=BottomUp(source=features("main"), chunks=nacs.assets.chunk_db)) Construct(name=chunks("main"),
alice = Structure(name=agent("alice"), assets=Assets(visual_domain=visual_domain, wm_interface=wm_interface, speech_interface=speech_interface)) with alice: stimulus = Construct(name=buffer("stimulus"), process=Stimulus()) acs_ctrl = Construct(name=buffer("acs_ctrl"), process=Stimulus()) # We define the working memory, by entrusting the working memory buffer # construct to the RegisterArray process. wm = Construct(name=buffer("wm"), process=RegisterArray(controller=(subsystem("acs"), terminus("wm")), sources=((subsystem("nacs"), terminus("retrieval")), ), interface=wm_interface)) defaults = Construct(name=buffer("defaults"), process=Constants(strengths=default_strengths)) acs = Structure(name=subsystem("acs")) with acs: # We include a flow_in construct to handle converting chunk activations # from working memory into features that the ACS can understand.
def test_goal_buffer_push(self): # TODO: Add assertions... interface = GoalStay.Interface(name="gctl", goals=(feature("goal", "select"), feature("goal", "analyze"), feature("goal", "evaluate"), feature("gobj", "attribute"), feature("gobj", "response"), feature("gobj", "pattern"))) chunks = Chunks() blas = BLAs(density=1.0) gb = GoalStay(controller=(subsystem("acs"), terminus("gb_actions")), source=(subsystem("ms"), terminus("goal_selection")), interface=interface, chunks=chunks, blas=blas) input_ = nd.NumDict( { feature(("gctl", ".cmd"), ".w"): 1.0, feature(("gctl", "goal"), "analyze"): 1.0, feature(("gctl", "gobj"), "pattern"): 1.0 }, default=0) inputs = { (subsystem("acs"), terminus("gb_actions")): input_, (subsystem("ms"), terminus("goal_selection")): nd.NumDict(default=0) } output = gb.call(inputs) chunks.step() # pprint(output) # pprint(chunks) # pprint(blas) input_ = nd.NumDict( { feature(("gctl", ".cmd"), ".w"): 1.0, feature(("gctl", "goal"), "evaluate"): 1.0, feature(("gctl", "gobj"), "attribute"): 1.0 }, default=0) inputs = { (subsystem("acs"), terminus("gb_actions")): input_, (subsystem("ms"), terminus("goal_selection")): nd.NumDict(default=0) } output = gb.call(inputs) chunks.step() # pprint(output) # pprint(chunks) # pprint(blas) input_ = nd.NumDict( { feature(("gctl", ".cmd"), ".f"): 1.0, feature(("gctl", "goal"), "analyze"): 1.0, feature(("gctl", "gobj"), "pattern"): 1.0 }, default=0) inputs = { (subsystem("acs"), terminus("gb_actions")): input_, (subsystem("ms"), terminus("goal_selection")): nd.NumDict({chunk(".goal_1"): 1.0}) } output = gb.call(inputs) chunks.step()
stimulus = Construct(name=buffer("stimulus"), process=Stimulus()) # The acs_ctrl construct is an entry point for manually passing in commands # to the action-centered subsystem (ACS). Normally, the ACS would select # actions using action-centered knowledge based on perceptual stimuli, # working memory etc. For simplicity, we directly stimulate the action # features in the ACS to drive action selection. acs_ctrl = Construct(name=buffer("acs_ctrl"), process=Stimulus()) # The gate is implemented as a buffer entrusted to a ParamSet process, as # mentioned earlier. To initialize the ParamSet instance, we must specify a # controller and pass in a gate interface. gate = Construct(name=buffer("gate"), process=ParamSet(controller=(subsystem("acs"), terminus("nacs")), interface=alice.assets.gate_interface)) # The defaults are handled by a buffer entrusted to a Constants process, # which simply outputs the defaults we defined above. defaults = Construct(name=buffer("defaults"), process=Constants(strengths=default_strengths)) # This simulation adds an entirely new subsystem to the model: the # action-centered subystem, which handles action selection. We keep this # ACS to a bare minimum. acs = Structure(name=subsystem("acs"))
# of purposes that involve gating or transforming inputs to the subsystem. alice = Structure( name=agent("alice") ) with alice: stimulus = Construct( name=buffer("stimulus"), process=Stimulus() ) nacs = Structure( name=subsystem("nacs"), ) with nacs: Construct( name=flow_in("lag"), process=Lag( source=features("main"), max_lag=1 ) ) Construct( name=features("main"), process= MaxNodes(
learner = Structure(name=agent("learner"), assets=Assets(domain=domain, interface=interface, r_map=r_map)) with learner: sensory = Construct(name=buffer("sensory"), process=Stimulus()) # For this example, we will provide reinforcements directly through the use # of a stimulus buffer. In more sophisticated models, reinforcements may be # generated by the Meta-Cognitive Subsystem. reinforcement = Construct(name=buffer("reinforcement"), process=Stimulus()) acs = Structure(name=subsystem("acs")) with acs: # We use a simple repeater to relay the actions selected on the # previous step back to the qnet. Construct(name=flow_in("ext_actions_lag1"), process=Repeater(source=terminus("ext_actions"))) Construct(name=features("in"), process=MaxNodes(sources=[buffer("sensory")])) # We construct the Q-Net just like any other Process instance and # integrate it into the bottom level. Note that it is designated as a # construct of type flow_bb. The particular Process class used here,
# working memory etc. For simplicity, we directly stimulate the action # features in the ACS to drive action selection. acs_ctrl = Construct( name=buffer("acs_ctrl"), process=Stimulus() ) # The gate is implemented as a buffer entrusted to a ParamSet process, as # mentioned earlier. To initialize the ParamSet instance, we must specify a # controller and pass in a gate interface. gate = Construct( name=buffer("gate"), process=ParamSet( controller=(subsystem("acs"), terminus("nacs")), interface=alice.assets.gate_interface ) ) # The defaults are handled by a buffer entrusted to a Constants process, # which simply outputs the defaults we defined above. defaults = Construct( name=buffer("defaults"), process=Constants(strengths=default_strengths) ) # This simulation adds an entirely new subsystem to the model: the # action-centered subystem, which handles action selection. We keep this # ACS to a bare minimum.