File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
entity_gym/entity_gym/environment Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,6 @@ def act(
9595
9696 obs = env .act_filter (_actions , obs_space )
9797 if obs .done :
98- # TODO: something is wrong with the interface here
9998 new_obs = env .reset_filter (obs_space )
10099 new_obs .done = True
101100 new_obs .reward = obs .reward
Original file line number Diff line number Diff line change @@ -143,6 +143,10 @@ def mean(self) -> float:
143143
144144@dataclass
145145class VecObs :
146+ """
147+ A batch of observations from a vectorized environment.
148+ """
149+
146150 features : Dict [EntityType , RaggedBufferF32 ]
147151 # Optional mask to hide specific entities from the policy but not the value function
148152 visible : Dict [EntityType , RaggedBufferBool ]
@@ -200,6 +204,11 @@ def extend(self, b: "VecObs") -> None:
200204
201205
202206class VecEnv (ABC ):
207+ """
208+ Interface for vectorized environments. The main goal of VecEnv is to allow
209+ for maximally efficient environment implementations.
210+ """
211+
203212 @abstractmethod
204213 def env_cls (self ) -> Type [Environment ]:
205214 """
@@ -209,12 +218,19 @@ def env_cls(self) -> Type[Environment]:
209218
210219 @abstractmethod
211220 def reset (self , obs_config : ObsSpace ) -> VecObs :
221+ """
222+ Resets all environments and returns the initial observations.
223+ """
212224 raise NotImplementedError
213225
214226 @abstractmethod
215227 def act (
216228 self , actions : Mapping [ActionType , RaggedBufferI64 ], obs_filter : ObsSpace
217229 ) -> VecObs :
230+ """
231+ Performs the given actions on the underlying environments and returns the resulting observations.
232+ Any environment that reaches the end of its episode is reset and returns the initial observation of the next episode.
233+ """
218234 raise NotImplementedError
219235
220236 @abstractmethod
You can’t perform that action at this time.
0 commit comments