https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SamplerDRLControlTransfer.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://www.mooseframework.org
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#pragma once
13
14// torch-based includes
16
19
21
26{
27public:
32
38
42 virtual void execute() override;
43
47 virtual void initialSetup() override;
48
52 virtual void initializeFromMultiapp() override;
53
57 virtual void executeFromMultiapp() override;
58
62 virtual void finalizeFromMultiapp() override;
63
67 virtual void initializeToMultiapp() override;
68
72 virtual void executeToMultiapp() override;
73
77 virtual void finalizeToMultiapp() override;
78
79protected:
86 LibtorchDRLControl & getDRLControl(unsigned int app_index);
87
89 const std::string _control_name;
90
93};
94
95#endif
Fixed-horizon actor-critic trainer that collects trajectories from MOOSE reporters and runs a PPO upd...
A time-dependent, neural-network-based controller which is associated with a Proximal Policy Optimiza...
const InputParameters & parameters() const
Transfers a trained DRL controller from a trainer to controls on sampler subapps.
const LibtorchDRLControlTrainer & _trainer
The trainer object which will contains the control neural net.
virtual void execute() override
Execute the transfer in the standard non-batch path.
const std::string _control_name
The name of the control object on the other app where we want to copy our neural net.
static InputParameters validParams()
Return the input parameters supported by this transfer.
virtual void initializeToMultiapp() override
Initialize a batch transfer to the multiapp.
virtual void finalizeFromMultiapp() override
Finalize a batch transfer from the multiapp.
virtual void finalizeToMultiapp() override
Finalize a batch transfer to the multiapp.
LibtorchDRLControl & getDRLControl(unsigned int app_index)
Find the DRL control on a local subapp and check that its control period, observation history length,...
virtual void executeToMultiapp() override
Execute a batch transfer to the multiapp.
virtual void executeFromMultiapp() override
Execute a batch transfer from the multiapp.
virtual void initializeFromMultiapp() override
Initialize a batch transfer from the multiapp.
virtual void initialSetup() override
Prepare the transfer for batch-mode execution.
The class creates an additional API to allow Transfers to work when running the StochasticTools<FullS...
Interface for objects that need to use samplers.