def __init__(self, actions, mapname, contextD, context_rewards, **kwargs): """Initialize the environment variables. :param actions: actions available to the system :type actions: list of tuples (action_name,action_vector) :param mapname: filename for map file :param contextD: dimension of vector representing context :param context_rewards: mapping from region labels to rewards for being in that region (each entry represents one context) :type context_rewards: dict {"regionlabel":rewardval,...} :param **kwargs: see PlaceCellEnvironment.__init__ """ PlaceCellEnvironment.__init__(self, actions, mapname, name="ContextEnvironment", **kwargs) self.rewards = context_rewards # generate vectors representing each context self.contexts = {} # mapping from region label to context vector for i, r in enumerate(self.rewards): self.contexts[r] = list(MU.I(contextD)[i]) self.context = self.contexts[random.choice(self.contexts.keys())] # randomly pick a new context every context_delay seconds self.context_delay = 60 self.context_update = self.context_delay self.create_origin("placewcontext", lambda: self.place_activations + self.context) self.create_origin("context", lambda: self.context)
def __init__(self, *args, **kwargs): """Initialize environment variables. :param name: name for environment :param *args: see PlaceCellEnvironment.__init__ :param **kwargs: see PlaceCellEnvironment.__init__ """ PlaceCellEnvironment.__init__(self, name="DeliveryEnvironment", *args, **kwargs) # reward value when no reward condition is met self.defaultreward = -0.05 self.contexts = {"in_hand": [1, 0], "out_hand": [0, 1]} self.in_hand = False self.create_origin("placewcontext", lambda: (self.place_activations + self.contexts["in_hand"] if self.in_hand else self.place_activations + self.contexts["out_hand"])) self.create_origin("context", lambda: (self.contexts["in_hand"] if self.in_hand else self.contexts["out_hand"]))
def __init__(self, actions, mapname, contextD, context_rewards, **kwargs): """Initialize the environment variables. :param actions: actions available to the system :type actions: list of tuples (action_name,action_vector) :param mapname: filename for map file :param contextD: dimension of vector representing context :param context_rewards: mapping from region labels to rewards for being in that region (each entry represents one context) :type context_rewards: dict {"regionlabel":rewardval,...} :param **kwargs: see PlaceCellEnvironment.__init__ """ PlaceCellEnvironment.__init__(self, actions, mapname, name="ContextEnvironment", **kwargs) self.rewards = context_rewards # generate vectors representing each context self.contexts = {} # mapping from region label to context vector for i, r in enumerate(self.rewards): # self.contexts[r] = list(RandomHypersphereVG().genVectors(1, contextD)[0]) self.contexts[r] = list(MU.I(contextD)[i]) self.context = self.contexts[random.choice(self.contexts.keys())] # randomly pick a new context every context_delay seconds self.context_delay = 60 self.context_update = self.context_delay self.create_origin("placewcontext", lambda: self.place_activations + self.context) self.create_origin("context", lambda: self.context)
def __init__(self, *args, **kwargs): """Initialize environment variables. :param name: name for environment :param *args: see PlaceCellEnvironment.__init__ :param **kwargs: see PlaceCellEnvironment.__init__ """ PlaceCellEnvironment.__init__(self, name="DeliveryEnvironment", *args, **kwargs) # reward value when no reward condition is met self.defaultreward = -0.05 self.contexts = {"in_hand": [1, 0], "out_hand": [0, 1]} self.in_hand = False self.create_origin( "placewcontext", lambda: (self.place_activations + self.contexts["in_hand"] if self.in_hand else self.place_activations + self.contexts["out_hand"])) self.create_origin( "context", lambda: (self.contexts["in_hand"] if self.in_hand else self.contexts["out_hand"]))