forked from rl-tools/example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (57 loc) · 3.21 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Set options for hyperparameters
option(HYPERPARAM_GAMMA "GAMMA for PPO" 0.99)
option(HYPERPARAM_LAMBDA "LAMBDA for PPO" 0.95)
option(HYPERPARAM_EPSILON_CLIP "EPSILON_CLIP for PPO" 0.2)
option(HYPERPARAM_INITIAL_ACTION_STD "INITIAL_ACTION_STD for PPO" 0.5)
option(HYPERPARAM_ACTION_ENTROPY_COEFFICIENT "ACTION_ENTROPY_COEFFICIENT for PPO" 0.01)
option(HYPERPARAM_POLICY_KL_EPSILON "POLICY_KL_EPSILON for PPO" 1e-5)
option(HYPERPARAM_N_WARMUP_STEPS_CRITIC "N_WARMUP_STEPS_CRITIC for PPO" 0)
option(HYPERPARAM_N_WARMUP_STEPS_ACTOR "N_WARMUP_STEPS_ACTOR for PPO" 0)
option(HYPERPARAM_ON_POLICY_RUNNER_STEPS_PER_ENV "ON_POLICY_RUNNER_STEPS_PER_ENV for PPO" 1024)
option(HYPERPARAM_BATCH_SIZE "BATCH_SIZE for PPO" 256)
option(HYPERPARAM_TOTAL_STEP_LIMIT "TOTAL_STEP_LIMIT for PPO" 300000)
option(HYPERPARAM_EPISODE_STEP_LIMIT "EPISODE_STEP_LIMIT for PPO" 200)
option(HYPERPARAM_ACTOR_HIDDEN_DIM "ACTOR_HIDDEN_DIM for PPO" 64)
option(HYPERPARAM_ACTOR_NUM_LAYERS "ACTOR_NUM_LAYERS for PPO" 3)
option(HYPERPARAM_ACTOR_ACTIVATION_FUNCTION "ACTOR_ACTIVATION_FUNCTION for PPO" 1)
option(HYPERPARAM_CRITIC_HIDDEN_DIM "CRITIC_HIDDEN_DIM for PPO" 64)
option(HYPERPARAM_CRITIC_NUM_LAYERS "CRITIC_NUM_LAYERS for PPO" 3)
option(HYPERPARAM_CRITIC_ACTIVATION_FUNCTION "CRITIC_ACTIVATION_FUNCTION for PPO" 1)
option(HYPERPARAM_N_EPOCHS "N_EPOCHS for PPO" 10)
set(RL_TOOLS_BACKEND_ENABLE_MKL ON) # if you have MKL installed (fastest on Intel)
set(RL_TOOLS_BACKEND_ENABLE_OPENBLAS ON) # if you have OpenBLAS installed
#set(RL_TOOLS_BACKEND_ENABLE_ACCELERATE ON) # if you are on macOS (fastest on Apple Silicon)
add_subdirectory(external/rl_tools)
add_executable(my_pendulum
src/main.cpp
)
#target_compile_definitions(my_pendulum PRIVATE BENCHMARK)
target_link_libraries(my_pendulum PRIVATE RLtools::RLtools)
# Pass definitions to the compiler
target_compile_definitions(my_pendulum PRIVATE
HYPERPARAM_GAMMA=${HYPERPARAM_GAMMA}
HYPERPARAM_LAMBDA=${HYPERPARAM_LAMBDA}
HYPERPARAM_EPSILON_CLIP=${HYPERPARAM_EPSILON_CLIP}
HYPERPARAM_INITIAL_ACTION_STD=${HYPERPARAM_INITIAL_ACTION_STD}
HYPERPARAM_ACTION_ENTROPY_COEFFICIENT=${HYPERPARAM_ACTION_ENTROPY_COEFFICIENT}
HYPERPARAM_POLICY_KL_EPSILON=${HYPERPARAM_POLICY_KL_EPSILON}
HYPERPARAM_N_WARMUP_STEPS_CRITIC=${HYPERPARAM_N_WARMUP_STEPS_CRITIC}
HYPERPARAM_N_WARMUP_STEPS_ACTOR=${HYPERPARAM_N_WARMUP_STEPS_ACTOR}
HYPERPARAM_ON_POLICY_RUNNER_STEPS_PER_ENV=${HYPERPARAM_ON_POLICY_RUNNER_STEPS_PER_ENV}
HYPERPARAM_BATCH_SIZE=${HYPERPARAM_BATCH_SIZE}
HYPERPARAM_TOTAL_STEP_LIMIT=${HYPERPARAM_TOTAL_STEP_LIMIT}
HYPERPARAM_EPISODE_STEP_LIMIT=${HYPERPARAM_EPISODE_STEP_LIMIT}
HYPERPARAM_ACTOR_HIDDEN_DIM=${HYPERPARAM_ACTOR_HIDDEN_DIM}
HYPERPARAM_ACTOR_NUM_LAYERS=${HYPERPARAM_ACTOR_NUM_LAYERS}
HYPERPARAM_ACTOR_ACTIVATION_FUNCTION=${HYPERPARAM_ACTOR_ACTIVATION_FUNCTION}
HYPERPARAM_CRITIC_HIDDEN_DIM=${HYPERPARAM_CRITIC_HIDDEN_DIM}
HYPERPARAM_CRITIC_NUM_LAYERS=${HYPERPARAM_CRITIC_NUM_LAYERS}
HYPERPARAM_CRITIC_ACTIVATION_FUNCTION=${HYPERPARAM_CRITIC_ACTIVATION_FUNCTION}
HYPERPARAM_N_EPOCHS=${HYPERPARAM_N_EPOCHS}
)
if(NOT MSVC)
target_compile_options(my_pendulum PRIVATE -Ofast)
if(NOT APPLE)
target_compile_options(my_pendulum PRIVATE -march=native)
endif()
endif()