Iterator Class Reference

Base class for the iterator class hierarchy. More...

Inheritance diagram for Iterator:

Analyzer Minimizer NonD PStudyDACE Verification LeastSq Optimizer SurrBasedMinimizer NonDCalibration NonDExpansion NonDIntegration NonDInterval NonDReliability NonDSampling DDACEDesignCompExp FSUDesignCompExp ParamStudy PSUADEDesignCompExp RichExtrapVerification NL2SOLLeastSq NLSSOLLeastSq SNLLLeastSq APPSOptimizer COLINOptimizer CONMINOptimizer DOTOptimizer JEGAOptimizer NCSUOptimizer NLPQLPOptimizer NPSOLOptimizer SNLLOptimizer EffGlobalMinimizer SurrBasedGlobalMinimizer SurrBasedLocalMinimizer List of all members.

Public Member Functions

 Iterator ()
 default constructor
 Iterator (Model &model)
 standard envelope constructor
 Iterator (const String &method_name, Model &model)
 alternate envelope constructor for instantiations by name
 Iterator (const Iterator &iterator)
 copy constructor
virtual ~Iterator ()
 destructor
Iterator operator= (const Iterator &iterator)
 assignment operator
virtual void initialize_run ()
 typically memory initialization; setting of instance pointers
virtual void pre_run ()
 which can generate all Variables (parameter sets) a priori
virtual void run ()
 and may include pre/post steps in lieu of separate pre/post
virtual void post_run (std::ostream &s)
 perform final analysis phase in a standalone way
virtual void finalize_run ()
 deallocation and resetting of instance pointers
virtual void reset ()
 restore initial state for repeated sub-iterator executions
virtual const Variablesvariables_results () const
 return a single final iterator solution (variables)
virtual const Responseresponse_results () const
 return a single final iterator solution (response)
virtual const VariablesArray & variables_array_results ()
 only be used if returns_multiple_points() returns true.
virtual const ResponseArray & response_array_results ()
 only be used if returns_multiple_points() returns true.
virtual bool accepts_multiple_points () const
 return is false. Override to return true if appropriate.
virtual bool returns_multiple_points () const
 return is false. Override to return true if appropriate.
virtual void initial_points (const VariablesArray &pts)
 only be used if accepts_multiple_points() returns true.
virtual void response_results_active_set (const ActiveSet &set)
 set the requested data for the final iterator response results
virtual void initialize_graphics (bool graph_2d, bool tabular_data, const String &tabular_file)
 initialize the 2D graphics window and the tabular graphics data
virtual void print_results (std::ostream &s)
 print the final iterator results
virtual int num_samples () const
 get the current number of samples
virtual void sampling_reset (int min_samples, bool all_data_flag, bool stats_flag)
 reset sampling iterator to use at least min_samples
virtual const Stringsampling_scheme () const
 return sampling name
virtual String uses_method () const
 return name of any enabling iterator used by this iterator
virtual void method_recourse ()
 perform a method switch, if possible, due to a detected conflict
virtual const VariablesArray & all_variables ()
 return the complete set of evaluated variables
virtual const RealMatrix & all_samples ()
 return the complete set of evaluated samples
virtual const ResponseArray & all_responses () const
 return the complete set of computed responses
virtual bool compact_mode () const
 returns Analyzer::compactMode
void run_iterator (std::ostream &s)
 orchestrate initialize/pre/run/post/finalize phases
void assign_rep (Iterator *iterator_rep, bool ref_count_incr=true)
 replaces existing letter with a new one
ProblemDescDBproblem_description_db () const
 return the problem description database (probDescDB)
const Stringmethod_name () const
 return the method name
const Stringmethod_id () const
 return the method identifier (idMethod)
short output_level () const
 return the method output level (outputLevel)
void summary_output (bool summary_output_flag)
 Set summary output control; true enables evaluation/results summary.
int maximum_concurrency () const
 return the maximum concurrency supported by the iterator
void maximum_concurrency (int max_conc)
 set the maximum concurrency supported by the iterator
size_t num_final_solutions () const
 return the number of solutions to retain in best variables/response arrays
void num_final_solutions (size_t num_final)
 set the number of solutions to retain in best variables/response arrays
void active_set (const ActiveSet &set)
 employ evaluate_parameter_sets())
