Transfers a trained DRL controller from a trainer to controls on sampler subapps. More...
#include <SamplerDRLControlTransfer.h>
Public Types | |
| enum | DIRECTION |
| typedef DataFileName | DataFileParameterType |
Public Member Functions | |
| SamplerDRLControlTransfer (const InputParameters ¶meters) | |
| Build the transfer that pushes a trained controller into subapps. | |
| virtual void | execute () override |
| Execute the transfer in the standard non-batch path. | |
| virtual void | initialSetup () override |
| Prepare the transfer for batch-mode execution. | |
| virtual void | initializeFromMultiapp () override |
| Initialize a batch transfer from the multiapp. | |
| virtual void | executeFromMultiapp () override |
| Execute a batch transfer from the multiapp. | |
| virtual void | finalizeFromMultiapp () override |
| Finalize a batch transfer from the multiapp. | |
| virtual void | initializeToMultiapp () override |
| Initialize a batch transfer to the multiapp. | |
| virtual void | executeToMultiapp () override |
| Execute a batch transfer to the multiapp. | |
| virtual void | finalizeToMultiapp () override |
| Finalize a batch transfer to the multiapp. | |
| void | setGlobalMultiAppIndex (dof_id_type index) |
| Method for setting the app index when running in batch mode. | |
| void | setGlobalRowIndex (dof_id_type row) |
| Method for keeping track of the global row index when running in batch mode. | |
| void | setCurrentRow (const std::vector< Real > &row) |
| Method for keeping track of the row data when running in batch mode. | |
| void | variableIntegrityCheck (const AuxVariableName &var_name, bool is_from_multiapp) const |
| const std::shared_ptr< MultiApp > | getMultiApp () const |
| const std::shared_ptr< MultiApp > | getFromMultiApp () const |
| const std::shared_ptr< MultiApp > | getToMultiApp () const |
| std::string | getFromName () const |
| std::string | getToName () const |
| bool | hasFromMultiApp () const |
| bool | hasToMultiApp () const |
| virtual void | getAppInfo () |
| const MultiMooseEnum & | directions () |
| void | setCurrentDirection (const int direction) |
| bool | executeAfterSiblingSourceApp () const |
| virtual bool | enabled () const |
| std::shared_ptr< MooseObject > | getSharedPtr () |
| std::shared_ptr< const MooseObject > | getSharedPtr () const |
| bool | isKokkosObject () const |
| MooseApp & | getMooseApp () const |
| const std::string & | type () const |
| const std::string & | name () const |
| std::string | typeAndName () const |
| MooseObjectParameterName | uniqueParameterName (const std::string ¶meter_name) const |
| MooseObjectName | uniqueName () const |
| const InputParameters & | parameters () const |
| const hit::Node * | getHitNode () const |
| bool | hasBase () const |
| const std::string & | getBase () const |
| const T & | getParam (const std::string &name) const |
| std::vector< std::pair< T1, T2 > > | getParam (const std::string ¶m1, const std::string ¶m2) const |
| const T * | queryParam (const std::string &name) const |
| const T & | getRenamedParam (const std::string &old_name, const std::string &new_name) const |
| T | getCheckedPointerParam (const std::string &name, const std::string &error_string="") const |
| bool | isParamValid (const std::string &name) const |
| bool | isParamSetByUser (const std::string &name) const |
| void | connectControllableParams (const std::string ¶meter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const |
| void | paramError (const std::string ¶m, Args... args) const |
| void | paramWarning (const std::string ¶m, Args... args) const |
| void | paramWarning (const std::string ¶m, Args... args) const |
| void | paramInfo (const std::string ¶m, Args... args) const |
| std::string | messagePrefix (const bool hit_prefix=true) const |
| std::string | errorPrefix (const std::string &) const |
| void | mooseError (Args &&... args) const |
| void | mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const |
| void | mooseErrorNonPrefixed (Args &&... args) const |
| void | mooseWarning (Args &&... args) const |
| void | mooseWarning (Args &&... args) const |
| void | mooseWarningNonPrefixed (Args &&... args) const |
| void | mooseWarningNonPrefixed (Args &&... args) const |
| void | mooseDeprecated (Args &&... args) const |
| void | mooseDeprecated (Args &&... args) const |
| void | mooseDeprecatedNoTrace (Args &&... args) const |
| void | mooseInfo (Args &&... args) const |
| void | callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const |
| std::string | getDataFileName (const std::string ¶m) const |
| std::string | getDataFileNameByName (const std::string &relative_path) const |
| std::string | getDataFilePath (const std::string &relative_path) const |
| virtual void | timestepSetup () |
| virtual void | jacobianSetup () |
| virtual void | residualSetup () |
| virtual void | subdomainSetup () |
| virtual void | customSetup (const ExecFlagType &) |
| const ExecFlagEnum & | getExecuteOnEnum () const |
| PerfGraph & | perfGraph () |
| MooseEnum | direction () |
| MooseEnum | direction () |
| MooseEnum | currentDirection () |
| MooseEnum | currentDirection () |
| const Parallel::Communicator & | comm () const |
| processor_id_type | n_processors () const |
| processor_id_type | processor_id () const |
| template<> | |
| SurrogateModel & | getSurrogateModel (const std::string &name) const |
| template<> | |
| SurrogateTrainerBase & | getSurrogateTrainer (const std::string &name) const |
| template<> | |
| SurrogateModel & | getSurrogateModelByName (const UserObjectName &name) const |
| template<> | |
| SurrogateTrainerBase & | getSurrogateTrainerByName (const UserObjectName &name) const |
| template<typename T = SurrogateModel> | |
| T & | getSurrogateModel (const std::string &name) const |
| Get a SurrogateModel/Trainer with a given name. | |
| template<typename T = SurrogateTrainerBase> | |
| T & | getSurrogateTrainer (const std::string &name) const |
| template<typename T = SurrogateModel> | |
| T & | getSurrogateModelByName (const UserObjectName &name) const |
| Get a sampler with a given name. | |
| template<typename T = SurrogateTrainerBase> | |
| T & | getSurrogateTrainerByName (const UserObjectName &name) const |
Static Public Member Functions | |
| static InputParameters | validParams () |
| Return the input parameters supported by this transfer. | |
| static void | callMooseError (MooseApp *const app, const InputParameters ¶ms, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true) |
| static void | addSkipCoordCollapsingParam (InputParameters ¶ms) |
| static libMesh::System * | find_sys (libMesh::EquationSystems &es, const std::string &var_name) |
| static std::string | possibleDirections () |
Public Attributes | |
| TO_MULTIAPP | |
| FROM_MULTIAPP | |
| BETWEEN_MULTIAPP | |
| usingCombinedWarningSolutionWarnings | |
| const ConsoleStream | _console |
Static Public Attributes | |
| static const libMesh::Number | OutOfMeshValue |
| static const std::string | type_param |
| static const std::string | name_param |
| static const std::string | unique_name_param |
| static const std::string | app_param |
| static const std::string | moose_base_param |
| static const std::string | kokkos_object_param |
Protected Member Functions | |
| LibtorchDRLControl & | getDRLControl (unsigned int app_index) |
| Find the DRL control on a local subapp and check that its control period, observation history length, number of observations, and number of control signals match the trainer's. | |
| std::vector< unsigned int > | getFromsPerProc () |
| libMesh::NumericVector< Real > & | getTransferVector (unsigned int i_local, std::string var_name) |
| unsigned int | getGlobalSourceAppIndex (unsigned int i_from) const |
| unsigned int | getGlobalTargetAppIndex (unsigned int i_to) const |
| unsigned int | getLocalSourceAppIndex (unsigned int i_from) const |
| virtual void | checkSiblingsTransferSupported () const |
| void | checkParentAppUserObjectExecuteOn (const std::string &object_name) const |
| void | errorIfObjectExecutesOnTransferInSourceApp (const std::string &object_name) const |
| Point | getPointInTargetAppFrame (const Point &p, unsigned int local_i_to, const std::string &phase) const |
| Point | getPointInSourceAppFrame (const Point &p, unsigned int local_i_from, const std::string &phase) const |
| void | checkMultiAppExecuteOn () |
| void | checkVariable (const FEProblemBase &fe_problem, const VariableName &var_name, const std::string ¶m_name="") const |
| void | extendBoundingBoxes (const Real factor, std::vector< libMesh::BoundingBox > &bboxes) const |
| void | flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const |
| InvalidSolutionID | registerInvalidSolutionInternal (const std::string &message, const bool warning) const |
| T & | declareRestartableData (const std::string &data_name, Args &&... args) |
| ManagedValue< T > | declareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args) |
| const T & | getRestartableData (const std::string &data_name) const |
| T & | declareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args) |
| T & | declareRecoverableData (const std::string &data_name, Args &&... args) |
| T & | declareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args) |
| T & | declareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args) |
| std::string | restartableName (const std::string &data_name) const |
| PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level) const |
| PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const |
| std::string | timedSectionName (const std::string §ion_name) const |
| std::vector< libMesh::BoundingBox > | getFromBoundingBoxes () |
| std::vector< libMesh::BoundingBox > | getFromBoundingBoxes (BoundaryID boundary_id) |
| std::vector< libMesh::BoundingBox > | getFromBoundingBoxes () |
| std::vector< libMesh::BoundingBox > | getFromBoundingBoxes (BoundaryID boundary_id) |
Static Protected Member Functions | |
| static void | addUserObjectExecutionCheckParam (InputParameters ¶ms) |
| static void | addBBoxFactorParam (InputParameters ¶ms) |
| static void | transformBoundingBox (libMesh::BoundingBox &box, const MultiAppCoordTransform &transform) |
Protected Attributes | |
| const std::string | _control_name |
| The name of the control object on the other app where we want to copy our neural net. | |
| const LibtorchDRLControlTrainer & | _trainer |
| The trainer object which will contains the control neural net. | |
| dof_id_type | _app_index = 0 |
| Index for the sub-app that the batch-mode multiapp is working on. | |
| dof_id_type | _global_index = 0 |
| Index for tracking the row index when using batch mode operation. | |
| std::vector< Real > | _row_data |
| The current row of data (comes from multiapp) | |
| Sampler * | _sampler_ptr |
| Pointer to the Sampler object used by the SamplerTransientMultiApp or SamplerFullSolveMultiApp. | |
| std::shared_ptr< MultiApp > | _multi_app |
| std::vector< FEProblemBase * > | _to_problems |
| std::vector< FEProblemBase * > | _from_problems |
| std::vector< libMesh::EquationSystems * > | _to_es |
| std::vector< libMesh::EquationSystems * > | _from_es |
| std::vector< MooseMesh * > | _to_meshes |
| std::vector< MooseMesh * > | _from_meshes |
| std::vector< Point > | _to_positions |
| std::vector< Point > | _from_positions |
| std::vector< std::unique_ptr< MultiAppCoordTransform > > | _to_transforms |
| std::vector< std::unique_ptr< MultiAppCoordTransform > > | _from_transforms |
| const bool | _skip_coordinate_collapsing |
| bool | _displaced_source_mesh |
| bool | _displaced_target_mesh |
| Real | _bbox_factor |
| std::vector< unsigned int > | _to_local2global_map |
| std::vector< unsigned int > | _from_local2global_map |
| SubProblem & | _subproblem |
| FEProblemBase & | _fe_problem |
| SystemBase & | _sys |
| THREAD_ID | _tid |
| MultiMooseEnum | _directions |
| const bool | _exec_after_source_app_exec |
| const bool & | _enabled |
| MooseApp & | _app |
| Factory & | _factory |
| ActionFactory & | _action_factory |
| const std::string & | _type |
| const std::string & | _name |
| const InputParameters & | _pars |
| const ExecFlagEnum & | _execute_enum |
| const ExecFlagType & | _current_execute_flag |
| MooseApp & | _restartable_app |
| const std::string | _restartable_system_name |
| const THREAD_ID | _restartable_tid |
| const bool | _restartable_read_only |
| MooseApp & | _pg_moose_app |
| const std::string | _prefix |
| MooseEnum | _direction |
| MooseEnum | _current_direction |
| const Parallel::Communicator & | _communicator |
Private Member Functions | |
| virtual bool | usesMooseAppCoordTransform () const |
| Point | mapBackWithoutCollapsing (MultiAppCoordTransform &transform, const Point &p, const std::string &phase) const |
| void | getFromMultiAppInfo () |
| void | getToMultiAppInfo () |
| RestartableDataValue & | registerRestartableDataOnApp (std::unique_ptr< RestartableDataValue > data, THREAD_ID tid) const |
| void | registerRestartableNameWithFilterOnApp (const std::string &name, Moose::RESTARTABLE_FILTER filter) |
| RestartableData< T > & | declareRestartableDataHelper (const std::string &data_name, void *context, Args &&... args) const |
| T & | getSampler (const std::string &name) |
| Sampler & | getSampler (const std::string &name) |
| T & | getSamplerByName (const SamplerName &name) |
| Sampler & | getSamplerByName (const SamplerName &name) |
Static Private Member Functions | |
| static const hit::Node * | getHitNode (const InputParameters ¶ms) |
| static std::string | messagePrefix (const InputParameters ¶ms, const bool hit_prefix) |
Private Attributes | |
| std::shared_ptr< MultiApp > | _from_multi_app |
| std::shared_ptr< MultiApp > | _to_multi_app |
| std::unique_ptr< MooseAppCoordTransform > | _from_moose_app_transform |
| std::unique_ptr< MooseAppCoordTransform > | _to_moose_app_transform |
| const ParallelParamObject & | _parent |
| const MooseBase & | _si_moose_base |
| const FEProblemBase * | _si_problem |
| ExecFlagEnum | _empty_execute_enum |
| const RestartableDataMapName | _metaname |
| std::string | _restartable_name |
| const InputParameters & | _si_params |
| FEProblemBase & | _si_feproblem |
| THREAD_ID | _si_tid |
| const InputParameters & | _smi_params |
| Parameters of the object with this interface. | |
| FEProblemBase & | _smi_feproblem |
| Reference to FEProblemBase instance. | |
| const THREAD_ID | _smi_tid |
| Thread ID. | |
Transfers a trained DRL controller from a trainer to controls on sampler subapps.
Definition at line 25 of file SamplerDRLControlTransfer.h.
| SamplerDRLControlTransfer::SamplerDRLControlTransfer | ( | const InputParameters & | parameters | ) |
Build the transfer that pushes a trained controller into subapps.
| parameters | Input parameters for the transfer. |
Definition at line 37 of file SamplerDRLControlTransfer.C.
|
overridevirtual |
Execute the transfer in the standard non-batch path.
Implements MultiAppTransfer.
Definition at line 52 of file SamplerDRLControlTransfer.C.
|
overridevirtual |
Execute a batch transfer from the multiapp.
Reimplemented from StochasticToolsTransfer.
Definition at line 77 of file SamplerDRLControlTransfer.C.
|
overridevirtual |
Execute a batch transfer to the multiapp.
Reimplemented from StochasticToolsTransfer.
Definition at line 92 of file SamplerDRLControlTransfer.C.
|
overridevirtual |
Finalize a batch transfer from the multiapp.
Reimplemented from StochasticToolsTransfer.
Definition at line 82 of file SamplerDRLControlTransfer.C.
|
overridevirtual |
Finalize a batch transfer to the multiapp.
Reimplemented from StochasticToolsTransfer.
Definition at line 189 of file SamplerDRLControlTransfer.C.
|
protected |
Find the DRL control on a local subapp and check that its control period, observation history length, number of observations, and number of control signals match the trainer's.
| app_index | Global index of the local subapp. |
Definition at line 116 of file SamplerDRLControlTransfer.C.
Referenced by execute(), and executeToMultiapp().
|
inherited |
Get a SurrogateModel/Trainer with a given name.
| name | The name of the parameter key of the sampler to retrieve |
Definition at line 81 of file SurrogateModelInterface.h.
Referenced by SurrogateTrainer::initialize().
|
inherited |
Definition at line 46 of file SurrogateModelInterface.C.
|
inherited |
Get a sampler with a given name.
| name | The name of the sampler to retrieve |
Definition at line 88 of file SurrogateModelInterface.h.
Referenced by CrossValidationScores::CrossValidationScores(), EvaluateSurrogate::EvaluateSurrogate(), and InverseMapping::initialSetup().
|
inherited |
Definition at line 31 of file SurrogateModelInterface.C.
|
inherited |
Definition at line 104 of file SurrogateModelInterface.h.
|
inherited |
Definition at line 60 of file SurrogateModelInterface.C.
|
inherited |
Definition at line 111 of file SurrogateModelInterface.h.
Referenced by SurrogateTrainerOutput::output().
|
inherited |
Definition at line 53 of file SurrogateModelInterface.C.
|
overridevirtual |
Initialize a batch transfer from the multiapp.
Reimplemented from StochasticToolsTransfer.
Definition at line 72 of file SamplerDRLControlTransfer.C.
|
overridevirtual |
Initialize a batch transfer to the multiapp.
Reimplemented from StochasticToolsTransfer.
Definition at line 87 of file SamplerDRLControlTransfer.C.
|
overridevirtual |
Prepare the transfer for batch-mode execution.
Reimplemented from MultiAppTransfer.
Definition at line 47 of file SamplerDRLControlTransfer.C.
|
inlineinherited |
Method for keeping track of the row data when running in batch mode.
See StochasticTools<FullSolve/Transient>MultiApp
Definition at line 65 of file StochasticToolsTransfer.h.
|
inlineinherited |
Method for setting the app index when running in batch mode.
See StochasticTools<FullSolve/Transient>MultiApp
Definition at line 51 of file StochasticToolsTransfer.h.
|
inlineinherited |
Method for keeping track of the global row index when running in batch mode.
See StochasticTools<FullSolve/Transient>MultiApp
Definition at line 58 of file StochasticToolsTransfer.h.
|
static |
Return the input parameters supported by this transfer.
Definition at line 20 of file SamplerDRLControlTransfer.C.
|
protectedinherited |
Index for the sub-app that the batch-mode multiapp is working on.
Definition at line 69 of file StochasticToolsTransfer.h.
Referenced by SerializedSolutionTransfer::executeFromMultiapp(), executeToMultiapp(), SamplerParameterTransfer::executeToMultiapp(), SerializedSolutionTransfer::initializeInBatchMode(), and StochasticToolsTransfer::setGlobalMultiAppIndex().
|
protected |
The name of the control object on the other app where we want to copy our neural net.
Definition at line 89 of file SamplerDRLControlTransfer.h.
Referenced by getDRLControl().
|
protectedinherited |
Index for tracking the row index when using batch mode operation.
Definition at line 71 of file StochasticToolsTransfer.h.
Referenced by PODResidualTransfer::executeFromMultiapp(), PODSamplerSolutionTransfer::executeFromMultiapp(), SamplerReporterTransfer::executeFromMultiapp(), SerializedSolutionTransfer::executeFromMultiapp(), executeToMultiapp(), PODSamplerSolutionTransfer::executeToMultiapp(), and StochasticToolsTransfer::setGlobalRowIndex().
|
protectedinherited |
The current row of data (comes from multiapp)
Definition at line 73 of file StochasticToolsTransfer.h.
Referenced by SamplerParameterTransfer::executeToMultiapp(), and StochasticToolsTransfer::setCurrentRow().
|
protectedinherited |
Pointer to the Sampler object used by the SamplerTransientMultiApp or SamplerFullSolveMultiApp.
Definition at line 76 of file StochasticToolsTransfer.h.
Referenced by PODSamplerSolutionTransfer::execute(), SamplerParameterTransfer::execute(), SamplerPostprocessorTransfer::execute(), SamplerReporterTransfer::execute(), SerializedSolutionTransfer::execute(), executeToMultiapp(), SamplerPostprocessorTransfer::initializeFromMultiapp(), SamplerReporterTransfer::intitializeStochasticReporters(), StochasticToolsTransfer::StochasticToolsTransfer(), SerializedSolutionTransfer::transferInParallel(), and SamplerReporterTransfer::transferStochasticReporters().
|
privateinherited |
Reference to FEProblemBase instance.
Definition at line 73 of file SurrogateModelInterface.h.
Referenced by SurrogateModelInterface::getSurrogateModelByName(), and SurrogateModelInterface::getSurrogateTrainerByName().
|
privateinherited |
Parameters of the object with this interface.
Definition at line 70 of file SurrogateModelInterface.h.
Referenced by SurrogateModelInterface::getSurrogateModel(), and SurrogateModelInterface::getSurrogateTrainer().
|
privateinherited |
Thread ID.
Definition at line 76 of file SurrogateModelInterface.h.
Referenced by SurrogateModelInterface::getSurrogateTrainerByName().
|
protected |
The trainer object which will contains the control neural net.
Definition at line 92 of file SamplerDRLControlTransfer.h.
Referenced by execute(), executeToMultiapp(), and getDRLControl().