From 973dddf1fb1c272cd41ac163384453f4130240cf Mon Sep 17 00:00:00 2001 From: Cahmat <115365682+Cahmat@users.noreply.github.com> Date: Wed, 11 Jan 2023 01:46:26 +0000 Subject: [PATCH 1/2] c1 --- as.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 as.py diff --git a/as.py b/as.py new file mode 100644 index 0000000..cf28cbb --- /dev/null +++ b/as.py @@ -0,0 +1,61 @@ +#################### ham cheese production model ################### + +# this is the simplest type of act-r model +# it uses only the production system and one buffer +# the buffer represents the focus of thought +# we call it the focus buffer but it is often called the goal buffer +# productions fire if they match the focus buffer +# each production changes the contents of focus buffer so a different production will fire on the next cycle + +##import sys +##sys.path.append('/Users/robertwest/ccmsuite') +## +##import ccm + +## log=ccm.log() + +from python_actr import * + +##### +# Python ACT-R requires an environment +# but in this case we will not be using anything in the environment +# so we 'pass' on putting things in there + +class MyEnvironment(Model): + pass + +##### +# create an act-r agent + +class MyAgent(ACTR): + + focus=Buffer() + focus.set('sandwich bread') + + def bread_bottom(focus='sandwich bread'): # if focus buffer has this chunk then.... + print("I have a piece of bread") # print + #focus.set('sandwich cheese') # change chunk in focus buffer + +## def cheese(focus='sandwich cheese'): # the rest of the productions are the same +## print "I have put cheese on the bread" # but carry out different actions +## focus.set('sandwich ham') +## +## def ham(focus='sandwich ham'): +## print "I have put ham on the cheese" +## focus.set('sandwich bread_top') +## +## def bread_top(focus='sandwich bread_top'): +## print "I have put bread on the ham" +## print "I have made a ham and cheese sandwich" +## focus.set('stop') +## +## def stop_production(focus='stop'): +## self.stop() # stop the agent + +tim=MyAgent() # name the agent +subway=MyEnvironment() # name the environment +subway.agent=tim # put the agent in the environment +##ccm.log_everything(subway) # print out what happens in the environment + +subway.run() # run the environment +##ccm.finished() # stop the environment \ No newline at end of file From 53eee8e7998377b8023aa604958dea8870393199 Mon Sep 17 00:00:00 2001 From: Cahmat <115365682+Cahmat@users.noreply.github.com> Date: Tue, 10 Jan 2023 20:49:26 -0500 Subject: [PATCH 2/2] Update and rename as.py to example1.py --- as.py | 61 ----------------------------------------------------- example1.py | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 61 deletions(-) delete mode 100644 as.py create mode 100644 example1.py diff --git a/as.py b/as.py deleted file mode 100644 index cf28cbb..0000000 --- a/as.py +++ /dev/null @@ -1,61 +0,0 @@ -#################### ham cheese production model ################### - -# this is the simplest type of act-r model -# it uses only the production system and one buffer -# the buffer represents the focus of thought -# we call it the focus buffer but it is often called the goal buffer -# productions fire if they match the focus buffer -# each production changes the contents of focus buffer so a different production will fire on the next cycle - -##import sys -##sys.path.append('/Users/robertwest/ccmsuite') -## -##import ccm - -## log=ccm.log() - -from python_actr import * - -##### -# Python ACT-R requires an environment -# but in this case we will not be using anything in the environment -# so we 'pass' on putting things in there - -class MyEnvironment(Model): - pass - -##### -# create an act-r agent - -class MyAgent(ACTR): - - focus=Buffer() - focus.set('sandwich bread') - - def bread_bottom(focus='sandwich bread'): # if focus buffer has this chunk then.... - print("I have a piece of bread") # print - #focus.set('sandwich cheese') # change chunk in focus buffer - -## def cheese(focus='sandwich cheese'): # the rest of the productions are the same -## print "I have put cheese on the bread" # but carry out different actions -## focus.set('sandwich ham') -## -## def ham(focus='sandwich ham'): -## print "I have put ham on the cheese" -## focus.set('sandwich bread_top') -## -## def bread_top(focus='sandwich bread_top'): -## print "I have put bread on the ham" -## print "I have made a ham and cheese sandwich" -## focus.set('stop') -## -## def stop_production(focus='stop'): -## self.stop() # stop the agent - -tim=MyAgent() # name the agent -subway=MyEnvironment() # name the environment -subway.agent=tim # put the agent in the environment -##ccm.log_everything(subway) # print out what happens in the environment - -subway.run() # run the environment -##ccm.finished() # stop the environment \ No newline at end of file diff --git a/example1.py b/example1.py new file mode 100644 index 0000000..43b5f53 --- /dev/null +++ b/example1.py @@ -0,0 +1,22 @@ +class MyEnv(Model): + pass +class MyAgent(ACTR): + #production_time = 0.05 + #production_sd = 0.01 + #production_threshold = -20 + + goal = Buffer() # Creating the goal buffer for the agent + + def init(): # this rule fires when the agent is instantiated. + goal.set("helloworld") # set goal buffer to direct program flow + def bread_bottom(goal="helloworld"): # if goal="sandwich bread" , fire rule + print ("Hello World!") + goal.set("stop") # set goal buffer to direct program flow + #def stop_production(goal="stop"): + #self.stop() # stop the agent + +tim = MyAgent() +subway=MyEnv() +subway.agent=tim +log_everything(subway) +subway.run()