Skip to content

Commit c6f4090

Browse files
committed
update readme
1 parent b720db2 commit c6f4090

File tree

2 files changed

+40
-11
lines changed

2 files changed

+40
-11
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs/src/assets/figures

README.md

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,61 @@ This repo reproduces almost all the figures on the book [Reinforcement Learning:
1616

1717
## Reproduce
1818

19-
Just run the following command to install this package:
19+
### Docker
20+
21+
I have built a docker image for a quick test.
2022

2123
```bash
22-
$ julia -e "using Pkg; Pkg.add(\"Plots\"); Pkg.add(PackageSpec(url=\"https://github.com/Ju-jl/Ju.jl.git\")); Pkg.add(PackageSpec(url=\"https://github.com/Ju-jl/ReinforcementLearningAnIntroduction.jl\"));"
24+
$ docker run -it --rm -v /path/to/save/figures:/figures tianjun2018/rlintro
2325
```
2426

25-
Then enter the REPL:
27+
By running the above command, you'll enter a julia REPL with everything properly installed.
2628

2729
```julia
28-
julia> using RLIntro # Hold on! It might take several minutes to pre-compile
30+
julia> using RLIntro
31+
32+
julia> plot_all("/figures") # save all figures into the mounted folder
33+
```
34+
35+
Usually it will take almost an hour to finish. Then you can view all the figures in the `/path/to/save/figures` folder you specified above.
2936

30-
julia> @show [f for f in names(RLIntro) if startswith(string(f), "fig")]; # list all the functions to reproduce corresponding figures
31-
[f for f = names(RLIntro) if startswith(string(f), "fig")] = Symbol[:fig_10_1, :fig_10_2, :fig_10_3, :fig_10_4, :fig_10_5, :fig_11_2, :fig_12_3, :fig_13_1, :fig_13_2, :fig_2_1, :fig_2_2, :fig_2_3, :fig_2_4, :fig_2_5, :fig_2_6, :fig_3_2, :fig_3_5, :fig_4_1, :fig_4_2, :fig_4_3, :fig_5_1, :fig_5_2, :fig_5_3, :fig_5_4, :fig_6_2_a, :fig_6_2_b, :fig_6_2_c, :fig_6_2_d, :fig_6_3_a, :fig_6_3_b, :fig_6_5, :fig_7_2, :fig_8_2, :fig_8_4, :fig_8_4_example, :fig_8_5, :fig_8_7, :fig_8_8, :fig_9_1, :fig_9_10, :fig_9_2_a, :fig_9_2_b, :fig_9_5]
37+
### Local Machine
38+
39+
Make sure you have installed Julia v1.1.0 or above (the reason is that we will use a customized registry here). Then enter the pkg mode of Julia REPL (run `julia` and then press `]`):
40+
41+
```julia
42+
(v1.1) pkg> registry add https://github.com/Ju-jl/Registry.git
43+
44+
(v1.1) pkg> add Plots
45+
46+
(v1.1) pkg> add RLIntro
47+
```
48+
49+
Then press `CTRL+C` and come back to REPL mode.
50+
51+
```julia
52+
julia> using RLIntro # Hold on! It might take several minutes to pre-compile!
3253

33-
julia> fig_2_2() # reproduce figure_2_2
54+
julia> plot_all("/path/to/save/figures")
3455
```
3556

3657
## Develop
3758

38-
If you would like to make some improvements, I'd suggest the following workflow:
59+
If you would like to make some improvements, I'd suggest the following workflow to avoid frequently pre-compile the whole package:
3960

4061
1. Clone this repo and enter the project folder.
41-
1. Enter the pkg mode and `(RLIntro) pkg> add https://github.com/Ju-jl/Ju.jl.git` (Because the `Ju.j` is not registered yet. It will not be a big problem after Julia 1.1 get released)
42-
1. Make changes to some existing *Environment* or create a new Environment and include it in the REPL (like `include("src/environments/MultiArmBandits.jl")`)
62+
1. Run `julia --project`
63+
1. Enter the pkg mode (press `]`)
64+
1. Add the customized registry `(RLIntro) pkg> registry add https://github.com/Ju-jl/Registry.git`
65+
1. Install dependencies `(RLIntro) pkg> instantiate`
66+
1. `(RLIntro) pkg> dev Ju`. (If you want to improve the dependent package `Ju.jl`)
67+
1. Run `CTRL-C` and come back to REPL.
68+
1. Make changes to some existing *Reinforcement Learning Environment* or create a new Reinforcement Learning Environment and include it in the REPL (like `include("src/environments/MultiArmBandits.jl")`)
4369
1. Make changes to the related source codes and include it in the REPL (like `include("src/chapter02/ten_armed_testbed.jl")`)
70+
1. Make changes to the `Ju.jl` package if necessary. Usually it is in the folder like `C:\Users\juti\.julia\dev\Ju` (You can get the path by running `(RLIntro) pkg> status` in the package mode).
4471
1. Run the functions to draw figures (`fig_2_2()`).
45-
1. Repeat the above three steps.
72+
1. Repeat the above four steps.
73+
1. And do not forget to make a PR.😋
4674

4775
# Contents
4876

0 commit comments

Comments
 (0)