This repository was archived by the owner on May 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Update RLBase to v0.8 #76
Merged
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6a67bd7
sync
findmyway 2e86fa3
support next version of RLBase
findmyway 51129a1
fix traits in OpenSpiel
findmyway 5f9e163
change seed to rng
findmyway e717e09
use one seed only to simplify api
findmyway ccd5828
set default log level in Atari env to :error
findmyway bcd0944
upgrade POMDP to v0.9
findmyway 506424d
rename TupleSpace to VectSpace
findmyway c5f9cfe
update README
findmyway f432634
rename render to display
findmyway 352b60a
fix test cases
findmyway File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ Base.show(io::IO, env::CartPoleEnv{T}) where {T} = | |
- `forcemag = T(10.0)` | ||
- `max_steps = 200` | ||
- 'dt = 0.02' | ||
- `seed = nothing` | ||
- `rng = Random.GLOBAL_RNG` | ||
""" | ||
function CartPoleEnv(; | ||
T = Float64, | ||
|
@@ -56,7 +56,7 @@ function CartPoleEnv(; | |
forcemag = 10.0, | ||
max_steps = 200, | ||
dt = 0.02, | ||
seed = nothing, | ||
rng = Random.GLOBAL_RNG, | ||
) | ||
params = CartPoleEnvParams{T}( | ||
gravity, | ||
|
@@ -80,7 +80,7 @@ function CartPoleEnv(; | |
2, | ||
false, | ||
0, | ||
MersenneTwister(seed), | ||
rng, | ||
) | ||
reset!(cp) | ||
cp | ||
|
@@ -96,8 +96,10 @@ function RLBase.reset!(env::CartPoleEnv{T}) where {T<:Number} | |
nothing | ||
end | ||
|
||
RLBase.observe(env::CartPoleEnv{T}) where {T} = | ||
(reward = env.done ? zero(T) : one(T), terminal = env.done, state = env.state) | ||
RLBase.get_actions(env::CartPoleEnv) = env.action_space | ||
RLBase.get_reward(env::CartPoleEnv{T}) where {T} = env.done ? zero(T) : one(T) | ||
RLBase.get_terminal(env::CartPoleEnv) = env.done | ||
RLBase.get_state(env::CartPoleEnv) = env.state | ||
|
||
function (env::CartPoleEnv)(a) | ||
@assert a in (1, 2) | ||
|
@@ -136,7 +138,7 @@ function plotendofepisode(x, y, d) | |
end | ||
return nothing | ||
end | ||
function RLBase.render(env::CartPoleEnv) | ||
function render(env::CartPoleEnv) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better to implement Base.display |
||
s, a, d = env.state, env.action, env.done | ||
x, xdot, theta, thetadot = s | ||
l = 2 * env.params.halflength | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.