|
bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
|
Classes | |
| class | ApproxMC |
| struct | ArduinoOFFCMD |
| struct | ArduinoONCMD |
| struct | DistanceHeuristic |
| struct | Edge |
| struct | fcost_comparison |
| class | Graph |
| struct | id_comparison |
| struct | Node |
| struct | Policy |
| class | searchable_priority_queue |
| struct | Transition |
Typedefs | |
| typedef gymfcpp::TimeStep< uint_t > | time_step_t |
| typedef std::pair< uint_t, uint_t > | state_type |
| typedef boost::python::api::object | obj_t |
Functions | |
| template<typename ItrTp , typename StateTp > | |
| ItrTp | is_state_included (ItrTp begin, ItrTp end, const StateTp &state) |
| template<typename BinType > | |
| std::pair< uint_t, uint_t > | get_aggregated_state (const std::pair< real_t, real_t > &obs, const BinType &pos_bins, const BinType &vel_bins) |
| template<typename IdTp > | |
| std::vector< IdTp > | reconstruct_a_star_path (const std::multimap< IdTp, IdTp > &map, const IdTp &start) |
| bool | operator== (const Node &n1, const Node &n2) |
| void | test_cart_pole (RESTRLEnvClient &server) |
| void | test_acrobot (RESTRLEnvClient &server) |
| void | test_pendulum (RESTRLEnvClient &server) |
| void | test_mountain_car (RESTRLEnvClient &server) |
Variables | |
| const real_t | GAMMA = 1.0 |
| const uint_t | N_EPISODES = 20000 |
| const uint_t | N_ITRS_PER_EPISODE = 2000 |
| const real_t | TOL = 1.0e-8 |
| auto | pos_bins = std::vector<real_t>({-1.2, -0.95714286, -0.71428571, -0.47142857, -0.22857143, 0.01428571, 0.25714286, 0.5}) |
| auto | vel_bins = std::vector<real_t>({-0.07, -0.05, -0.03, -0.01, 0.01, 0.03, 0.05, 0.07}) |
// Code for Arduino
#include <WiFiS3.h>
char ssid[] = "YOU-SSID"; char password[] = "YOUR-PASSWORD";
int status = WL_IDLE_STATUS; WiFiServer server(8005);
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(9600); delay(1000); if (Serial.available()) { Serial.println("Connecting to WiFi..."); }
while (status != WL_CONNECTED) { Serial.print("Connecting to "); Serial.println(ssid); status = WiFi.begin(ssid, password); delay(5000); }
Serial.println("\nWiFi connected."); Serial.print("IP address: "); Serial.println(WiFi.localIP());
server.begin(); Serial.println("HTTP server started");
}
void loop() {
WiFiClient client = server.available();
if (client) { client.flush(); Serial.println("Client connected."); String request = ""; while (client.connected()) { if (client.available()) { char c = client.read(); request += c; if (c == '
' && request.endsWith("\r\n\r\n")) { break; // End of HTTP headers } } }
String body = ""; while (client.available()) { body += (char)client.read(); }
if(body == "ON"){ digitalWrite(LED_BUILTIN, HIGH); String response = "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\nLED is ON\n"; client.print(response); } else if(body == "OFF"){ digitalWrite(LED_BUILTIN, LOW); String response = "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\nLED is OFF\n"; client.print(response);
}
delay(1); client.stop(); Serial.println("Client disconnected."); } }
A* search on a road network. This example requires that the OSMNX (https://osmnx.readthedocs.io/) library is installed as well as the NetworkX (https://networkx.github.io/documentation/stable/) library. The example is taken from the Autonomous Vehicle course on Coursera
| typedef boost::python::api::object example::obj_t |
| typedef std::pair<uint_t, uint_t> example::state_type |
| typedef gymfcpp::TimeStep<uint_t> example::time_step_t |
| std::pair< uint_t, uint_t > example::get_aggregated_state | ( | const std::pair< real_t, real_t > & | obs, |
| const BinType & | pos_bins, | ||
| const BinType & | vel_bins | ||
| ) |
| ItrTp example::is_state_included | ( | ItrTp | begin, |
| ItrTp | end, | ||
| const StateTp & | state | ||
| ) |
| std::vector< IdTp > example::reconstruct_a_star_path | ( | const std::multimap< IdTp, IdTp > & | map, |
| const IdTp & | start | ||
| ) |
| void example::test_acrobot | ( | RESTRLEnvClient & | server | ) |
| void example::test_cart_pole | ( | RESTRLEnvClient & | server | ) |
| void example::test_mountain_car | ( | RESTRLEnvClient & | server | ) |
| void example::test_pendulum | ( | RESTRLEnvClient & | server | ) |
| const real_t example::GAMMA = 1.0 |
| const uint_t example::N_EPISODES = 20000 |
| const uint_t example::N_ITRS_PER_EPISODE = 2000 |
| auto example::pos_bins = std::vector<real_t>({-1.2, -0.95714286, -0.71428571, -0.47142857, -0.22857143, 0.01428571, 0.25714286, 0.5}) |
| const real_t example::TOL = 1.0e-8 |
| auto example::vel_bins = std::vector<real_t>({-0.07, -0.05, -0.03, -0.01, 0.01, 0.03, 0.05, 0.07}) |