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 : #include "AffineInvariantStretchDecision.h" 11 : 12 : registerMooseObject("StochasticToolsApp", AffineInvariantStretchDecision); 13 : 14 : InputParameters 15 88 : AffineInvariantStretchDecision::validParams() 16 : { 17 88 : InputParameters params = PMCMCDecision::validParams(); 18 88 : params.addClassDescription("Perform decision making for Affine Invariant stretch MCMC."); 19 88 : return params; 20 0 : } 21 : 22 44 : AffineInvariantStretchDecision::AffineInvariantStretchDecision(const InputParameters & parameters) 23 : : PMCMCDecision(parameters), 24 44 : _aiss(dynamic_cast<const AffineInvariantStretchSampler *>(&_sampler)), 25 88 : _step_size(_aiss->getAffineStepSize()) 26 : { 27 : // Check whether the selected sampler is a stretch sampler or not 28 44 : if (!_aiss) 29 0 : paramError("sampler", "The selected sampler is not of type AffineInvariantStretchSampler."); 30 44 : } 31 : 32 : void 33 132 : AffineInvariantStretchDecision::computeTransitionVector(std::vector<Real> & tv, 34 : const std::vector<Real> & evidence) 35 : { 36 792 : for (unsigned int i = 0; i < tv.size(); ++i) 37 924 : tv[i] = std::exp(std::min((_priors.size() - 1) * std::log(_step_size[i]) + evidence[i], 0.0)); 38 132 : }