12#include "libmesh/int_range.h"
20 params.
addClassDescription(
"Computes objective function, gradient and contains reporters for "
21 "communicating between optimizeSolve and subapps");
24 "Number of parameter values associated with each parameter group in 'parameter_names'.");
25 params.
addParam<std::vector<std::vector<Real>>>(
27 "Initial conditions for each parameter. A vector is given for each parameter group. A "
28 "single value can be given for each group and all parameters in that group will be set to "
29 "that value. The default value is 0.");
30 params.
addParam<std::vector<std::vector<Real>>>(
32 "Lower bound for each parameter. A vector is given for each parameter group. A single "
33 "value can be given for each group and all parameters in that group will be set to that "
35 params.
addParam<std::vector<std::vector<Real>>>(
37 "Upper bound for each parameter. A vector is given for each parameter group. A single "
38 "value can be given for each group and all parameters in that group will be set to that "
47 "The 'OptimizationReporter' is deprecated. Please use 'GeneralOptimization' instead. "
48 "You can achieve the same functionality by using an 'OptimizationData' object in the "
49 "forward application to calculate the objective value, similar to the method used here.");
54 _nvalues = getParam<std::vector<dof_id_type>>(
"num_values");
61 "There should be a number in \'num_parameters\' for each name in \'parameter_names\'.");
63 for (
const auto & param_id : make_range(
_nparams))
67 std::vector<Real> ic(
parseInputData(
"initial_condition", 0, param_id));
69 parseInputData(
"lower_bounds", std::numeric_limits<Real>::lowest(), param_id));
71 parseInputData(
"upper_bounds", std::numeric_limits<Real>::max(), param_id));
76 _parameters[param_id]->assign(ic.begin(), ic.end());
89 val += misfit * misfit;
93 Real param_norm_sqr = 0;
95 for (
const auto & val : *data)
96 param_norm_sqr += val * val;
registerMooseObjectDeprecated("OptimizationApp", OptimizationReporter, "12/31/2024 24:00")
void mooseDeprecated(Args &&... args) const
void paramError(const std::string ¶m, Args... args) const
std::vector< Real > & _simulation_values
simulated values at measurement xyzt
static InputParameters validParams()
std::vector< Real > & _measurement_values
std::vector< Real > & _misfit_values
difference between simulation and measurement values at measurement xyzt
Base class for optimization objects, implements routines for calculating misfit.
std::vector< Real > parseInputData(std::string type, Real default_value, unsigned int param_id) const
Function to to parse bounds and initial conditions from input file.
const unsigned int _nparams
Number of parameter vectors.
std::vector< std::vector< Real > * > _gradients
Gradient values declared as reporter data.
std::vector< Real > _lower_bounds
Bounds of the parameters.
dof_id_type _ndof
Total number of parameters.
const std::vector< ReporterValueName > & _parameter_names
Parameter names.
const Real _tikhonov_coeff
Tikhonov Coefficient for regularization.
std::vector< std::vector< Real > * > _parameters
Parameter values declared as reporter data.
std::vector< Real > _upper_bounds
std::vector< dof_id_type > _nvalues
Number of values for each parameter.
Computes gradient and contains reporters for communicating between optimizeSolve and subapps.
OptimizationReporter(const InputParameters ¶meters)
static InputParameters validParams()
virtual void setICsandBounds() override
Sets the initial conditions and bounds right before it is needed.
virtual Real computeObjective() override
Function to compute objective.
virtual void setMisfitToSimulatedValues() override
Function to override misfit values with the simulated values from the matrix free hessian forward sol...