Skip to content

Commit a1c8788

Browse files
committed
Update doc/ index and Doxyfile.in
1 parent 4992ccf commit a1c8788

File tree

2 files changed

+44
-84
lines changed

2 files changed

+44
-84
lines changed

doc/Doxyfile.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ PROJECT_NAME = "@PROJECT_NAME@"
44
OUTPUT_DIRECTORY = @PROJECT_SOURCE_DIR@/docs
55
GENERATE_LATEX = NO
66
RECURSIVE = YES
7+
MARKDOWN_SUPPORT = YES
8+
AUTOLINK_SUPPORT = YES
9+
EXTRACT_ALL = YES
710

811
# Adjust to your source path(s)
912
INPUT = @PROJECT_SOURCE_DIR@/src/bitrl @PROJECT_SOURCE_DIR@/doc

doc/index.md

Lines changed: 41 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,70 @@
1-
# bitrl
2-
3-
```bitrl``` is an effort to provide implementations and wrappers of environments suitable for training reinforcement learning agents
1+
# bitrl-doc
2+
_bitrl_ is an effort to provide implementations and wrappers of environments suitable for training reinforcement learning agents
43
using C++.
54

6-
Furthermore, there is some minimal support for working with Arduino UNO boards over USB or WiFi.
7-
See also <a href="https://rlenvscpp.readthedocs.io/en/latest/working_with_webots.html">Working with Webots</a>
8-
for how to integrate ```bitrl``` with <a href="https://cyberbotics.com/doc/guide/installing-webots">Webots</a>.
9-
10-
Various RL algorithms using the environments can be found at <a href="https://github.com/pockerman/cuberl/tree/master">cuberl</a>.
11-
12-
The documentation for the library can be found <a href="https://rlenvscpp.readthedocs.io/en/latest/">here</a>.
135
The following is an example how to use the
14-
``FrozenLake`` environment from <a href="https://github.com/Farama-Foundation/Gymnasium/tree/main">Gymnasium</a>.
15-
16-
```
6+
_FrozenLake_ environment from <a href="https://github.com/Farama-Foundation/Gymnasium/tree/main">Gymnasium</a>.
177

8+
@code
189
#include "bitrl/bitrl_types.h"
1910
#include "bitrl/envs/gymnasium/toy_text/frozen_lake_env.h"
20-
#include "bitrl/envs/api_server/apiserver.h"
11+
#include "bitrl/network/rest_rl_env_client.h"
2112

2213
#include <iostream>
2314
#include <string>
2415
#include <unordered_map>
2516
#include <any>
2617

27-
namespace example_1{
28-
18+
namespace example_1 {
2919
const std::string SERVER_URL = "http://0.0.0.0:8001/api";
30-
3120
using bitrl::envs::gymnasium::FrozenLake;
32-
using bitrl::envs::gymnasium::Taxi;
33-
using bitrl::envs::gymnasium::BlackJack;
34-
using bitrl::envs::gymnasium::CliffWorld;
3521
using bitrl::envs::RESTApiServerWrapper;
3622

23+
void test_frozen_lake(const RESTApiServerWrapper& server) {
3724

38-
void test_frozen_lake(const RESTApiServerWrapper& server){
39-
40-
FrozenLake<4> env(server);
41-
42-
std::cout<<"Environame URL: "<<env.get_url()<<std::endl;
43-
44-
// make the environment
45-
std::unordered_map<std::string, std::any> options;
46-
options.insert({"is_slippery", false});
47-
env.make("v1", options);
48-
49-
std::cout<<"Is environment created? "<<env.is_created()<<std::endl;
50-
std::cout<<"Is environment alive? "<<env.is_alive()<<std::endl;
51-
std::cout<<"Number of valid actions? "<<env.n_actions()<<std::endl;
52-
std::cout<<"Number of states? "<<env.n_states()<<std::endl;
25+
FrozenLake<4> env(server);
26+
std::cout << "Environment URL: " << env.get_url() << std::endl;
27+
28+
std::unordered_map<std::string, std::any> make_ops;
29+
make_ops.insert({"is_slippery", false});
30+
31+
std::unordered_map<std::string, std::any> reset_ops;
32+
reset_ops.insert({"seed", static_cast<uint_t>(42)});
5333

54-
// reset the environment
55-
auto time_step = env.reset(42, std::unordered_map<std::string, std::any>());
56-
57-
std::cout<<"Reward on reset: "<<time_step.reward()<<std::endl;
58-
std::cout<<"Observation on reset: "<<time_step.observation()<<std::endl;
59-
std::cout<<"Is terminal state: "<<time_step.done()<<std::endl;
60-
61-
//...print the time_step
62-
std::cout<<time_step<<std::endl;
63-
64-
// take an action in the environment
65-
// 2 = RIGHT
66-
auto new_time_step = env.step(2);
67-
68-
std::cout<<new_time_step<<std::endl;
34+
env.make("v1", make_ops, reset_ops);
35+
}
36+
} // namespace example_1
6937

70-
// get the dynamics of the environment for the given state and action
71-
auto state = 0;
72-
auto action = 1;
73-
auto dynamics = env.p(state, action);
38+
int main() {
39+
RESTApiServerWrapper server(SERVER_URL, true);
40+
example_1::test_frozen_lake(server);
41+
return 0;
42+
}
43+
@endcode
7444

75-
std::cout<<"Dynamics for state="<<state<<" and action="<<action<<std::endl;
7645

77-
for(auto item:dynamics){
46+
Gymnasium environments exposed over a REST like API can be found at: <a href="https://github.com/pockerman/bitrl-rest-api">bitrl-rest-api</a>.
47+
Various RL algorithms using the environments can be found at <a href="https://github.com/pockerman/cuberl/tree/master">cuberl</a>.
7848

79-
std::cout<<std::get<0>(item)<<std::endl;
80-
std::cout<<std::get<1>(item)<<std::endl;
81-
std::cout<<std::get<2>(item)<<std::endl;
82-
std::cout<<std::get<3>(item)<<std::endl;
83-
}
84-
85-
action = env.sample_action();
86-
std::cout<<"Action sampled: "<<action<<std::endl;
87-
88-
new_time_step = env.step(action);
89-
std::cout<<new_time_step<<std::endl;
90-
91-
std::cout<<"env cidx: "<<env.cidx()<<std::endl;
49+
## Dependencies
9250

93-
// close the environment
94-
env.close();
95-
}
51+
_bitrl_ has a number of dependencies assumed to be installed under usual destination on a system:
9652

97-
}
53+
- Boost
54+
- Eigen3
55+
- Blas
56+
- OpenCV
57+
- PahoMqttCpp
9858

59+
## Installation
9960

100-
int main(){
61+
The usual _cmake_ installation/build can be used:
10162

102-
using namespace example_1;
103-
104-
RESTApiServerWrapper server(SERVER_URL, true);
63+
@code
64+
mkdir build && cd build
65+
cmake -DCMAKE_INSTALL_PREFIX=/path/where/bitrl/should/be/installed/to ..
66+
make install -j4
67+
@endcode
10568

106-
std::cout<<"Testing FrozenLake..."<<std::endl;
107-
example_1::test_frozen_lake(server);
108-
std::cout<<"===================="<<std::endl;
109-
110-
return 0;
111-
}
69+
## Examples
11270

113-
```

0 commit comments

Comments
 (0)