LCOV - code coverage report
Current view: top level - include/samplers - ActiveLearningMonteCarloSampler.h (source / functions) Hit Total Coverage
Test: idaholab/moose stochastic_tools: f45d79 Lines: 1 1 100.0 %
Date: 2025-07-25 05:00:46 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #pragma once
      11             : 
      12             : #include "Sampler.h"
      13             : 
      14             : /**
      15             :  * A class used to perform Monte Carlo Sampling with active learning
      16             :  */
      17             : class ActiveLearningMonteCarloSampler : public Sampler
      18             : {
      19             : public:
      20             :   static InputParameters validParams();
      21             : 
      22             :   ActiveLearningMonteCarloSampler(const InputParameters & parameters);
      23             : 
      24             :   /**
      25             :    * Returns true if the adaptive sampling is completed
      26             :    */
      27        2036 :   virtual bool isAdaptiveSamplingCompleted() const override { return _is_sampling_completed; }
      28             : 
      29             : protected:
      30             :   /// Gather all the samples
      31             :   virtual void sampleSetUp(const Sampler::SampleMode mode) override;
      32             :   /// Return the sample for the given row and column
      33             :   virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) override;
      34             : 
      35             :   /// Storage for distribution objects to be utilized
      36             :   std::vector<Distribution const *> _distributions;
      37             : 
      38             :   /// Flag samples if the surrogate prediction was inadequate
      39             :   const std::vector<bool> & _flag_sample;
      40             : 
      41             :   /// True if the sampling is completed
      42             :   bool _is_sampling_completed = false;
      43             : 
      44             : private:
      45             :   /// Track the current step of the main App
      46             :   const int & _step;
      47             : 
      48             :   /// The maximum number of GP fails
      49             :   const unsigned int _num_batch;
      50             : 
      51             :   /// Ensure that the sampler proceeds in a sequential fashion
      52             :   int _check_step;
      53             : 
      54             :   /// Number of samples requested
      55             :   const int & _num_samples;
      56             : 
      57             :   /// Number of retraining performed
      58             :   int _retraining_steps = 0;
      59             : 
      60             :   /// Storage for previously accepted samples by the decision reporter system
      61             :   std::vector<std::vector<Real>> _inputs_sto;
      62             : 
      63             :   /// Store the input params for which the GP fails
      64             :   std::vector<std::vector<Real>> _inputs_gp_fails;
      65             : };

Generated by: LCOV version 1.14