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