JuliaReinforcementLearning / GridWorlds.jl

Help! I'm lost in the flatland!
MIT License
46 stars 9 forks source link

Refactor EmptyGridWorld #93

Closed Sid-Bhatia-0 closed 3 years ago

Sid-Bhatia-0 commented 3 years ago
  1. Rename EmptyGridWorld to EmptyRoom
  2. Randomize the goal position, agent starting position, and agent starting direction upon each reset! of EmptyRoom. Remove keyword arguments (agent_start_pos, agent_start_dir, goal_pos) because they can't be fed values into during the general run method in RLCore. The goal of the environment is to make the agent learn to seek the goal, rather than learn to follow a fixed path that will always lead to the goal. Thus a random start is much more effective here than a deterministic start.
  3. Cache goal_pos as a field inside the EmptyRoom struct. Refactor the reset! method, moving one-time environment construction activities inside the env constructor instead of the reset! method. This makes the reset! method more efficient. Also, add getter and setter methods for goal_pos.
  4. Add rand methods that help conditionally sample a random tile position from the world. This is often very useful.
  5. Rename add_room! method to place_room!
codecov-io commented 3 years ago

Codecov Report

Merging #93 (fa41fe8) into master (d20848e) will increase coverage by 1.92%. The diff coverage is 97.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #93      +/-   ##
==========================================
+ Coverage   78.07%   80.00%   +1.92%     
==========================================
  Files          16       16              
  Lines         684      695      +11     
==========================================
+ Hits          534      556      +22     
+ Misses        150      139      -11     
Impacted Files Coverage Δ
src/grid_world_base.jl 88.46% <83.33%> (+22.46%) :arrow_up:
src/abstract_grid_world.jl 63.76% <100.00%> (+1.08%) :arrow_up:
src/envs/emptyroom.jl 100.00% <100.00%> (ø)
src/envs/gridrooms.jl 100.00% <100.00%> (ø)
src/envs/sequentialrooms.jl 99.09% <100.00%> (ø)
src/envs/utils.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d20848e...fa41fe8. Read the comment docs.