-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates to fix issues associated with Flux 0.14
- Loading branch information
1 parent
bdaa6cb
commit 4e37bc9
Showing
6 changed files
with
72 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -6,4 +6,5 @@ log* | |
*.bson | ||
events.out.tfevents* | ||
.vscode | ||
Manifest.toml | ||
Manifest.toml | ||
.DS_Store |
This file contains 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 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 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 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using DeepQLearning | ||
using POMDPs | ||
using Flux | ||
using POMDPModels | ||
using POMDPTools | ||
|
||
@testset "README Example 1" begin | ||
# load MDP model from POMDPModels or define your own! | ||
mdp = SimpleGridWorld(); | ||
|
||
# Define the Q network (see Flux.jl documentation) | ||
# the gridworld state is represented by a 2 dimensional vector. | ||
model = Chain(Dense(2, 32), Dense(32, length(actions(mdp)))) | ||
|
||
exploration = EpsGreedyPolicy(mdp, LinearDecaySchedule(start=1.0, stop=0.01, steps=10000/2)); | ||
|
||
solver = DeepQLearningSolver(qnetwork = model, max_steps=10000, | ||
exploration_policy = exploration, | ||
learning_rate=0.005,log_freq=500, | ||
recurrence=false,double_q=true, dueling=true, prioritized_replay=true) | ||
policy = solve(solver, mdp) | ||
|
||
sim = RolloutSimulator(max_steps=30) | ||
r_tot = simulate(sim, mdp, policy) | ||
println("Total discounted reward for 1 simulation: $r_tot") | ||
end | ||
|
||
@testset "README Example 2" begin | ||
# Without using CuArrays | ||
mdp = SimpleGridWorld(); | ||
|
||
# the model weights will be send to the gpu in the call to solve | ||
model = Chain(Dense(2, 32), Dense(32, length(actions(mdp)))) | ||
|
||
exploration = EpsGreedyPolicy(mdp, LinearDecaySchedule(start=1.0, stop=0.01, steps=10000/2)); | ||
|
||
solver = DeepQLearningSolver(qnetwork=model, max_steps=10000, | ||
exploration_policy=exploration, | ||
learning_rate=0.005,log_freq=500, | ||
recurrence=false,double_q=true, dueling=true, prioritized_replay=true) | ||
policy = solve(solver, mdp) | ||
end |
This file contains 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