LCOV - code coverage report
Current view: top level - include/samplers - GenericActiveLearningSampler.h (source / functions) Hit Total Coverage
Test: idaholab/moose stochastic_tools: #32971 (54bef8) with base c6cf66 Lines: 1 1 100.0 %
Date: 2026-05-29 20:40:35 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       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             : #pragma once
      11             : 
      12             : #include "Sampler.h"
      13             : #include "TransientInterface.h"
      14             : #include "Distribution.h"
      15             : 
      16             : /**
      17             :  * A generic sampler to support parallel active learning
      18             :  */
      19             : class GenericActiveLearningSampler : public Sampler, public TransientInterface
      20             : {
      21             : public:
      22             :   static InputParameters validParams();
      23             : 
      24             :   GenericActiveLearningSampler(const InputParameters & parameters);
      25             : 
      26             :   /**
      27             :    * Return random samples for the GP to try in the reporter class
      28             :    */
      29             :   const std::vector<std::vector<Real>> & getSampleTries() const;
      30             : 
      31             :   /**
      32             :    * Return the number of parallel proposals.
      33             :    */
      34          44 :   dof_id_type getNumParallelProposals() const { return _num_parallel_proposals; }
      35             : 
      36             : protected:
      37             :   /// Gather all the samples
      38             :   virtual void executeSetUp() override;
      39             :   /// Return the sample for the given row and column
      40             :   virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) override;
      41             : 
      42             :   /// Storage for distribution objects to be utilized
      43             :   std::vector<Distribution const *> _distributions;
      44             : 
      45             :   /// Number of parallel proposals to be made and subApps to be executed
      46             :   const unsigned int _num_parallel_proposals;
      47             : 
      48             :   /// The selected sample indices to evaluate the subApp
      49             :   const std::vector<unsigned int> & _sorted_indices;
      50             : 
      51             :   /// Initial values of the input params to get the MCMC scheme started
      52             :   const std::vector<Real> & _initial_values;
      53             : 
      54             :   /// Vectors of new proposed samples
      55             :   std::vector<std::vector<Real>> _new_samples;
      56             : 
      57             : private:
      58             :   /// Number of samples to propose in each iteration (not all are sent for subApp evals)
      59             :   const unsigned int _num_tries;
      60             : 
      61             :   /// Storage for all the proposed samples
      62             :   std::vector<std::vector<Real>> _inputs_all;
      63             : };

Generated by: LCOV version 1.14