const ActiveSetactive_set () const
 employ evaluate_parameter_sets())
void sub_iterator_flag (bool si_flag)
 set subIteratorFlag (and update summaryOutputFlag if needed)
void active_variable_mappings (const SizetArray &c_index1, const SizetArray &di_index1, const SizetArray &dr_index1, const ShortArray &c_target2, const ShortArray &di_target2, const ShortArray &dr_target2)
 set primaryA{CV,DIV,DRV}MapIndices, secondaryA{CV,DIV,DRV}MapTargets
bool is_null () const
 function to check iteratorRep (does this envelope contain a letter?)
Iteratoriterator_rep () const
 that are not mapped to the top Iterator level

Protected Member Functions

 Iterator (BaseConstructor, Model &model)
 derived class constructors - Coplien, p. 139)
 Iterator (NoDBBaseConstructor, Model &model)
 alternate constructor for base iterator classes constructed on the fly
 Iterator (NoDBBaseConstructor)
 alternate constructor for base iterator classes constructed on the fly
virtual const VariablesArray & initial_points () const
 be meaningful after a call to initial_points mutator.

Protected Attributes

Model iteratedModel
 or a thin RecastModel wrapped around it
ProblemDescDBprobDescDB
 class member reference to the problem description database
String methodName
 name of the iterator (the user's method spec)
Real convergenceTol
 iteration convergence tolerance
int maxIterations
 maximum number of iterations for the iterator
int maxFunctionEvals
 maximum number of fn evaluations for the iterator
int maxConcurrency
 maximum coarse-grained concurrency
size_t numFunctions
 number of response functions
size_t numContinuousVars
 number of active continuous vars
size_t numDiscreteIntVars
 number of active discrete integer vars
size_t numDiscreteRealVars
 number of active discrete real vars
size_t numFinalSolutions
 number of solutions to retain in best variables/response arrays
ActiveSet activeSet
 tracks the response data requirements on each function evaluation
VariablesArray bestVariablesArray
 collection of N best solution variables found during the study
ResponseArray bestResponseArray
 collection of N best solution responses found during the study
bool subIteratorFlag
 (NestedModel::subIterator or DataFitSurrModel::daceIterator)
SizetArray primaryACVarMapIndices
 from higher level iteration
SizetArray primaryADIVarMapIndices
 higher level iteration
SizetArray primaryADRVarMapIndices
 higher level iteration
ShortArray secondaryACVarMapTargets
 from higher level iteration
ShortArray secondaryADIVarMapTargets
 from higher level iteration
ShortArray secondaryADRVarMapTargets
 from higher level iteration
String gradientType
 type of gradient data: analytic, numerical, mixed, or none
String methodSource
 source of numerical gradient routine: dakota or vendor
String intervalType
 type of numerical gradient interval: central or forward
String hessianType
 type of Hessian data: analytic, numerical, quasi, mixed, or none
Real fdGradStepSize
 relative finite difference step size for numerical gradients
Real fdHessByGradStepSize
 using first-order differences of gradients
Real fdHessByFnStepSize
 using second-order differences of function values
short outputLevel
 output verbosity level: {SILENT,QUIET,NORMAL,VERBOSE,DEBUG}_OUTPUT
bool summaryOutputFlag
 sub-iterator use cases
bool asynchFlag
 copy of the model's asynchronous evaluation flag
int writePrecision
 write precision as specified by the user

Private Member Functions

Iteratorget_iterator (Model &model)
 Used by the envelope to instantiate the correct letter class.
Iteratorget_iterator (const String &method_name, Model &model)
 Used by the envelope to instantiate the correct letter class.
virtual void pre_output ()
 convenience function to write variables to file, following pre-run
virtual void post_input ()
 read tabular data for post-run mode

Private Attributes

String idMethod
 method identifier string from the input file
IteratoriteratorRep
 pointer to the letter (initialized only for the envelope)
int referenceCount
 number of objects sharing iteratorRep

Detailed Description

Base class for the iterator class hierarchy.

The Iterator class is the base class for one of the primary class hierarchies in DAKOTA. The iterator hierarchy contains all of the iterative algorithms which use repeated execution of simulations as function evaluations. For memory efficiency and enhanced polymorphism, the iterator hierarchy employs the "letter/envelope idiom" (see Coplien "Advanced C++", p. 133), for which the base class (Iterator) serves as the envelope and one of the derived classes (selected in Iterator::get_iterator()) serves as the letter.


Constructor & Destructor Documentation

Iterator (  ) 

default constructor

The default constructor is used in Vector<Iterator> instantiations and for initialization of Iterator objects contained in Strategy derived classes (see derived class header files). iteratorRep is NULL in this case (a populated problem_db is needed to build a meaningful Iterator object). This makes it necessary to check for NULL pointers in the copy constructor, assignment operator, and destructor.

Iterator ( Model model  ) 

standard envelope constructor

Used in iterator instantiations within strategy constructors. Envelope constructor only needs to extract enough data to properly execute get_iterator(), since letter holds the actual base class data.

Iterator ( const String method_name,
Model model 
)

alternate envelope constructor for instantiations by name

Used in sub-iterator instantiations within iterator constructors. Envelope constructor only needs to extract enough data to properly execute get_iterator(), since letter holds the actual base class data.

Iterator ( const Iterator iterator  ) 

copy constructor

Copy constructor manages sharing of iteratorRep and incrementing of referenceCount.

~Iterator (  )  [virtual]

destructor

Destructor decrements referenceCount and only deletes iteratorRep when referenceCount reaches zero.

Iterator ( BaseConstructor  ,
Model model 
) [protected]

derived class constructors - Coplien, p. 139)

