https://mooseframework.inl.gov
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 LIBTORCH_ENABLED
11 
12 #include "DRLRewardReporter.h"
13 
14 registerMooseObject("StochasticToolsApp", DRLRewardReporter);
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 
37 void
39 {
41 }
42 
43 #endif
Real averageEpisodeReward()
Function which returns the current average episodic reward.
Real & _reward
The reward values which will be saved.
const ReporterMode REPORTER_MODE_ROOT
DRLRewardReporter(const InputParameters &parameters)
static InputParameters validParams()
registerMooseObject("StochasticToolsApp", DRLRewardReporter)
void addRequiredParam(const std::string &name, const std::string &doc_string)
Reporter which saves the reward values from a Deep Reinforcement Learning controller trainer...
static InputParameters validParams()
LibtorchDRLControlTrainer & _trainer
The DRL trainer which computes the reward values.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Interface for objects that need to use samplers.
void addClassDescription(const std::string &doc_string)
This trainer is responsible for training neural networks that efficiently control different processes...
static InputParameters validParams()
virtual void execute() override