so some stuff is defenetly working ... and crafting too. soo lets merge
This commit is contained in:
@@ -3,25 +3,14 @@ from threading import Event, Lock, Thread
|
||||
from queue import Queue
|
||||
class BaseEconWrapper():
|
||||
"""Base class for connecting reciever wrapper to a multi threaded econ simulation and training session"""
|
||||
|
||||
base_notification=Event() #Notification for Base
|
||||
reset_notification=Event() #Notification for recievers
|
||||
|
||||
step_notifications=[] #Notification for recievers
|
||||
|
||||
action_edit_lock=Lock()
|
||||
actor_actions={}
|
||||
|
||||
stop_edit_lock=Lock()
|
||||
stop=False
|
||||
|
||||
vote_lock=Lock()
|
||||
n_voters=0
|
||||
n_votes_reset=0
|
||||
|
||||
|
||||
|
||||
# States of Env
|
||||
env_data_lock=Lock()
|
||||
|
||||
obs=None
|
||||
rew=None
|
||||
done=None
|
||||
@@ -30,6 +19,13 @@ class BaseEconWrapper():
|
||||
|
||||
def __init__(self, econ: base_env.BaseEnvironment):
|
||||
self.env=econ
|
||||
self.vote_lock=Lock()
|
||||
|
||||
self.base_notification=Event() #Notification for Base
|
||||
self.reset_notification=Event() #Notification for recievers
|
||||
self.action_edit_lock=Lock()
|
||||
self.stop_edit_lock=Lock()
|
||||
self.env_data_lock=Lock()
|
||||
|
||||
def register_vote(self):
|
||||
"""Register reciever on base. Returns ID of Voter to pass on during blocking"""
|
||||
@@ -169,9 +165,9 @@ class BaseEconWrapper():
|
||||
|
||||
def reciever_request_reset(self):
|
||||
"""Adds to vote count to reset. If limit is reached reset will occure"""
|
||||
self.vote_lock.acquire()
|
||||
#self.vote_lock.acquire()
|
||||
self.n_votes_reset+=1
|
||||
self.vote_lock.release()
|
||||
# self.vote_lock.release()
|
||||
self.base_notification.set() #Alert base for action changes
|
||||
|
||||
def reciever_block_reset(self):
|
||||
|
||||
@@ -22,7 +22,7 @@ class SB3EconConverter(VecEnv, gym.Env):
|
||||
obs0["flat"]
|
||||
self.step_request_send=False
|
||||
self.auto_reset=auto_reset
|
||||
self.observation_space=gym.spaces.Box(low=0,high=np.inf,shape=(len(obs0["flat"]),),dtype=np.float32)
|
||||
self.observation_space=gym.spaces.Box(low=0,high=10,shape=(len(obs0["flat"]),),dtype=np.float32)
|
||||
super().__init__(self.num_envs, self.observation_space, self.action_space)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user