Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/gymfcpp/gymfcpp_config.h
src/gymfcpp/gymfcpp_version.h
1 change: 0 additions & 1 deletion src/gymfcpp/cart_pole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ CartPole::make(){

std::string cpp_str = "import gym \n";
cpp_str += "import numpy as np \n";
cpp_str += "import torch \n";
cpp_str += CartPole::py_env_name + " = gym.make('" + CartPole::name +"-" + data_.v + "').unwrapped\n";

// create an environment
Expand Down
26 changes: 12 additions & 14 deletions src/gymfcpp/cart_pole.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ class CartPole: private boost::noncopyable
public:

///
/// \brief action_t
/// \brief action_t. The type of the action
///
typedef uint_t action_t;

///
/// \brief state_t
/// \brief state_t. The type of the state
///
typedef std::vector<real_t> state_t;

///
/// \brief time_step_t
/// \brief time_step_t. The type of the time step
///
typedef TimeStep<state_t> time_step_t;

Expand All @@ -46,12 +46,12 @@ class CartPole: private boost::noncopyable
static std::string name;

///
/// \brief py_env_name
/// \brief py_env_name. The name of the environment in Python REPL
///
static std::string py_env_name;

///
/// \brief py_step_result_name
/// \brief py_step_result_name. The name of the result when stepping in the Python REPL
///
static std::string py_step_result_name;

Expand All @@ -61,7 +61,7 @@ class CartPole: private boost::noncopyable
static std::string py_reset_result_name;

///
/// \brief The class Screen
/// \brief The class Screen. Wrapper to the screen captured when calling render
///
class Screen;

Expand All @@ -71,14 +71,12 @@ class CartPole: private boost::noncopyable
CartPole(const std::string& version, obj_t gym_namespace, bool do_create=true);

///
/// \brief make
/// \param is_slipery
/// \brief make. Build the environment
///
void make();

///
/// \brief n_actions
/// \return
/// \brief n_actions. Returns the number of actions
///
uint_t n_actions()const;

Expand Down Expand Up @@ -149,22 +147,22 @@ class CartPole::Screen
Screen(obj_t screen, std::array<uint_t, 3>&& shp);

///
/// \breif shape
/// \brief shape. The shape of screen.
///
std::array<uint_t, 3> shape()const noexcept{return shape_;};

///
/// \brief
/// \brief get_as_vector. Returns the screen as floats
///
const std::vector<std::vector<std::vector<real_t>>>& get_as_vector()const;

///
///
/// \brief is_valid. Returns true if the computed screen is valid
///
bool is_valid()const noexcept{return is_valid_screen_;}

///
///
/// \brief invalidate. Invalidate the screen.
///
void invalidate() noexcept;

Expand Down
8 changes: 4 additions & 4 deletions src/gymfcpp/time_step.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class TimeStep
TimeStep();

///
///
/// \brief TimeStep. Constructor
///
TimeStep(TimeStepTp type, real_t reward, state_t obs);

///
///
/// \brief TimeStep. Constructor
///
TimeStep(TimeStepTp type, real_t reward, state_t obs, std::unordered_map<std::string, std::any>&& extra);

///
/// \brief first
/// \return
Expand Down Expand Up @@ -70,7 +70,7 @@ class TimeStep
/// \brief observation
/// \return
///
uint_t observation()const{return obs_;}
state_t observation()const{return obs_;}

///
/// \brief reward
Expand Down