-
Notifications
You must be signed in to change notification settings - Fork 1
Home_old
Welcome to the Python_ACT-R_Documentation wiki!
This page acts as the main page to the Python ACT-R documentation wiki. Here is a brief overview of the Python ACT-R system and components. Included in this page is also a general overview and examples of how models are programmed.
Python ACT-R is an implementation of the cognitive architecture ACT-R written in Python by Terrence C. Stewart and Robert L. West at Carleton University, Canada. It is an agent based system used to run simulations with one or more agents in a virtual environment.
A simulation is written in python using the ccm library and then is run as a python program. A simulation consists of one or more agents with a series of events and productions being executed. A scheduler keeps track of running events while models add events to the scheduler. New events being added to the scheduler and then being executed by agents keep the system running.
ACT-R is implemented through one of the available models in the ccm library.
Agents in Python ACT-R are represented by the Model class, the base class of all other models in the system, and contains an instance of the scheduler and necessary functions required to run in a simulation as an agent.
A simulation using Python ACT-R runs by calling the run command of an agent. The agent being run acts as the environment which all other agents run within and can interact in. That being said, running a simulation begins when an agent is run. The agent run is the environment while all the other agent in the environment, the 'run' agent, are a part of that simulation.
Both goal driven autonomous and non goal driven agents are represent as being Model class instances. Representations of a real life object, such as a tree can be represented as an "agent" within the environment as a Model class instance. It is possible to also represent a tree as a piece of information stored within an already existing agent as a buffer. The main difference is a tree represented as an individual agent by being an instance of the Model class can interact with other agents in the system, while the later can not directly do so and exists as a piece of information in an agent.
As an agent or as information within an agent entities in a Python ACT-R simulation are mainly represented through Model instances in the environment. Even the environment is a Model class instance.
The environment is a class which the user writes. It inherits from the Model class and is used to run a simulation. The environment class is where you can add all of the objects needed in a simulation as class attributes in either the class declaration or using the "." operator with an environment instance. The attributes added must be a Model class or one of the other Model classes in the ccm library.
ex:
import ccm
class Environment(ccm.Model):
# Adding objects in environment class as class attributes
bread = ccm.Model(isa='bread',location='on_counter')
cheese = ccm.Model(isa='cheese',location='on_counter')
# Make an instance of the environment
env = Environment()
# Use the "." operator to add an object to the environment
env.ham = ccm.Model(isa='ham',location='on_counter')
An empty environment can also be created using pass to be populated with agents later:
class Environment(ccm.Model):
pass
env = Environment()
Note that the class name for the environment does not need to be a specific name. You may name your environment 'Park' if your simulation is simulating an agent in a park, allowing for good program readability.
Putting something in the environment is done by adding it as an attribute of the environment, or by being an attribute of something already in the environment.
A simulation starts when the environment is run using its run() command. When the environment is run events can occur and productions can fire.
# Run the environment using run()
env.run()
When a model is run, this includes the environment, the agent checks if it is converted and if it isn't it calls its convert function. So, upon running the environment there is some initial setup that occurs before the simulation really starts. A copy of the environment's scheduler is given to each agent in in the environment and all class methods for each agent in the environment are prepared to be turned into productions.
Executing a python script with an environment instance calling its run() in main command is an example of a way to start a simulation using Python ACT-R.
There is a parent child hierarchy used to organize all of the agents in Python ACT-R program. The top most parent, the “root”, is the environment. Any Model instance within another Model instance is a child of the Model instance it is in. For example, a tree in the environment would be a child of the environment and conversely the environment would be a parent of the environment. Children of an model can access or alter parameters of the agent by accessing their parents. Children of a model can be accessed through a Model's get_children() function.
An agent can alter its environment or check specific values of its contents by looking through its parent/child hierarchy.
The scheduler of a model is copied from the parents scheduler (singleton design) resulting in all agents using the same Scheduler instance.
As stated earlier, the Model class is the base class of agents in Python ACT-R. All types of agents must inherit from the Model class as it's base class.
There are main 3 types of agents:
- Model (Base model)
- Production System
- ACTR
Is the base agent class for everything running in the system. The environment is a Model instance
A Model with productions
- Handles the firing of it’s own productions
- Takes care of converting functions into productions
Is the
- Has a production system
- Contains cognitive features of ACTR resulting in an agent under the ACT-R cognitive theory
Models, Buffers, and Productions are all a main features but each one are used in different ways. Productions and Buffers are both classes pre programmed and to be used by the cognitive modeler. However, Modules are a bit different as they are not a class already pre-programmed but are specific way to use the Model class.
...Default parameter values of the function are treated. Default values and parameters are treated as slot:value pairs where the parameter name is slot and the defaults are the values.
This section will be a collection of examples on how core features are implemented in Python ACT-R.
The way you would program using Python ACT-R is different then you would typically program with Python, but still uses Python syntax and features.
For example, to write a production is to write a function but in a particular way with specific classes. This is because functions are disassembled in a particular way (essentially compiled) before they become productions automatically by specific classes. Knowing when, where, and why to use python in different ways than usual when programming a simulation with Python ACT-R will allow you to use it more effectively.
Ex:
import ccm
class Environment(ccm.Model):
# Adding objects in environment class as class attributes
bread = ccm.Model(isa='bread',location='on_counter')
cheese = ccm.Model(isa='cheese',location='on_counter')
class Agent(ccm.ACTR):
focus = ccm.buffer()
def __init__():
focus.set("example")
def example_production(focus="example"):
env = Environment()
env.agent = Agent()
env.run()
-
Models
- The Model class is mainly used when coding a basic agent without productions and/or modules because productions are not required for either.
- Modules can't be used with Production systems as their functions typically need to be executed for the agent to perform an action on demand.
- An agent has access to its self and can perform internal changes through function in its Module, which can't be done if the functions are turned into Productions.
-
ProductionSystem
- A ProductionSystem is used when
-
ACTR
Modules and Buffers are ways to move information around or
Note: This page is a work in progress. Content is missing and the page structure and content may change anytime.