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 6 : ProbabilityofImprovement::validParams() 18 : { 19 6 : InputParameters params = ParallelAcquisitionFunctionBase::validParams(); 20 6 : params.addClassDescription("Probability of improvement acquisition function."); 21 6 : return params; 22 0 : } 23 : 24 3 : ProbabilityofImprovement::ProbabilityofImprovement(const InputParameters & parameters) 25 3 : : ParallelAcquisitionFunctionBase(parameters) 26 : { 27 3 : } 28 : 29 : void 30 3 : 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 3003 : for (unsigned int i = 0; i < gp_mean.size(); ++i) 40 3000 : acq[i] = Normal::cdf(gp_mean[i] - *maxIt, 0.0, gp_std[i]); 41 3 : }