OpenFCST: The open-source Fuel Cell Simulation Toolbox
|
This class is used to interface with DAKOTA as an algorithm library. More...
#include <dakota_application.h>
Public Member Functions | |
DakotaApplication (boost::shared_ptr< Dakota::ProblemDescDB > global_problem_db, std::string parameter_file) | |
Constructor for an object of this class. More... | |
void | manage_inputs (ParameterHandler ¶m) |
Declares & Initializes all parameters, creates Dakota input file. More... | |
void | assign_interface (Dakota::DirectApplicInterface *optimization_interface) |
Assign the direct interface to the simulation code which is of type Dakota::DirectApplicInterface. More... | |
void | run () |
This function will first lock the problem_db preventing anychanges to the data. More... | |
bool | use_NLS () |
Get boolean NLS flag. More... | |
Dakota::RealVector | vars_results () |
Function retrieves and returns the final optimum design variables. More... | |
Dakota::RealVector | resp_results () |
Function retrieves and returns the optimum response values. More... | |
void | declare_parameters (ParameterHandler ¶m) |
Declare all parameters that are needed for optimization. More... | |
void | synchronize_variables (unsigned int &n_dvar, unsigned int &n_resp, std::vector< std::string > &name_design_var, std::vector< std::string > &name_responses) |
This function is used to remotely axcess the number and name of design_variables, number and name of responses, as they are private variables. More... | |
Private Member Functions | |
void | initialize (ParameterHandler ¶m) |
Read in parameters for the parameter handler in order to initialize data.These parameters are read in from the Opt_data file. More... | |
void | write_hybrid_dakota_input_file () |
Write Dakota input file for hybrid optimization strategy. More... | |
void | write_pareto_dakota_input_file () |
Write Dakota input file for pareto optimization strategy. More... | |
void | write_multi_start_dakota_input_file () |
Write Dakota input file for multi-start optimization strategy. More... | |
void | write_single_method_dakota_input_file () |
Write Dakota input file for single optimization strategy. More... | |
void | write_method (std::stringstream &inputss, std::string &method_id, std::string method_name, std::string model_ptr) |
Member function to write Dakota input file based on method selection. More... | |
void | write_responses (std::stringstream &inputss, int id, std::string method_name) |
Member function to write Dakota input file based on specified response variables. More... | |
void | write_variables (std::stringstream &inputss, int id) |
Member function to write Dakota input file based on specified variables. More... | |
DeclException2 (DesignVariableNotFoundInFCSTDesignVariables, std::string, std::string,<< "A "<< arg1<< " with name \""<< arg2<< "\" is not stored in available FCST design variables. Please define the variable in DakotaApplication class and in set_parameters in the appropriate class") | |
Exception thrown when a user defined design variables is not found among available FCST design variables. More... | |
Private Attributes | |
bool | a_gradients |
Analytical Gradients option for Dakota optimization. More... | |
bool | n_gradients |
Numerical Gradients option for Dakota optimization. More... | |
std::string | n_gradient_type |
Numerical Gradients type for Dakota optimization. More... | |
bool | hessians |
Analytical Hessian Option for Dakota optimization. More... | |
unsigned int | n_dvar |
Number of design variables. More... | |
unsigned int | n_obj |
Number of objective functions. More... | |
unsigned int | n_nl_con |
Number of non-linear constraints. More... | |
unsigned int | n_eq_con |
Number of equality constraints. More... | |
unsigned int | n_con |
Total number of constraints = n_nl_con + n_eq_con. More... | |
unsigned int | n_resp |
Number of responses = n_obj + n_con. More... | |
std::vector< std::string > | name_design_var |
Member that stores the name of the design variables. More... | |
std::vector< std::string > | all_name_design_var |
Member that stores the name of all possible design variables that have been defined in FCST. More... | |
std::vector< std::string > | name_responses |
Member that stores the name of the responses, i.e. More... | |
std::string | input_file |
Name of the analysis input file. More... | |
boost::shared_ptr < Dakota::ProblemDescDB > | problem_db |
Pointer to the problem description data base. More... | |
std::string | dakota_version |
Dakota version used. More... | |
bool | use_dakota_input_file |
Flag to use an input file from Dakota Specify interface, method, and strategy options, number of variables, number of responses/constrants. More... | |
std::string | dakota_input |
Name of the Dakota input file. More... | |
std::string | optimization_strategy |
Optimization Strategy - Single, Pareto, Multi start point, Hybrid. More... | |
std::string | optimization_method |
Optimization Method - OPT++, NL2SOL, multidim_parameter_study, etc. More... | |
bool | NLS_flag |
Nonlinear Least-Squares Parameter Estimation Flag. More... | |
bool | scaling |
Used to activate scaling. More... | |
std::string | NLS_data_file |
Experimental data file for NLS parameter estimation - Operating Conditions & output. More... | |
int | max_iter |
Maximum number of optimization iterations. More... | |
int | max_f_eval |
Maximum number of optimization function evaluations. More... | |
double | convergence_tol |
Optimization convergence tolerance. More... | |
double | constraint_tol |
Optimization constraint tolerance. More... | |
int | rand_pareto_weights |
Number of random weights for generating objective function pareto set. More... | |
int | rand_start_points |
Number of random weights for generating objective function pareto set. More... | |
std::string | hybrid_strategy |
Hybrid Optimization strategy - sequential, etc. More... | |
int | n_hybrid_methods |
Number of Hybrid Optimization methods. More... | |
std::vector< std::string > | hybrid_opt_method |
Hybrid Optimization method names. More... | |
std::vector< std::string > | method_list |
Hybrid Optimization method string identifiers. More... | |
std::vector< std::string > | model_ptr |
Hybrid Optimization model string identifiers. More... | |
std::vector< double > | tol |
Hybrid Optimization method specific tolerances. More... | |
std::vector< double > | eval_max |
Hybrid Optimization method specific function evaluation maximums. More... | |
std::vector< double > | iter_max |
Hybrid Optimization method specific iteration maximums. More... | |
std::vector< int > | part_design_var |
Parameter Study Partition vector Set number of partitions for multidim_parameter_study NOTE: Evaluated at n+1 points between lower and upper bound. More... | |
double | step_to_boundary |
OPT++ steplength. More... | |
double | grad_tol |
OPT++ gradient tolerance. More... | |
std::string | merit_function |
OPT++ merit function. More... | |
double | trust_rad |
NL2SOL initial trust radius. More... | |
double | abs_conv_tol |
NL2SOL absolute convergence tolerance. More... | |
double | x_conv_tol |
NL2SOL Parameter convergence tolerance. More... | |
double | false_conv_tol |
NL2SOL Parameter false convergence tolerance. More... | |
int | m_data_points |
NL2SOL Parameter storing the number of terms. More... | |
double | solution_target |
NCSU parameter. More... | |
double | final_solutions |
NCSU parameter. More... | |
double | min_boxsize_limit |
NCSU parameter. More... | |
double | volume_boxsize_limit |
NCSU parameter. More... | |
Dakota::StringArray | dakota_name_design_var |
Dakota array of design variable names. More... | |
Dakota::RealVector | ip_design_var |
Dakota vector of design variable initial points. More... | |
Dakota::RealVector | lb_design_var |
Dakota vector of design variable lower bounds. More... | |
Dakota::RealVector | ub_design_var |
Dakota vector of design variable upper bounds. More... | |
Dakota::RealVector | scale_design_var |
Dakota vector of design variable scales. More... | |
Dakota::StringArray | scale_types |
Dakota vector of design variable scale methods. More... | |
Dakota::RealVector | step_design_var |
Dakota vector of design variable step sizes for numerical gradients. More... | |
Dakota::RealVector | lb_nl_constraint |
Dakota vector of nonlinear constraint lower bounds. More... | |
Dakota::RealVector | ub_nl_constraint |
Dakota vector of nonlinear constraint upper bounds. More... | |
Dakota::RealVector | eq_constraint |
Dakota vector of equality constraints. More... | |
Dakota::Strategy | selected_strategy |
DAKOTA strategy. More... | |
double | centering_param |
Centering parameter for the opt++ strategy. More... | |
double | initial_delta |
Optimization SCOLIB (COLINY) - COBYLA (Constrained Optimization By Linear Appoximations) [coliny_cobyla], APPS [asynch_pattern_search], and coliny_pattern_search . More... | |
double | threshold_delta |
double | contraction_factor |
std::string | mutation_type |
Optimization - OPT++ Search method . More... | |
std::string | crossover_type |
JEGA - crossover_type. More... | |
std::string | fitness_type |
JEGA - fitness_type. More... | |
std::string | fitness_type_moga |
std::string | replacement_type |
JEGA - replacement_type. More... | |
std::string | replacement_type_moga |
std::string | initialization_type |
JEGA - initialization_type. More... | |
std::string | convergence_type |
JEGA - convergence_type. More... | |
std::string | convergence_type_moga |
double | num_offspring |
JEGA - Number of Offspring and Parent. More... | |
double | num_parents |
This class is used to interface with DAKOTA as an algorithm library.
It reads the optimization specifications from the parameter file specified in the main parameter file used to launch FCST under subsection Simulator >> set optimization parameter file name.
DakotaApplication is called by simulator_builder and it uses a direct application interface to the analysis code and runs the optimization.
This member function defines all available design variables that can be used for optimization. Variables specified in the optimization file in:
need to have been defined in this file. Note that the character ">>" is used to separate subsections. Several parameters in the input file contain a list of comma separated parameters of the form material_id:value or boundary_id:value. If one of this parameters needs to be used for optimization, it can be done using the following format to define the variable:
The program will automatically replace the value in the list with the appropriate material_id
SIM::DakotaApplication::DakotaApplication | ( | boost::shared_ptr< Dakota::ProblemDescDB > | global_problem_db, |
std::string | parameter_file | ||
) |
Constructor for an object of this class.
Optimization details are read from the input_file, the optimization_interface is used for the function evaluations.
void SIM::DakotaApplication::assign_interface | ( | Dakota::DirectApplicInterface * | optimization_interface | ) |
Assign the direct interface to the simulation code which is of type Dakota::DirectApplicInterface.
http://dakota.sandia.gov/docs/dakota/5.2/html-dev/DakLibrary.html For an example, see SIM::DakotaDirectInterface or SIM::DakotaLeastSquaresInterface
void SIM::DakotaApplication::declare_parameters | ( | ParameterHandler & | param | ) |
Declare all parameters that are needed for optimization.
These parameters are read in from the Opt_data file.
|
private |
Exception thrown when a user defined design variables is not found among available FCST design variables.
|
private |
Read in parameters for the parameter handler in order to initialize data.These parameters are read in from the Opt_data file.
void SIM::DakotaApplication::manage_inputs | ( | ParameterHandler & | param | ) |
Declares & Initializes all parameters, creates Dakota input file.
Interfaces with Dakota to parse the input file, and populate the Dakota Problem Database with variables and constraints.
Dakota::RealVector SIM::DakotaApplication::resp_results | ( | ) |
Function retrieves and returns the optimum response values.
void SIM::DakotaApplication::run | ( | ) |
This function will first lock the problem_db preventing anychanges to the data.
It will then select the strategy for optimizating (E.g. SingleMethideStrategy,HybridStategy...) and Run the optimization using the DakotaDirectInterface using the data which you have assigned by using assign_interface()
void SIM::DakotaApplication::synchronize_variables | ( | unsigned int & | n_dvar, |
unsigned int & | n_resp, | ||
std::vector< std::string > & | name_design_var, | ||
std::vector< std::string > & | name_responses | ||
) |
This function is used to remotely axcess the number and name of design_variables, number and name of responses, as they are private variables.
|
inline |
Get boolean NLS flag.
If this is set true in the text file the optimizating will use the DakotaLeastSquaresInterface routine found in dakota_direct_interface. NLS_flag is set using the opt_app_ .prm file.
Additional inputs to consider in .prm file when using NLS.
References NLS_flag.
Dakota::RealVector SIM::DakotaApplication::vars_results | ( | ) |
Function retrieves and returns the final optimum design variables.
|
private |
Write Dakota input file for hybrid optimization strategy.
|
private |
Member function to write Dakota input file based on method selection.
|
private |
Write Dakota input file for multi-start optimization strategy.
|
private |
Write Dakota input file for pareto optimization strategy.
|
private |
Member function to write Dakota input file based on specified response variables.
|
private |
Write Dakota input file for single optimization strategy.
|
private |
Member function to write Dakota input file based on specified variables.
|
private |
Analytical Gradients option for Dakota optimization.
|
private |
NL2SOL absolute convergence tolerance.
|
private |
Member that stores the name of all possible design variables that have been defined in FCST.
|
private |
Centering parameter for the opt++ strategy.
|
private |
Optimization constraint tolerance.
|
private |
|
private |
Optimization convergence tolerance.
|
private |
JEGA - convergence_type.
|
private |
|
private |
JEGA - crossover_type.
|
private |
Name of the Dakota input file.
|
private |
Dakota array of design variable names.
|
private |
Dakota version used.
|
private |
Dakota vector of equality constraints.
|
private |
Hybrid Optimization method specific function evaluation maximums.
|
private |
NL2SOL Parameter false convergence tolerance.
|
private |
NCSU parameter.
|
private |
JEGA - fitness_type.
|
private |
|
private |
OPT++ gradient tolerance.
|
private |
Analytical Hessian Option for Dakota optimization.
|
private |
Hybrid Optimization method names.
|
private |
Hybrid Optimization strategy - sequential, etc.
|
private |
Optimization SCOLIB (COLINY) - COBYLA (Constrained Optimization By Linear Appoximations) [coliny_cobyla], APPS [asynch_pattern_search], and coliny_pattern_search .
These are the variables required when running the COBYLA optimization methods. Below illustrates how these methods can be implemented into the "opt_app_***_***.prm" files.
If using "coliny_pattern_search", "coliny_solis_wets", OR "asynch_pattern_search" these are the variables available.
|
private |
JEGA - initialization_type.
|
private |
Name of the analysis input file.
|
private |
Dakota vector of design variable initial points.
|
private |
Hybrid Optimization method specific iteration maximums.
|
private |
Dakota vector of design variable lower bounds.
|
private |
Dakota vector of nonlinear constraint lower bounds.
|
private |
NL2SOL Parameter storing the number of terms.
|
private |
Maximum number of optimization function evaluations.
|
private |
Maximum number of optimization iterations.
|
private |
OPT++ merit function.
|
private |
Hybrid Optimization method string identifiers.
|
private |
NCSU parameter.
|
private |
Hybrid Optimization model string identifiers.
|
private |
Optimization - OPT++ Search method .
Optimization JEGA (John Eddy Genetic Algorithm) - "moga" & "soga" The JEGA library contains two global optimization methods: MOGA - Multi-objective Genetic Algorithm SOGA - Single-objective Genetic Algorithm
An example of implementing these algorithms into the "opt_app_***_***.prm" file can be seen below. When using either there are some variables that are common to both "moga" & "soga"
Those which are uncommon to "moga" & "soga" are:
/ *** JEGA - mutation_type
|
private |
Total number of constraints = n_nl_con + n_eq_con.
|
private |
Number of design variables.
This variable is set in the "opt_app_***_***.prm" file. Each design variable requires:
|
private |
Number of equality constraints.
|
private |
Numerical Gradients type for Dakota optimization.
There are two types of "Numerical gradient types". -forward -central These are declared in DakotaApplication::declare_parameters()
|
private |
Numerical Gradients option for Dakota optimization.
|
private |
Number of Hybrid Optimization methods.
|
private |
Number of non-linear constraints.
|
private |
Number of objective functions.
|
private |
Number of responses = n_obj + n_con.
|
private |
Member that stores the name of the design variables.
|
private |
Member that stores the name of the responses, i.e.
objectives and constraints.
|
private |
Experimental data file for NLS parameter estimation - Operating Conditions & output.
|
private |
Nonlinear Least-Squares Parameter Estimation Flag.
Referenced by use_NLS().
|
private |
JEGA - Number of Offspring and Parent.
|
private |
|
private |
Optimization Method - OPT++, NL2SOL, multidim_parameter_study, etc.
|
private |
Optimization Strategy - Single, Pareto, Multi start point, Hybrid.
|
private |
Parameter Study Partition vector Set number of partitions for multidim_parameter_study NOTE: Evaluated at n+1 points between lower and upper bound.
|
private |
Pointer to the problem description data base.
|
private |
Number of random weights for generating objective function pareto set.
|
private |
Number of random weights for generating objective function pareto set.
|
private |
JEGA - replacement_type.
|
private |
|
private |
Dakota vector of design variable scales.
|
private |
Dakota vector of design variable scale methods.
|
private |
Used to activate scaling.
It will use the values in scale and scale_method in order to scale the design variables (used by NLS and OPT+ methods). Implementation of this can be seen above in number of design variables.
|
private |
DAKOTA strategy.
From DAKOTA reference guide: "The Strategy class is the base class for the class hierarchy providing the top level control in DAKOTA. The strategy is responsible for creating and managing iterators and models. For memory efficiency and enhanced polymorphism, the strategy hierarchy employs the "letter/envelope idiom" (see Coplien "Advanced C++", p. 133), for which the base class (Strategy) serves as the envelope and one of the derived classes (selected in Strategy::get_strategy()) serves as the letter."
For more information see: http://dakota.sandia.gov/licensing/votd/html-dev/
|
private |
NCSU parameter.
|
private |
Dakota vector of design variable step sizes for numerical gradients.
|
private |
OPT++ steplength.
|
private |
|
private |
Hybrid Optimization method specific tolerances.
|
private |
NL2SOL initial trust radius.
|
private |
Dakota vector of design variable upper bounds.
|
private |
Dakota vector of nonlinear constraint upper bounds.
|
private |
Flag to use an input file from Dakota Specify interface, method, and strategy options, number of variables, number of responses/constrants.
Identifier strings must be specified as method_0, and sequentially (i.e. method_1, method_2, etc.) for hybrid method. Do not specify variable string identifiers, bound values, constraint values, etc. Variable bounds, responses and constraints set in parameter file
|
private |
NCSU parameter.
|
private |
NL2SOL Parameter convergence tolerance.