mango::Least_squares_problem Class Reference

#include <mango.hpp>

Inheritance diagram for mango::Least_squares_problem:
mango::Problem

Public Member Functions

 Least_squares_problem (int N_parameters, double *state_vector, int N_terms, double *targets, double *sigmas, double *best_residual_function, vector_function_type residual_function, int argc, char **argv)
 Constructor for a least-squares optimization problem. More...
 
 ~Least_squares_problem ()
 Destructor. More...
 
int get_N_terms ()
 Return the number of least-squares terms that are summed to form the objective function. More...
 
void set_print_residuals_in_output_file (bool print)
 Determine whether or not to print each individual residual in the MANGO output file. More...
 
- Public Member Functions inherited from mango::Problem
 Problem (int N_parameters, double *state_vector, objective_function_type objective_function, int argc, char **argv)
 Constructor for a standard optimization problem. More...
 
 ~Problem ()
 Destructor. More...
 
void mpi_init (MPI_Comm mpi_comm)
 Initialize MANGO's internal MPI data that describes the partitioning of the processes into worker groups. More...
 
void set_algorithm (algorithm_type algorithm)
 Sets the optimization algorithm. More...
 
void set_algorithm (std::string algorithm_str)
 Sets the optimization algorithm. More...
 
void read_input_file (std::string filename)
 Reads in the number of worker groups and algorithm from a file. More...
 
void set_output_filename (std::string filename)
 Sets the name of the output file that will record values of the objective function at each evaluation. More...
 
void set_bound_constraints (double *lower, double *upper)
 Sets bound constraints for the optimization problem. More...
 
double optimize ()
 Solve the optimization problem that has been set up. More...
 
int get_N_parameters ()
 Get the number of independent variables for an optimization problem. More...
 
int get_best_function_evaluation ()
 For an optimization problem that has already been solved, return the index of the function evaluation corresponding to the optimum. More...
 
int get_function_evaluations ()
 For an optimization problem that has already been solved, return the number of times the objective function was evaluated. More...
 
double * get_state_vector ()
 Get the vector of independent variables. More...
 
void set_centered_differences (bool centered_differences)
 Control whether 1-sided or centered finite differences will be used to compute derivatives of the objective function. More...
 
void set_finite_difference_step_size (double finite_difference_step_size)
 Set an absolute step size for finite difference derivatives. More...
 
void set_max_function_evaluations (int N)
 Set the maximum number of evaluations of the objective function that will be allowed before the optimization is terminated. More...
 
void set_verbose (int verbose)
 Control how much diagnostic information is printed by MANGO. More...
 
void set_output_filename (std::string &filename)
 Sets the name of the output file that will record values of the objective function at each evaluation. More...
 
void set_user_data (void *user_data)
 Pass the prescribed pointer to the objective function whenever it is called. More...
 
void set_relative_bound_constraints (double min_factor, double max_factor, double min_radius, bool preserve_sign)
 Impose bound constraints on an optimization problem, with the bounds chosen as multiples of the initial state vector. More...
 
void set_N_line_search (int N_line_search)
 Sets the number of points considered as a set for parallel line searches. More...
 
Solverget_solver ()
 Get the Solver object associated with the optimization problem. More...
 

Additional Inherited Members

- Public Attributes inherited from mango::Problem
MPI_Partition mpi_partition
 
- Protected Attributes inherited from mango::Problem
Solversolver
 

Detailed Description

Definition at line 658 of file mango.hpp.

Constructor & Destructor Documentation

◆ Least_squares_problem()

mango::Least_squares_problem::Least_squares_problem ( int  N_parameters,
double *  state_vector,
int  N_terms,
double *  targets,
double *  sigmas,
double *  best_residual_function,
vector_function_type  residual_function,
int  argc,
char **  argv 
)

Constructor for a least-squares optimization problem.

Parameters
[in]N_parametersNumber of independent variables.
[in]state_vectorAn array of size N_parameters, giving the initial values of the independent variables.
[in]N_termsThe number of least-squares terms that are summed to form the total objective function.
[in]targetsAn array of size N_terms, containing the target values \( T_j \) in Core Concepts.
[in]sigmasAn array of size N_terms, containing the weights \( \sigma_j \) in Core Concepts.
[in]best_residual_functionAn array of size N_terms, which will be used to store the values of the residuals \( R_j \) at the optimum.
[in]residual_functionThe user-supplied subroutine that computes the residuals \( R_j \).
[in]argc(Optional) A number of arguments. Used to pass options to some optimization libraries.
[in]argv(Optional) An array of arguments. Used to pass options to some optimization libraries.

Definition at line 27 of file Least_squares_problem.cpp.

◆ ~Least_squares_problem()

mango::Least_squares_problem::~Least_squares_problem ( )

Destructor.

Definition at line 55 of file Least_squares_problem.cpp.

Member Function Documentation

◆ get_N_terms()

int mango::Least_squares_problem::get_N_terms ( )

Return the number of least-squares terms that are summed to form the objective function.

Definition at line 65 of file Least_squares_problem.cpp.

◆ set_print_residuals_in_output_file()

void mango::Least_squares_problem::set_print_residuals_in_output_file ( bool  print)

Determine whether or not to print each individual residual in the MANGO output file.

You may wish to print this information to see the relative magnitude of each term in the objective function. On the other hand, for problems with many terms, you may wish to suppress this information to make the file more readable.

Parameters
[in]printWhether or not to print every residual term in the output file.

Definition at line 61 of file Least_squares_problem.cpp.


The documentation for this class was generated from the following files: