Package teamwork :: Package examples :: Package Thespian :: Module RedRidingHoodClasses_test
[hide private]
[frames] | no frames]

Source Code for Module teamwork.examples.Thespian.RedRidingHoodClasses_test

  1  from teamwork.agent.AgentClasses import * 
  2  from teamwork.dynamics.pwlDynamics import * 
  3  
 
  4  #from ChatDynamics import *
 
  5  from RedRidingHoodDynamics import * 
  6  
 
  7  classHierarchy['NormAgent'] = {
 
  8      'parent': [],
 
  9      'horizon':2,
 
 10      'depth':2,
 
 11      'state':{\
 
 12              'type':1.0,
 
 13              
 
 14              'alive':1.0,
 
 15              'sameLocation':1.0,
 
 16              'actAlive':1.0,
 
 17  
 
 18              'likeMove':-1,
 
 19              'likeTalk':-1,
 
 20              'specialRule':1.0,
 
 21               },
 
 22   
 
 23      'dynamics':[DynFun['basicDyn'],DynFun['RedDyn']],
 
 24  
 
 25      } 
 26  
 
 27  classHierarchy['red'] = {
 
 28      'parent': ['NormAgent'],
 
 29      'horizon':2,
 
 30      'depth':2,
 
 31      'state':{\
 
 32              'identity':1,
 
 33              'location':0.2,
 
 34  
 
 35               },
 
 36      'actions': {
 
 37                  'type':'XOR',
 
 38                  'key':'type',
 
 39                  'values':[\
 
 40                            {'type':'literal','value':'tell-about-granny'},
 
 41                            {'type':'literal','value':'inform-about-granny'},
 
 42                            {'type':'literal','value':'move2'},
 
 43                            {'type':'literal','value':'wait'},
 
 44                           ],
 
 45                  
 
 46                  'base': {'type':'XOR',
 
 47                           'key':'object',
 
 48                           'values':[{'type':'generic','value':'wolf'}],
 
 49                           },
 
 50                  },
 
 51                            
 
 52                  
 
 53   
 
 54     'goals':[\
 
 55               {'entity':['self'],'direction':'max','type':'state',
 
 56                'key':'alive','weight':5.},
 
 57               {'entity':['self'],'direction':'max','type':'state',
 
 58                'key':'actAlive','weight':1000.},
 
 59               {'entity':['self'],'direction':'max','type':'state',
 
 60                'key':'sameLocation','weight':1000.},
 
 61              {'entity':['self'],'direction':'max','type':'state',
 
 62                'key':'specialRule','weight':1000.},
 
 63              
 
 64              {'entity':['self'],'direction':'max','type':'state',
 
 65                'key':'likeMove','weight':.5},
 
 66              {'entity':['self'],'direction':'max','type':'state',
 
 67                'key':'likeTalk','weight':.5},
 
 68               ],
 
 69  
 
 70      } 
 71  
 
 72  
 
 73  classHierarchy['wolf'] = {
 
 74      'parent': ['NormAgent'],
 
 75      'horizon':2,
 
 76      'depth':2,
 
 77      'state':{\
 
 78              'location':0.4,
 
 79              'full':0.0,
 
 80              'identity':-1,
 
 81               },
 
 82        'actions': {'type':'XOR',
 
 83                  'key':'type',
 
 84                  'values':[{'type':'literal','value':'eat'},
 
 85                            {'type':'literal','value':'enquiry-about-granny'},
 
 86                            {'type':'literal','value':'wait'},
 
 87                          {'type':'literal','value':'move2'},
 
 88                          {'type':'literal','value':'changeIdentity'},
 
 89                            ],
 
 90                  'base': {'type':'XOR',
 
 91                          'key':'object',
 
 92                          'values':[{'type':'generic','value':'red'}],
 
 93                                    
 
 94                           },
 
 95                  },
 
 96  
 
 97   
 
 98      'goals':[
 
 99               {'entity':['self'],'direction':'max','type':'state',
 
100                'key':'full','weight':1.},
 
101               {'entity':['self'],'direction':'max','type':'state',
 
102                'key':'alive','weight':5.},
 
103                
 
104               {'entity':['self'],'direction':'max','type':'state',
 
105                'key':'actAlive','weight':1000.},
 
106               {'entity':['self'],'direction':'max','type':'state',
 
107                'key':'sameLocation','weight':1000.},
 
108               {'entity':['self'],'direction':'max','type':'state',
 
109                'key':'specialRule','weight':1000.},
 
110               
 
111  
 
112               {'entity':['self'],'direction':'max','type':'state',
 
113                'key':'likeMove','weight':.5},
 
114              {'entity':['self'],'direction':'max','type':'state',
 
115                'key':'likeTalk','weight':.5},
 
116              
 
117              {'entity':['red'],'direction':'min','type':'state',
 
118                'key':'alive','weight':.1},  
 
119               ],
 
120  
 
121      } 
122