This constructor builds the base class data for all inherited iterators. get_iterator() instantiates a derived class and the derived class selects this base class constructor in its initialization list (to avoid the recursion of the base class constructor calling get_iterator() again). Since the letter IS the representation, its representation pointer is set to NULL (an uninitialized pointer causes problems in ~Iterator).

Iterator ( NoDBBaseConstructor  ,
Model model 
) [protected]

alternate constructor for base iterator classes constructed on the fly

This alternate constructor builds base class data for inherited iterators. It is used for on-the-fly instantiations for which DB queries cannot be used. Therefore it only sets attributes taken from the incoming model. Since there are no iterator-specific redefinitions of maxIterations or numFinalSolutions in NoDBBaseConstructor mode, go ahead and assign default value for all iterators.

Iterator ( NoDBBaseConstructor   )  [protected]

alternate constructor for base iterator classes constructed on the fly

This alternate constructor builds base class data for inherited iterators. It is used for on-the-fly instantiations for which DB queries cannot be used. It has no incoming model, so only sets up a minimal set of defaults. However, its use is preferable to the default constructor, which should remain as minimal as possible. Since there are no iterator-specific redefinitions of maxIterations or numFinalSolutions in NoDBBaseConstructor mode, go ahead and assign default value for all iterators.


Member Function Documentation

Iterator operator= ( const Iterator iterator  ) 

assignment operator

Assignment operator decrements referenceCount for old iteratorRep, assigns new iteratorRep, and increments referenceCount for new iteratorRep.

void initialize_run (  )  [virtual]

typically memory initialization; setting of instance pointers

Perform initialization phases of run sequence, like allocating memory and setting instance pointers. Commonly used in sub-iterator executions. This is a virtual function; when re-implementing, a derived class must call its nearest parent's initialize_run(), typically _before_ performing its own implementation steps.

Reimplemented in CONMINOptimizer, LeastSq, Minimizer, NonD, Optimizer, DOTOptimizer, NLPQLPOptimizer, SNLLLeastSq, and SNLLOptimizer.

void pre_run (  )  [virtual]

which can generate all Variables (parameter sets) a priori

pre-run phase, which a derived iterator may optionally reimplement; when not present, pre-run is likely integrated into the derived run function. This is a virtual function; when re-implementing, a derived class must call its nearest parent's pre_run(), if implemented, typically _before_ performing its own implementation steps.

Reimplemented in DDACEDesignCompExp, FSUDesignCompExp, NonDLHSSampling, ParamStudy, and PSUADEDesignCompExp.

void run (  )  [virtual]

and may include pre/post steps in lieu of separate pre/post

Virtual run function for the iterator class hierarchy. All derived classes need to redefine it.

Reimplemented in LeastSq, NonD, Optimizer, PStudyDACE, Verification, and SurrBasedMinimizer.

void post_run ( std::ostream &  s  )  [virtual]

perform final analysis phase in a standalone way

