#include <iostream>
#include <unordered_map>
#include <vector>
{
const std::string
SERVER_URL =
"http://0.0.0.0:8001/api";
}
{
std::unordered_map<std::string, std::any> options;
options["enable_wind"] = std::any(static_cast<bool>(true));
options[
"turbulence_power"] = std::any(
static_cast<bitsim::real_t>(1.5));
std::unordered_map<std::string, std::any> reset_ops;
reset_ops.insert({
"seed",
static_cast<uint_t>(42)});
{
std::cout << "Working with LunarLanderDiscreteEnv..." << std::endl;
std::cout << "Is environment registered: "
env.make(
"v3", options, reset_ops);
std::cout <<
"Is environment created? " <<
env.is_created() << std::endl;
std::cout <<
"Is environment alive? " <<
env.is_alive() << std::endl;
std::cout <<
"Number of valid actions? " <<
env.n_actions() << std::endl;
auto time_step =
env.reset();
std::cout << "Time step: " << time_step << std::endl;
std::cout << "Time step: " << time_step << std::endl;
}
{
std::cout << "Working with LunarLanderContinuousEnv..." << std::endl;
env.make(
"v3", options, reset_ops);
std::cout <<
"Is environment created? " <<
env.is_created() << std::endl;
std::cout <<
"Is environment alive? " <<
env.is_alive() << std::endl;
std::cout <<
"Action space size " <<
env.n_actions() << std::endl;
std::cout <<
"Environment URI: " << server.get_uri(
env.env_name()) << std::endl;
auto time_step =
env.reset();
std::cout << "Time step: " << time_step << std::endl;
std::vector<real_t>
action = {0.8, 0.9};
time_step =
env.step(action);
std::cout << "Time step: " << time_step << std::endl;
}
return 0;
}
Definition lunar_lander_env.h:271
LunarLanderDiscreteEnv environment with discrete action space.
Definition lunar_lander_env.h:202
Utility class to facilitate HTTP requests between the environments REST API and C++ drivers.
Definition rest_rl_env_client.h:28
static const std::string name
name
Definition lunar_lander_env.h:207
int main()
Definition discounted_returns.cpp:19
Definition dc_motor_backend_base.h:9
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
double real_t
real_t
Definition bitsim_types.h:20
Definition gymnasium_part_3.cpp:11
const std::string SERVER_URL
Definition gymnasium_part_3.cpp:13
dict action
Definition play.py:46