bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
learning_rate_scheduler.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 <copyright holder> <email>
2// SPDX-License-Identifier: Apache-2.0
3
4#ifndef LEARNING_RATE_SCHEDULER_H
5#define LEARNING_RATE_SCHEDULER_H
7
8#include <algorithm>
9
10namespace bitrl
11{
12namespace rl
13{
14
19{
20
21 real_t operator()(real_t alpha, uint_t /*episode_idx*/) const { return alpha; }
22};
23
32{
33 real_t decay{100.0};
35
36 real_t operator()(real_t alpha, uint_t episode_idx) const
37 {
38 return std::max(min_alpha, alpha / (1.0 + static_cast<real_t>(episode_idx) / decay));
39 }
40};
41
42} // namespace rl
43} // namespace bitrl
44
45#endif // LEARNING_RATE_SCHEDULER_H
Definition dummy_agent.h:9
Various utilities used when working with RL problems.
Definition bitrl_log.h:25
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
double real_t
real_t
Definition bitsim_types.h:20
struct ConstantLRScheduler. Echos bach the learning rate it was given
Definition learning_rate_scheduler.h:19
real_t operator()(real_t alpha, uint_t) const
Definition learning_rate_scheduler.h:21
struct InverseDecayLRScheduler. Decays the learning rate it was given with the episodes,...
Definition learning_rate_scheduler.h:32
real_t decay
Definition learning_rate_scheduler.h:33
real_t min_alpha
Definition learning_rate_scheduler.h:34
real_t operator()(real_t alpha, uint_t episode_idx) const
Definition learning_rate_scheduler.h:36