Post-run phase, which a derived iterator may optionally reimplement; when not present, post-run is likely integrated into run. This is a virtual function; when re-implementing, a derived class must call its nearest parent's post_run(), typically _after_ performing its own implementation steps.

Reimplemented in COLINOptimizer, LeastSq, Optimizer, DDACEDesignCompExp, FSUDesignCompExp, NonDLHSSampling, ParamStudy, PSUADEDesignCompExp, SNLLLeastSq, and SNLLOptimizer.

void finalize_run (  )  [virtual]

deallocation and resetting of instance pointers

Optional: perform finalization phases of run sequence, like deallocating memory and resetting instance pointers. Commonly used in sub-iterator executions. This is a virtual function; when re-implementing, a derived class must call its nearest parent's finalize_run(), typically _after_ performing its own implementation steps.

Reimplemented in LeastSq, Minimizer, NonD, Optimizer, SNLLLeastSq, and SNLLOptimizer.

void initialize_graphics ( bool  graph_2d,
bool  tabular_data,
const String tabular_file 
) [virtual]

initialize the 2D graphics window and the tabular graphics data

This is a convenience function for encapsulating graphics initialization operations. It does not require a strategyRep forward since it is only used by letter objects.

Reimplemented in NonDReliability, and SurrBasedMinimizer.

void print_results ( std::ostream &  s  )  [virtual]

print the final iterator results

This virtual function provides additional iterator-specific final results outputs beyond the function evaluation summary printed in finalize_run().

Reimplemented in Analyzer, LeastSq, Optimizer, PStudyDACE, Verification, NonDExpansion, NonDGlobalReliability, NonDGPMSABayesCalibration, NonDIncremLHSSampling, NonDInterval, NonDLHSSampling, NonDLocalReliability, RichExtrapVerification, and SurrBasedMinimizer.

int num_samples (  )  const [virtual]

get the current number of samples

Return current number of evaluation points. Since the calculation of samples, collocation points, etc. might be costly, provide a default implementation here that backs out from the maxConcurrency. May be (is) overridden by derived classes.

Reimplemented in DDACEDesignCompExp, FSUDesignCompExp, NonDSampling, and PSUADEDesignCompExp.

void run_iterator ( std::ostream &  s  ) 

orchestrate initialize/pre/run/post/finalize phases

Iterator supports a construct/initialize-run/pre-run/run/post-run/finalize-run/destruct progression. This member (non-virtual) function sequences these run phases; it accepts an ostream, but controls verbosity with outputLevel

void assign_rep ( Iterator iterator_rep,
bool  ref_count_incr = true 
)

replaces existing letter with a new one

Similar to the assignment operator, the assign_rep() function decrements referenceCount for the old iteratorRep and assigns the new iteratorRep. It is different in that it is used for publishing derived class letters to existing envelopes, as opposed to sharing representations among multiple envelopes (in particular, assign_rep is passed a letter object and operator= is passed an envelope object). Letter assignment supports two models as governed by ref_count_incr:

Iterator * get_iterator ( Model model  )  [private]

Used by the envelope to instantiate the correct letter class.

Used only by the envelope constructor to initialize iteratorRep to the appropriate derived type, as given by the methodName attribute.

Iterator * get_iterator ( const String method_name,
Model model 
) [private]

Used by the envelope to instantiate the correct letter class.

Used only by the envelope constructor to initialize iteratorRep to the appropriate derived type, as given by the passed method_name.


Member Data Documentation

Real fdGradStepSize [protected]

relative finite difference step size for numerical gradients

A scalar value (instead of the vector fd_gradient_step_size spec) is used within the iterator hierarchy since this attribute is only used to publish a step size to vendor numerical gradient algorithms.

Real fdHessByGradStepSize [protected]

using first-order differences of gradients

A scalar value (instead of the vector fd_hessian_step_size spec) is used within the iterator hierarchy since this attribute is only used to publish a step size to vendor numerical Hessian algorithms.

Real fdHessByFnStepSize [protected]

using second-order differences of function values

A scalar value (instead of the vector fd_hessian_step_size spec) is used within the iterator hierarchy since this attribute is only used to publish a step size to vendor numerical Hessian algorithms.


The documentation for this class was generated from the following files:
Generated on Wed Dec 22 20:00:09 2010 for DAKOTA by  doxygen 1.5.1