Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HenriDeh committed Oct 11, 2023
1 parent 365201c commit cf89b5c
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/ReinforcementLearningCore/src/policies/random_policy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RandomPolicy(s = nothing; rng = Random.default_rng()) = RandomPolicy(s, rng)

RLBase.optimise!(::RandomPolicy, x::NamedTuple) = nothing

RLBase.plan!(p::RandomPolicy{S,RNG}, env::AbstractEnv) where {S,RNG<:AbstractRNG} = rand.(p.rng, p.action_space)
RLBase.plan!(p::RandomPolicy{S,RNG}, env::AbstractEnv) where {S,RNG<:AbstractRNG} = rand(p.rng, p.action_space)

function RLBase.plan!(p::RandomPolicy{Nothing,RNG}, env::AbstractEnv) where {RNG<:AbstractRNG}
legal_action_space_ = RLBase.legal_action_space(env)
Expand All @@ -33,7 +33,7 @@ end

function RLBase.plan!(p::RandomPolicy{Nothing,RNG}, env::E, player::Symbol) where {E<:AbstractEnv, RNG<:AbstractRNG}
legal_action_space_ = RLBase.legal_action_space(env, player)
return rand.(p.rng, legal_action_space_)
return rand(p.rng, legal_action_space_)
end

#####
Expand Down
2 changes: 1 addition & 1 deletion src/ReinforcementLearningCore/test/core/base.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ReinforcementLearningCore
#using ReinforcementLearningCore
using ReinforcementLearningBase
using TimerOutputs

Expand Down
2 changes: 1 addition & 1 deletion src/ReinforcementLearningCore/test/core/stop_conditions.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ReinforcementLearningCore: check_stop
import ReinforcementLearningCore.check_stop

@testset "StopAfterStep" begin
stop_condition = StopAfterStep(10)
Expand Down
3 changes: 1 addition & 2 deletions src/ReinforcementLearningCore/test/policies/agent.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using ReinforcementLearningBase, ReinforcementLearningEnvironments
using ReinforcementLearningCore: SRT
using ReinforcementLearningCore
import ReinforcementLearningCore.SRT

@testset "agent.jl" begin
@testset "Agent Tests" begin
Expand Down
1 change: 0 additions & 1 deletion src/ReinforcementLearningCore/test/policies/multi_agent.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Test
using ReinforcementLearningEnvironments
using ReinforcementLearningTrajectories
using ReinforcementLearningCore
using ReinforcementLearningBase
using DomainSets

Expand Down
2 changes: 1 addition & 1 deletion src/ReinforcementLearningCore/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ReinforcementLearningBase
using ReinforcementLearningCore
#using ReinforcementLearningCore
using ReinforcementLearningEnvironments
using ReinforcementLearningTrajectories

Expand Down
2 changes: 1 addition & 1 deletion src/ReinforcementLearningCore/test/utils/distributions.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Test, LinearAlgebra, Distributions, ReinforcementLearningCore, CUDA, Flux
using Test, LinearAlgebra, Distributions, CUDA, Flux

@testset "utils/distributions" begin
@testset "logdetLorU" begin
Expand Down
2 changes: 1 addition & 1 deletion src/ReinforcementLearningCore/test/utils/networks.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Test, Flux, CUDA, ChainRulesCore, LinearAlgebra, Distributions, ReinforcementLearningCore
using Test, Flux, CUDA, ChainRulesCore, LinearAlgebra, Distributions
using Flux: params, gradient, unsqueeze
@testset "Approximators" begin
#= These may need to be updated due to recent changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function RLCore.Experiment(
γ=0.99f0,
α=0.2f0,
start_steps=1000,
start_policy=RandomPolicy([-1.0 .. 1.0 for _ in 1:na]; rng=rng),
start_policy=RandomPolicy(-1.0 .. 1.0; rng=rng),
automatic_entropy_tuning=true,
lr_alpha=0.003f0,
action_dims=action_dims,
Expand Down

0 comments on commit cf89b5c

Please sign in to comment.