Ejemplo n.º 1
0
    def __init__(
        self,
        name="",
        host=None,
        serializer=None,
        transport=None,
        attributes=None,
        backend=Backend.OSBRAIN,
        mesa_model=None,
    ):
        self.backend = self.validate_backend(backend)

        if self.backend == Backend.OSBRAIN:
            self._remove_methods(MesaAgent)
            osBrainAgent.__init__(
                self,
                name=name,
                host=host,
                serializer=serializer,
                transport=transport,
                attributes=attributes,
            )

        elif self.backend == Backend.MESA:
            MesaAgent.__init__(self, name, mesa_model)
            self._remove_methods(osBrainAgent)
            self.init_mesa(name)
            self.unique_id = name
            self.name = name
            self.mesa_model = mesa_model
Ejemplo n.º 2
0
 def __init__(self, pos, model, init_state=DEAD):
     '''
     Create a cell, in the given state, at the given x, y position.
     '''
     Agent.__init__(self, pos, model)
     self.x, self.y = pos
     self.state = init_state
     self._nextState = None
Ejemplo n.º 3
0
    def __init__(self, unique_id, model, fsm_size, num_tokens):
        Agent.__init__(self, unique_id, model)
        self.state = 0
        self.unique_id = unique_id
        self.scores = []
        self.decision = NO_ACTION

        self.gen_automata(fsm_size, num_tokens)
Ejemplo n.º 4
0
 def __init__(self, pos, model, initial_state):
     '''
     Create a cell, in the given state, at the given row, col position.
     '''
     Agent.__init__(self, pos, model)
     self._row = pos[1]
     self._col = pos[0]
     self._state = initial_state
     self._next_state = None
Ejemplo n.º 5
0
 def __init__(self, pos, model, init_state):
     '''
     Create a cell, in the given state, at the given x, y position.
     '''
     Agent.__init__(self, pos, model)
     self._x = pos[0]
     self._y = pos[1]
     self._state = init_state
     self._nextState = None
Ejemplo n.º 6
0
 def __init__(self, pos, model, initial_state):
     '''
     Create a cell, in the given state, at the given row, col position.
     '''
     Agent.__init__(self, pos, model)
     self._row = pos[1]
     self._col = pos[0]
     self._state = initial_state
     self._next_state = None
Ejemplo n.º 7
0
 def __init__(self, intersection, model):
     unique_id = uuid4()
     Agent.__init__(self, unique_id, model)
     Intersection.__init__(
         self,
         intersection.name,
         intersection.geometry,
         intersection.input_links,
         intersection.output_links,
     )
Ejemplo n.º 8
0
 def __init__(self, unique_id, model, homeLoc, workLoc):
     Agent.__init__(self, unique_id, model)
     self.age = random.randint(18, 87)
     degredation_age = 37
     max_age = 100
     # self.ability = random.random()**4 * (((min(abs((max_age+degredation_age)-self.age)),max_age))/max_age)		#based on formula A_b on pg. 354
     self.ability = 1
     self.attitude = random.random()**3  # based on A_t on pg. 354
     self.home = homeLoc
     self.work = workLoc
Ejemplo n.º 9
0
    def __init__(self, id, model, params):
        Agent.__init__(self, id, model)

        student_params= {
            'join_chat_prob': 0.15,
            'join_board_prob': 0.15,
            'post_prob': 0.3,
            'reduced_post_prob': 0.1,
            'chat_social_prob': 0.5,
            'post_social_prob': 0.1,
            'discount': 0.95
        }

        student_params.update(params)

        self.in_chat = False
        self.in_board = False
        self.engaged = False

        self.chats_read = 0
        self.chats_social_read = 0
        self.overload_chats_read = 0
        self.overload_chats_social_read = 0
        self.contrib_chat = 0
        self.contrib_social_chat = 0

        self.at_post = 0
        self.at_social_post = 0
        self.posts_read = 0
        self.posts_social_read = 0
        self.overload_posts_read = 0
        self.overload_posts_social_read = 0
        self.contrib_post = 0
        self.contrib_social_post = 0

        self.join_chat_prob = student_params['join_chat_prob']
        self.join_board_prob = student_params['join_board_prob']
        self.post_prob = student_params['post_prob']
        self.reduced_post_prob = student_params['reduced_post_prob']

        self.chat_social_prob = student_params['chat_social_prob']
        self.post_social_prob = student_params['post_social_prob']
        self.discount = student_params['discount']

        self.post_overload_lim = 50
        self.chat_overload_lim = 50
        self.post_overloaded = False
        self.chat_overloaded = False
Ejemplo n.º 10
0
 def __init__(self, unique_id, model, belief, age=18):
     Agent.__init__(self, unique_id, model)
     self.unique_id = unique_id
     self.belief = belief
     self.age = age
     self.pro_friend = 0
     self.anti_friend = 0
     self.none = 0
     self.num_rounds = 0
     if self.age <= 19:
         self.prob_ref = 0
     elif self.age <= 24:
         self.prob_ref = 1
     elif self.age <= 29:
         self.prob_ref = 2
     else:
         self.prob_ref = 3
Ejemplo n.º 11
0
 def __init__(self, id, model=None):
   Agent.__init__( self, id, model)
   #_configure_logging()
   self.l = logging.getLogger(self.__class__.__name__)        
   self._xd = XMLObject('Agent')
   self._meta = self._xd.add("metadata")
   self._meta.el.set("id", str(id))
   self._events = self._xd.add("events")
   self._envdata = self._xd.add("environments")
   self._body = self._xd.add("body")
   self._behaviours = []
   self._sensors = [Sensor()]
   self._next_reward = 0.0
   self._last_reward = 0.0
   self.avStates = []
   self.avActions = []
   self.exists = False
   self._brain = BaseBrain(self)
   self.pos = (0,0)
Ejemplo n.º 12
0
 def __init__(self, unique_id, model, intitial_state):
     Agent.__init__(self, unique_id, model)
     self.belief = intitial_state
Ejemplo n.º 13
0
 def __init__(self, pos, model, energy):
     Agent.__init__(self, pos, model)
     EnergyConsumingEntity.__init__(self, energy)
Ejemplo n.º 14
0
 def __init__(self, unique_id, model):
     Agent.__init__(self, unique_id, model)
     self.wealth = 1
Ejemplo n.º 15
0
 def __init__(self, pos, model, age=0):
     Agent.__init__(self, pos, model)
     AgingEntity.__init__(self, age)