https://mooseframework.inl.gov
ExpectedImprovementGlobalFit.C
Go to the documentation of this file.
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 
11 #include <cmath>
12 
14 
17 {
19  params.addClassDescription("Expected improvement for global fit (EIGF) by Lam and Notz 2008.");
20  return params;
21 }
22 
25 {
26 }
27 
28 void
30  std::vector<Real> & acq,
31  const std::vector<Real> & gp_mean,
32  const std::vector<Real> & gp_std,
33  const std::vector<std::vector<Real>> & test_inputs,
34  const std::vector<std::vector<Real>> & train_inputs,
35  const std::vector<Real> & generic) const
36 {
37  unsigned int ref_ind;
38  for (unsigned int i = 0; i < test_inputs.size(); ++i)
39  {
40  computeDistance(ref_ind, test_inputs[i], train_inputs);
41  acq[i] = Utility::pow<2>(gp_mean[i] - generic[ref_ind]) + Utility::pow<2>(gp_std[i]);
42  }
43 }
44 
45 void
47  const std::vector<Real> & current_input,
48  const std::vector<std::vector<Real>> & train_inputs)
49 {
50  Real ref_distance = std::numeric_limits<Real>::max();
51  Real distance;
52  req_index = 0;
53  for (unsigned int i = 0; i < train_inputs.size(); ++i)
54  {
55  distance = 0.0;
56  for (unsigned int j = 0; j < current_input.size(); ++j)
57  distance += Utility::pow<2>(current_input[j] - train_inputs[i][j]);
58  if (distance <= ref_distance)
59  {
60  ref_distance = distance;
61  req_index = i;
62  }
63  }
64 }
void computeAcquisitionInternal(std::vector< Real > &acq, const std::vector< Real > &gp_mean, const std::vector< Real > &gp_std, const std::vector< std::vector< Real >> &test_inputs, const std::vector< std::vector< Real >> &train_inputs, const std::vector< Real > &generic) const override
Implementation hook for derived classes (no size checks here).
registerMooseObject("StochasticToolsApp", ExpectedImprovementGlobalFit)
All ParallelAcquisition functions should inherit from this class.
Real distance(const Point &p)
ExpectedImprovementGlobalFit(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
static void computeDistance(unsigned int &req_index, const std::vector< Real > &current_input, const std::vector< std::vector< Real >> &train_inputs)
Compute the Eucleidan distance.