Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added pre-computation for BaseEnvironment.get_available_options.
Previously, every time BaseEnvironment.get_available_options was called, it would loop through every single option and test whether a given state was in its initiation set. This was unbelievably slow - it ended taking up the majority of the runtime - and scaled linearly in its horribleness with the number of available options. Now, whenever the option set is mutated using BaseEnvironment.set_options, a list of options available in each state is now pre-computed. Then, whenever BaseEnvironment.get_available_options is called, a shallow copy of the given state's list is returned. Much simpler and faster! In a gridworld with ~500 states and ~300 options, this reduced the time taken to run OptionsAgent for 75,000 time-steps from ~120secs to ~9secs. Crazy!
- Loading branch information