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 : #include "ProbabilityofImprovement.h" 11 : #include "Normal.h" 12 : #include <cmath> 13 : 14 : registerMooseObject("StochasticToolsApp", ProbabilityofImprovement); 15 : 16 : InputParameters 17 8 : ProbabilityofImprovement::validParams() 18 : { 19 8 : InputParameters params = ParallelAcquisitionFunctionBase::validParams(); 20 8 : params.addClassDescription("Probability of improvement acquisition function."); 21 8 : return params; 22 0 : } 23 : 24 4 : ProbabilityofImprovement::ProbabilityofImprovement(const InputParameters & parameters) 25 4 : : ParallelAcquisitionFunctionBase(parameters) 26 : { 27 4 : } 28 : 29 : void 30 4 : ProbabilityofImprovement::computeAcquisitionInternal( 31 : std::vector<Real> & acq, 32 : const std::vector<Real> & gp_mean, 33 : const std::vector<Real> & gp_std, 34 : const std::vector<std::vector<Real>> & /*test_inputs*/, 35 : const std::vector<std::vector<Real>> & /*train_inputs*/, 36 : const std::vector<Real> & generic) const 37 : { 38 : auto maxIt = std::max_element(generic.begin(), generic.end()); 39 4004 : for (unsigned int i = 0; i < gp_mean.size(); ++i) 40 4000 : acq[i] = Normal::cdf(gp_mean[i] - *maxIt, 0.0, gp_std[i]); 41 4 : }