LLNL / Abmarl

Agent Based Modeling and Reinforcement Learning
Other
61 stars 18 forks source link

Clean SAR Wrapper #306

Open rusu24edward opened 2 years ago

rusu24edward commented 2 years ago

SAR Wrapper can modify the (SAR) data, but it does not explicitly require that the spaces be modified too. It leaves that to the derived classes, which have to modify the space in order for the loop to work (because it checks point in agent.{action,observation}_space). In #304, the derived SAR Wrappers also modify the null_{action,observation}. This can be moved in the SAR Wrapper itself by making ravel, flatten a class function. Call it something like wrap and wrap_space. Then the SAR Wrapper can call these, and all the wrappings will happen automatically with the derived classes defining the implementation.

rusu24edward commented 1 year ago

It's not exactly the same between the ravel wrapper and the flatten wrapper because the ravel wrapper has some extra steps to check that the space is discretizable. Also, it's not that big of a deal yet. Maybe when there are more SAR wrappers and it becomes obvious that we would save a lot of code duplication. Marking this as probably not for now, will update later if needed.