LCOV - code coverage report
Current view: top level - include/samplers - AffineInvariantDES.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 "PMCMCBase.h"
      13             : 
      14             : /**
      15             :  * A class for performing Affine Invariant Ensemble MCMC with differential sampler
      16             :  */
      17             : class AffineInvariantDES : public PMCMCBase
      18             : {
      19             : public:
      20             :   static InputParameters validParams();
      21             : 
      22             :   AffineInvariantDES(const InputParameters & parameters);
      23             : 
      24        5760 :   virtual int decisionStep() const override { return 2; }
      25             : 
      26             : protected:
      27             :   virtual void proposeSamples(const unsigned int seed_value) override;
      28             : 
      29             :   /**
      30             :    * Compute the differential evolution from the current state
      31             :    * @param state1 A randomly selected state 1 of the sampler
      32             :    * @param state2 A randomly selected state 2 of the sampler
      33             :    * @param rnd Random number between 0 and 1
      34             :    * @param scale The scale of the input parameter
      35             :    * @param diff Differential between two randomly selected states
      36             :    */
      37             :   void computeDifferential(
      38             :       const Real & state1, const Real & state2, const Real & rnd, const Real & scale, Real & diff);
      39             : 
      40             :   /**
      41             :    * Tune the internal parameters
      42             :    * @param gamma An internal parameter
      43             :    * @param b An internal parameter
      44             :    * @param scale The scale of the input parameter
      45             :    */
      46             :   void tuneParams(Real & gamma, Real & b, const Real & scale);
      47             : 
      48             :   /// Reporter value with the previous state of all the walkers
      49             :   const std::vector<std::vector<Real>> & _previous_state;
      50             : 
      51             :   /// Reporter value with the previous state of all the walkers for variance
      52             :   const std::vector<Real> & _previous_state_var;
      53             : 
      54             :   /// Tuning options for the internal params
      55             :   const MooseEnum & _tuning_option;
      56             : 
      57             :   /// Scales for the parameters
      58             :   std::vector<Real> _scales;
      59             : };

Generated by: LCOV version 1.14