Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit f608803

Browse files
Removed repetitive imports from algorithms. (#130)
* moved imports * removed repeated imports * move using into RLZoo.jl * remove other duplications Co-authored-by: Jun Tian <tianjun.cpp@gmail.com>
1 parent 08b9418 commit f608803

20 files changed

Lines changed: 15 additions & 76 deletions

src/ReinforcementLearningZoo.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,28 @@ module ReinforcementLearningZoo
33
const RLZoo = ReinforcementLearningZoo
44
export RLZoo
55

6+
using CircularArrayBuffers
67
using ReinforcementLearningBase
78
using ReinforcementLearningCore
89
using Setfield: @set
910
using StableRNGs
1011
using Logging
1112
using Flux.Losses
1213
using Dates
14+
using Random
15+
using Random: shuffle
16+
using CUDA
17+
using Zygote
18+
using Zygote: ignore
19+
using Flux
20+
using Flux: onehot, normalise
21+
using StatsBase
22+
using StatsBase: sample, Weights, mean
23+
using LinearAlgebra: dot
24+
using MacroTools
25+
using Distributions: Categorical, Normal, logpdf
26+
using StructArrays
27+
1328

1429
include("patch.jl")
1530
include("algorithms/algorithms.jl")

src/algorithms/algorithms.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Zygote: ignore
2-
31
include("dqns/dqns.jl")
42
include("policy_gradient/policy_gradient.jl")
53
include("searching/searching.jl")

src/algorithms/cfr/best_response_policy.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export BestResponsePolicy
22

3-
using Flux: onehot
4-
53
struct BestResponsePolicy{E,S,A,X,P<:AbstractPolicy} <: AbstractCFRPolicy
64
cfr_reach_prob::Dict{S,Vector{Pair{E,Float64}}}
75
best_response_action_cache::Dict{S,A}

src/algorithms/cfr/deep_cfr.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export DeepCFR
22

3-
using Statistics: mean
4-
using StatsBase
53

64
"""
75
DeepCFR(;kwargs...)

src/algorithms/cfr/external_sampling_mccfr.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
export ExternalSamplingMCCFRPolicy
22

3-
using Random
4-
using StatsBase: sample, Weights
5-
63
"""
74
ExternalSamplingMCCFRPolicy
85

src/algorithms/cfr/outcome_sampling_mccfr.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
export OutcomeSamplingMCCFRPolicy
22

3-
using Random
4-
using StatsBase: sample, Weights
5-
63
"""
74
OutcomeSamplingMCCFRPolicy
85

src/algorithms/dqns/basic_dqn.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
export BasicDQNLearner
22

3-
using Random
4-
using Flux
5-
63
"""
74
BasicDQNLearner(;kwargs...)
85

src/algorithms/dqns/dqn.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
export DQNLearner
22

3-
using Random
4-
using Flux
5-
63
mutable struct DQNLearner{
74
Tq<:AbstractApproximator,
85
Tt<:AbstractApproximator,

src/algorithms/dqns/iqn.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
export IQNLearner, ImplicitQuantileNet
22

3-
using Flux
4-
using CUDA
5-
using Random
6-
using Zygote
7-
using Statistics: mean
8-
using LinearAlgebra: dot
9-
103
"""
114
ImplicitQuantileNet(;ψ, ϕ, header)
125

src/algorithms/dqns/prioritized_dqn.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
export PrioritizedDQNLearner
22

3-
using Random
4-
using Flux
5-
using Zygote
6-
using StatsBase: mean
7-
using LinearAlgebra: dot
8-
93
"""
104
PrioritizedDQNLearner(;kwargs...)
115

0 commit comments

Comments
 (0)