diff --git a/src/RL/Hooks.jl b/src/RL/Hooks.jl index ee7166b..07bc8fe 100644 --- a/src/RL/Hooks.jl +++ b/src/RL/Hooks.jl @@ -74,7 +74,7 @@ end function copy_states_to_old_states_hook!(env_helper::EnvHelper) n_particles = env_helper.shared.n_particles - @turbo for particle_id in 1:n_particles + @simd for particle_id in 1:n_particles env_helper.shared.old_states_id[particle_id] = env_helper.shared.states_id[particle_id] end diff --git a/src/RL/RL.jl b/src/RL/RL.jl index e4fa8b0..d5bf4f2 100644 --- a/src/RL/RL.jl +++ b/src/RL/RL.jl @@ -15,7 +15,6 @@ using ReinforcementLearning using Flux: Flux using Intervals using StaticArrays: SVector -using LoopVectorization: @turbo using Random: Random using ProgressMeter: ProgressMeter using JLD2: JLD2 diff --git a/src/RL/latex_table.jl b/src/RL/latex_table.jl deleted file mode 100644 index e0ff49f..0000000 --- a/src/RL/latex_table.jl +++ /dev/null @@ -1,57 +0,0 @@ -using DataFrames: DataFrames -using PrettyTables: pretty_table - -using ReCo: ReCo - -function latex_table( - dataframe::DataFrames.DataFrame, filename::String; path::String="exports/$filename" -) - open(path, "w") do f - pretty_table(f, dataframe; backend=:latex, nosubheader=true, alignment=:c) - end - - return nothing -end - -""" - latex_rl_table(env_helper::ReCo.RL.EnvHelper, filename_without_extension::String) - -Generate a LaTeX table to the Q-matrix of `env_helper`. - -The output is `ReCo.jl/exports/filename_without_extension.tex`. `env_helper` has to be an environment helper with the abstract type `EnvHelper`. - -Return `nothing`. -""" -function latex_rl_table(env_helper::ReCo.RL.EnvHelper, filename_without_extension::String) - table = copy(env_helper.shared.agent.policy.learner.approximator.table) - - for col in 1:size(table)[2] - table[:, col] ./= sum(table[:, col]) - end - - table .= round.(table, digits=2) - - state_spaces_labels = env_helper.shared.env.shared.state_spaces_labels - states = AbstractString[] - for i in state_spaces_labels[1] - for j in state_spaces_labels[2] - push!(states, i * ";" * j) - end - end - - action_spaces_labels = env_helper.shared.env.shared.action_spaces_labels - actions = AbstractString[] - - for i in action_spaces_labels[1] - for j in action_spaces_labels[2] - push!(actions, i * ";" * j) - end - end - - df = DataFrames.DataFrame(table, states) - DataFrames.insertcols!(df, 1, :Actions => actions) - - latex_table(df, "$filename_without_extension.tex") - - return nothing -end