LLNL / Abmarl

Agent Based Modeling and Reinforcement Learning
Other
52 stars 15 forks source link

Clean SAR Wrapper #306

Open rusu24edward opened 1 year ago

rusu24edward commented 1 year 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.