https://mooseframework.inl.gov
Loading...
Searching...
No Matches
DRLRewardReporter.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#ifdef MOOSE_LIBTORCH_ENABLED
11
12#include "DRLRewardReporter.h"
13
15
18{
21
22 params.addClassDescription("Reporter containing the reward values of a DRL controller trainer.");
23 params.addRequiredParam<UserObjectName>(
24 "drl_trainer_name", "The name of the RDL controller trainer which computes the rewards.");
25
26 return params;
27}
28
30 : GeneralReporter(parameters),
32 _reward(declareValueByName<Real>("average_reward", REPORTER_MODE_ROOT)),
33 _trainer(getSurrogateTrainer<LibtorchDRLControlTrainer>("drl_trainer_name"))
34{
35}
36
37void
42
43#endif
registerMooseObject("StochasticToolsApp", DRLRewardReporter)
const ReporterMode REPORTER_MODE_ROOT
Reporter which saves the reward values from a Deep Reinforcement Learning controller trainer.
Real & _reward
The reward values which will be saved.
DRLRewardReporter(const InputParameters &parameters)
static InputParameters validParams()
LibtorchDRLControlTrainer & _trainer
The DRL trainer which computes the reward values.
virtual void execute() override
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
This trainer is responsible for training neural networks that efficiently control different processes...
Real averageEpisodeReward()
Function which returns the current average episodic reward.
Interface for objects that need to use samplers.
static InputParameters validParams()