1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/ReCo.jl.git synced 2024-09-17 18:51:17 +00:00

Remove LoopVectorizaion

This commit is contained in:
Mo8it 2022-04-05 03:12:25 +02:00
parent ac1826cc3a
commit 02fc3c058a
3 changed files with 1 additions and 59 deletions

View file

@ -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

View file

@ -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

View file

@ -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