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\'.");
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")
Computes gradient and contains reporters for communicating between optimizeSolve and subapps...
std::vector< Real > & _measurement_values
const std::vector< ReporterValueName > & _parameter_names
Parameter names.
std::vector< Real > & _simulation_values
simulated values at measurement xyzt
void mooseDeprecated(Args &&... args) const
dof_id_type _ndof
Total number of parameters.
virtual void setMisfitToSimulatedValues() override
Function to override misfit values with the simulated values from the matrix free hessian forward sol...
const unsigned int _nparams
Number of parameter vectors.
Base class for optimization objects, implements routines for calculating misfit.
static InputParameters validParams()
virtual Real computeObjective() override
Function to compute objective.
std::vector< dof_id_type > _nvalues
Number of values for each parameter.
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.
std::vector< Real > _lower_bounds
Bounds of the parameters.
void paramError(const std::string ¶m, Args... args) const
std::vector< std::vector< Real > * > _parameters
Parameter values declared as reporter data.
virtual void setICsandBounds() override
Sets the initial conditions and bounds right before it is needed.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::vector< Real > * > _gradients
Gradient values declared as reporter data.
IntRange< T > make_range(T beg, T end)
std::vector< Real > _upper_bounds
const Real _tikhonov_coeff
Tikhonov Coefficient for regularization.
std::vector< Real > & _misfit_values
difference between simulation and measurement values at measurement xyzt
auto index_range(const T &sizable)
OptimizationReporter(const InputParameters ¶meters)
static InputParameters validParams()