mirror of
https://gitlab.rlp.net/mobitar/ReCo.jl.git
synced 2024-12-21 00:51:21 +00:00
Update README with new instructions
This commit is contained in:
parent
832128de95
commit
94c7bc717a
1 changed files with 32 additions and 17 deletions
49
README.adoc
49
README.adoc
|
@ -12,7 +12,7 @@ The following steps from the setup have to be followed every time before running
|
||||||
|
|
||||||
=== Launch Julia
|
=== Launch Julia
|
||||||
|
|
||||||
To activate the environment, navigate to the main directory `/ReCo.jl` and then run the following to launch Julia:
|
To activate the environment, navigate to the main directory `ReCo.jl` and then run the following to launch Julia:
|
||||||
|
|
||||||
[source,bash]
|
[source,bash]
|
||||||
----
|
----
|
||||||
|
@ -22,7 +22,7 @@ julia --threads auto
|
||||||
|
|
||||||
`auto` automatically sets the number of threads to use. If you want to use a specific number `N` of threads, replace `auto` with `N`.
|
`auto` automatically sets the number of threads to use. If you want to use a specific number `N` of threads, replace `auto` with `N`.
|
||||||
|
|
||||||
=== Activating environment
|
=== Activating environments
|
||||||
|
|
||||||
After launching Julia, the package environment has to be activated by running the following in the REPL:
|
After launching Julia, the package environment has to be activated by running the following in the REPL:
|
||||||
|
|
||||||
|
@ -32,6 +32,16 @@ using Pkg
|
||||||
Pkg.activate(".")
|
Pkg.activate(".")
|
||||||
----
|
----
|
||||||
|
|
||||||
|
`"."` stands for the current path which has to be the path of the package directory `ReCo.jl`.
|
||||||
|
|
||||||
|
If specified otherwise, an environment in a subdirectory has to be activated instead of the package environment. To activate an environment of a subdirectory `SUBDIRECTORY`, run the following:
|
||||||
|
|
||||||
|
[source,julia]
|
||||||
|
----
|
||||||
|
using Pkg
|
||||||
|
Pkg.activate("SUBDIRECTORY")
|
||||||
|
----
|
||||||
|
|
||||||
=== Install/update dependencies
|
=== Install/update dependencies
|
||||||
|
|
||||||
After activating the package environment, run the following to install/update the package dependencies:
|
After activating the package environment, run the following to install/update the package dependencies:
|
||||||
|
@ -77,6 +87,7 @@ run_sim(sim_dir, duration=20.0)
|
||||||
The values for the number of particles, self-propulsion velocity and simulation duration are used here as an example. For more information about possible values and other optional arguments, see the documentation of `init_sim` or `run_sim`.
|
The values for the number of particles, self-propulsion velocity and simulation duration are used here as an example. For more information about possible values and other optional arguments, see the documentation of `init_sim` or `run_sim`.
|
||||||
|
|
||||||
== Simulation visualization
|
== Simulation visualization
|
||||||
|
For visualization, the environment of the subdirectory `visualization` has to be activated.
|
||||||
|
|
||||||
=== Animation
|
=== Animation
|
||||||
|
|
||||||
|
@ -84,6 +95,7 @@ To generate an animation of a simulation, run the following:
|
||||||
|
|
||||||
[source,julia]
|
[source,julia]
|
||||||
----
|
----
|
||||||
|
using Animation
|
||||||
animate(sim_dir)
|
animate(sim_dir)
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -95,6 +107,7 @@ To plot only one snapshot of a simulation, run the following:
|
||||||
|
|
||||||
[source,julia]
|
[source,julia]
|
||||||
----
|
----
|
||||||
|
using SnapshotPlot
|
||||||
plot_snapshot(sim_dir)
|
plot_snapshot(sim_dir)
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -102,13 +115,14 @@ This will ask for the number of the snapshot to plot out of the total number of
|
||||||
|
|
||||||
== Run a reinforcement learning process
|
== Run a reinforcement learning process
|
||||||
|
|
||||||
Run a reinforcement learning process and return the environment helper and the the path of the process directory relative to the directory `ReCo.jl`:
|
Run a reinforcement learning process and return the environment helper and the the relative path of the process directory:
|
||||||
|
|
||||||
[source,julia]
|
[source,julia]
|
||||||
----
|
----
|
||||||
env_helper, rl_dir = run_rl(ENVTYPE)
|
env_helper, rl_dir = run_rl(ENVTYPE)
|
||||||
----
|
----
|
||||||
|
|
||||||
`ENVTYPE` has to be replaced by one of the environments named after the file names in the directory `ReCo.jl/RL/Envs`, for example: `LocalCOMEnv`. A short description of an environment is included at the beginning of the corresponding file.
|
`ENVTYPE` has to be replaced by one of the environments named after the file names in the directory `RL/Envs`, for example: `LocalCOMEnv`. A short description of an environment is included at the beginning of the corresponding file.
|
||||||
|
|
||||||
The documentation of `run_rl` includes all possible optional arguments.
|
The documentation of `run_rl` includes all possible optional arguments.
|
||||||
|
|
||||||
|
@ -121,11 +135,11 @@ The documentation of `run_rl` includes all possible optional arguments.
|
||||||
env_helper.shared.agent.policy.learner.approximator.table
|
env_helper.shared.agent.policy.learner.approximator.table
|
||||||
----
|
----
|
||||||
|
|
||||||
To generate a LaTeX table with the states and actions combintation names for the Q-matrix, run the following after activating the environment in `ReCo.jl/analysis`:
|
To generate a LaTeX table with the states and actions combintation names for the Q-matrix, activate the environment of the subdirectory `analysis` and run the following:
|
||||||
|
|
||||||
[source,julia]
|
[source,julia]
|
||||||
----
|
----
|
||||||
include("Q_matrix_latex_export.jl")
|
include("analysis/Q_matrix_latex_export.jl")
|
||||||
export_q_matrix(env_helper, FILENAME_WITHOUT_EXTENSION)
|
export_q_matrix(env_helper, FILENAME_WITHOUT_EXTENSION)
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -147,10 +161,11 @@ To access the rewards, run the following:
|
||||||
env_helper.shared.hook.rewards
|
env_helper.shared.hook.rewards
|
||||||
----
|
----
|
||||||
|
|
||||||
To plot the rewards, run the following:
|
To plot the rewards, activate the environment of the subdirectory `visualization` and run the following:
|
||||||
|
|
||||||
[source,julia]
|
[source,julia]
|
||||||
----
|
----
|
||||||
|
using RewardsPlot
|
||||||
plot_rewards(rl_dir)
|
plot_rewards(rl_dir)
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -158,11 +173,11 @@ The function's documentation explains where the output is placed.
|
||||||
|
|
||||||
=== Mean kappa
|
=== Mean kappa
|
||||||
|
|
||||||
To plot the mean of kappa as the ratio of the eigenvalues of the gyration tensor, run the following after activating the environment in `ReCo.jl/analysis`:
|
To plot the mean of kappa as the ratio of the eigenvalues of the gyration tensor, activate the environment of the subdirectory `analysis` and run the following:
|
||||||
|
|
||||||
[source,julia]
|
[source,julia]
|
||||||
----
|
----
|
||||||
include("mean_kappa.jl")
|
include("analysis/mean_kappa.jl")
|
||||||
plot_mean_κ(; rl_dir=rl_dir, n_last_episodes=N_LAST_EPISODES)
|
plot_mean_κ(; rl_dir=rl_dir, n_last_episodes=N_LAST_EPISODES)
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -170,39 +185,39 @@ plot_mean_κ(; rl_dir=rl_dir, n_last_episodes=N_LAST_EPISODES)
|
||||||
|
|
||||||
== Run analysis
|
== Run analysis
|
||||||
|
|
||||||
First, `cd` into and activate the environment in `ReCo.jl/analysis`.
|
First, activate the environment of the subdirectory `analysis`.
|
||||||
|
|
||||||
=== Mean squared displacement and random walk
|
=== Mean squared displacement and random walk
|
||||||
|
|
||||||
[source,julia]
|
[source,julia]
|
||||||
----
|
----
|
||||||
include("mean_squared_displacement.jl")
|
include("analysis/mean_squared_displacement.jl")
|
||||||
run_msd_analysis()
|
run_msd_analysis()
|
||||||
run_random_walk()
|
run_random_walk()
|
||||||
----
|
----
|
||||||
|
|
||||||
The output is `ReCo.jl/exports/graphics/mean_squared_displacement.pdf` and `ReCo.jl/exports/graphics/random_walk.pdf`.
|
The output is `exports/graphics/mean_squared_displacement.pdf` and `exports/graphics/random_walk.pdf`.
|
||||||
|
|
||||||
=== Radial distribution function
|
=== Radial distribution function
|
||||||
|
|
||||||
[source,julia]
|
[source,julia]
|
||||||
----
|
----
|
||||||
include("radial_distribution_function/radial_distribution_function.jl")
|
include("analysis/radial_distribution_function/radial_distribution_function.jl")
|
||||||
run_radial_distribution_analysis()
|
run_radial_distribution_analysis()
|
||||||
----
|
----
|
||||||
|
|
||||||
The output is `ReCo.jl/exports/graphics/radial_distribution.pdf` and `ReCo.jl/exports/graphics/radial_distribution_all_vs.pdf`.
|
The output is `exports/graphics/radial_distribution.pdf` and `exports/graphics/radial_distribution_all_vs.pdf`.
|
||||||
|
|
||||||
=== Reward discount analysis
|
=== Reward discount analysis
|
||||||
|
|
||||||
[source,julia]
|
[source,julia]
|
||||||
----
|
----
|
||||||
include("reward_discount_analysis.jl")
|
include("analysis/reward_discount_analysis.jl")
|
||||||
run_reward_discount_analysis()
|
run_reward_discount_analysis()
|
||||||
----
|
----
|
||||||
|
|
||||||
The output is `ReCo.jl/exports/graphics/reward_discount_analysis.pdf`.
|
The output is `exports/graphics/reward_discount_analysis.pdf`.
|
||||||
|
|
||||||
== Graphics
|
== Graphics
|
||||||
|
|
||||||
The directory `ReCo.jl/graphics` has some Julia files that generate graphics related to this package. The function in every file that has to be run to generate the corresponding graphics starts with `plot_` or `gen_`. The output is placed in `ReCo.jl/exports/graphics`.
|
The subdirectory `graphics` has some Julia files that generate graphics related to this package. The function in every file that has to be run to generate the corresponding graphics starts with `plot_` or `gen_`. The output is placed in `exports/graphics`. The subdirectory of a file has an environment that has to be activated first.
|
||||||
|
|
Loading…
Reference in a new issue