-
Notifications
You must be signed in to change notification settings - Fork 1
Productions
This page contains documentation of how productions are created and used by the cognitive modeler, how they are implemented and executed in the Python ACT-R system, and source code documentation.
Adding productions to a model requires
class agent(ProductionSystem):
# Create a buffer
def example_production(buffer="string"):
# body of the productions
# no access to self
# can access buffer and contents
# can access and use modules
- must inherit from ProductionSystem or inherit from class which inherits from ProductionSystem, such as the ACTR class.
In the Python ACT-R system productions are represented by the Production class and are constructed from an agents functions. Productions are originally written as functions before they are turned into productions by a ProductionSystem.
Functions of an agent are disassembled and turned into productions.
Steps to a production: function > method / method generator wrapper > production
Before an agent can be run in a simulation it's class instance must be converted. This happens when... When an agent is converted (see here for more info on the convert function), among other things, the agent's functions are turned wrapped into methods. This occurs for the base Model class and is the first step to getting productions.
Second, method wrapped functions are converted into productions by a ProductionSystem.
Source code: ccm/production.py
The Production class is designed to be fired (execute code) when specific conditions are met. It contains functions for pattern matching the current context with a production, information about matching conditions, and an executable function.
Productions are constructed from methods. The code executed by a production is from the method, and the conditions required for the production to fire are determined by the methods's parameter defaults. Productions are meant to be fired by a ProductionSystem class instance (and thus any model which inherits from a ProductionSystem).
Args:
system (Model): The Model object that the production will be added to.
name (str): Name of the given function or method argument.
func (object): Should be a function or method object type.
Attributes:
base_utility (int):
A value used in calculation a productions priority?? Default is 0.
keys (list):
Parameter names (list of strings) of the func argument.
pattern_specs (dict):
The original pattern values. A dict of arguments defults stored
in func.
pattern (Pattern):
pattern required to be matvhed in order for production to be fired.
bound (?):
Used to... Defult is None.
original_func (object):
The original function or method.
code (string):
The source code from the function or method in a string format.
Manipulated to store only the method body as a string.
func (?):
compile(code,'<production-%s>'%self.name,'exec')
Methods:
match(self,obj):
fire(self,context):
Note: This page is a work in progress. Content is missing and the page structure and content may change anytime.