Skip to content

Commit

Permalink
add name attribute to Agent
Browse files Browse the repository at this point in the history
  • Loading branch information
kzheng-bdai committed Mar 29, 2024
1 parent 82b7f9e commit d51398c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions pomdp_py/framework/basics.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ cdef class Agent:
cdef GenerativeDistribution _cur_belief
cdef tuple _history
cdef dict __dict__
cdef str _name

cdef class Environment:
cdef State _init_state
Expand Down
18 changes: 15 additions & 3 deletions pomdp_py/framework/basics.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -327,25 +327,28 @@ cdef class Agent:
OR :class:`BlackboxModel` to the planner or the belief update algorithm.
__init__(self, init_belief,
policy_model,
policy_model=None,
transition_model=None,
observation_model=None,
reward_model=None,
blackbox_model=None)
blackbox_model=None,
name=None)
"""
def __init__(self, init_belief,
policy_model=None,
transition_model=None,
observation_model=None,
reward_model=None,
blackbox_model=None):
blackbox_model=None,
name=None):
self._init_belief = init_belief
self._policy_model = policy_model

self._transition_model = transition_model
self._observation_model = observation_model
self._reward_model = reward_model
self._blackbox_model = blackbox_model
self._name = name

# For online planning
self._cur_belief = init_belief
Expand Down Expand Up @@ -415,6 +418,15 @@ cdef class Agent:
def generative_model(self):
return self.blackbox_model

@property
def name(self):
return self._name

def set_name(self, str name):
"""set_name(self, str name)
gives this agent a name"""
self._name = name

def set_models(self, transition_model=None, observation_model=None,
reward_model=None, blackbox_model=None, policy_model=None):
"""Re-assign the models to be the ones given."""
Expand Down

0 comments on commit d51398c

Please sign in to comment.