https://mooseframework.inl.gov
Eggholder.C
Go to the documentation of this file.
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 "Eggholder.h"
11 
12 registerMooseObject("StochasticToolsTestApp", Eggholder);
13 
16 {
18 }
19 
21 
22 Real
23 Eggholder::function(const std::vector<Real> & x) const
24 {
25  if (x.size() != 2)
26  paramError("x", "Eggholder problem requires exactly 2 inputs, but ", x.size(), " were given.");
27 
28  return eggholder(x);
29 }
30 
31 Real
32 Eggholder::eggholder(const std::vector<Real> & x)
33 {
34 
35  mooseAssert(x.size() == 2, "Eggholder problem requires exactly 2 inputs.");
36 
37  return -(x[1] + 47.0) * std::sin(std::sqrt(std::abs(x[0] / 2.0 + (x[1] + 47.0)))) -
38  x[0] * std::sin(std::sqrt(abs(x[0] - (x[1] + 47.0))));
39 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
registerMooseObject("StochasticToolsTestApp", Eggholder)
void paramError(const std::string &param, Args... args) const
const std::vector< double > x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static Real eggholder(const std::vector< Real > &x)
https://en.wikipedia.org/wiki/Test_functions_for_optimization
Definition: Eggholder.C:32
Real function(const std::vector< Real > &x) const override final
Definition: Eggholder.C:23
static InputParameters validParams()
Eggholder(const InputParameters &parameters)
Definition: Eggholder.C:20
static InputParameters validParams()
Definition: Eggholder.C:15