Iterator Class Reference

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

Inheritance diagram for Iterator:

Analyzer Minimizer NonD PStudyDACE LeastSq Optimizer SurrBasedMinimizer NonDEvidence NonDExpansion NonDIntegration NonDReliability NonDSampling DDACEDesignCompExp FSUDesignCompExp ParamStudy PSUADEDesignCompExp 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 run ()
 run the iterator; portion of run_iterator()
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 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 const VariablesArrayvariables_array_results () const
 only be used if returns_multiple_points() returns true.
virtual const ResponseArrayresponse_array_results () const
 only be used if returns_multiple_points() returns true.
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 (ostream &s)
 print the final iterator results
virtual void sampling_reset (int min_samples, int rec_samples, bool all_data_flag, bool stats_flag)
 reset sampling iterator
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 VariablesArrayall_variables () const
 return the complete set of evaluated variables
virtual const ResponseArrayall_responses () const
 return the complete set of computed responses
void pre_run (ostream &s)
 utility function to verbosely perform common operations prior to run()
void pre_run ()
 utility function to quietly perform common operations prior to run()
void run_iterator (ostream &s)
 utility function to automate pre_run()/run()/post_run() verbosely
void run_iterator ()
 utility function to automate pre_run()/run()/post_run() quietly
void post_run (ostream &s)
 utility function to verbosely perform common operations following run()
void post_run ()
 utility function to quietly perform common operations following run()
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)
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
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
void variable_mappings (const SizetArray &c_index1, const SizetArray &d_index1, const ShortArray &c_target2, const ShortArray &d_target2)
 set primaryACVMapIndices, primaryADVMapIndices, secondaryACVMapTargets
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 void derived_pre_run ()
 portions of pre_run specific to derived iterators
virtual void derived_post_run ()
 portions of post_run specific to derived iterators
virtual const VariablesArrayinitial_points () const
 be meaningful after a call to initial_points mutator.
Real phi (const Real &beta)
 Standard normal density function.
Real Phi (const Real &beta)
 Standard normal cumulative distribution function.

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 numDiscreteVars
 number of active discrete vars.
ActiveSet activeSet
 tracks the response data requirements on each function evaluation
bool subIteratorFlag
 (NestedModel::subIterator or DataFitSurrModel::daceIterator)
SizetArray primaryACVarMapIndices
 from higher level iteration
SizetArray primaryADVarMapIndices
 higher level iteration
ShortArray secondaryACVarMapTargets
 from higher level iteration
ShortArray secondaryADVarMapTargets
 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 asynchFlag
 copy of the model's asynchronous evaluation flag

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.

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.

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.


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 run (  )  [virtual]

run the iterator; portion of run_iterator()

Iterator supports a construct/pre-run/run/post-run/destruct progression. This function is the virtual run function for the iterator class hierarchy. All derived classes need to redefine it.

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

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 ( 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 post_run().

Reimplemented in LeastSq, Optimizer, PStudyDACE, NonDEvidence, NonDExpansion, NonDGlobalReliability, NonDIncremLHSSampling, NonDLHSSampling, NonDLocalReliability, NonDPolynomialChaos, and SurrBasedMinimizer.

void pre_run ( ostream &  s  ) 

utility function to verbosely perform common operations prior to run()

Iterator supports a construct/pre-run/run/post-run/destruct progression. This function is one form of the overloaded pre-run function. This form accepts an ostream and executes verbosely. It is used for standard stand-alone iterator executions. This function is not virtual: derived portions are defined in derived_pre_run().

void pre_run (  ) 

utility function to quietly perform common operations prior to run()

Iterator supports a construct/pre-run/run/post-run/destruct progression. This function is one form of the overloaded pre-run function. This form does not accept an ostream and executes quietly. It is commonly used in sub-iterator executions. This function is not virtual: derived portions are defined in derived_pre_run().

void run_iterator ( ostream &  s  ) 

utility function to automate pre_run()/run()/post_run() verbosely

Iterator supports a construct/pre-run/run/post-run/destruct progression. This non-virtual function is one form of the overloaded run_iterator function which automates the pre-run/run/post-run portions of the progression. This form accepts an ostream and executes verbosely.

void run_iterator (  ) 

utility function to automate pre_run()/run()/post_run() quietly

Iterator supports a construct/pre-run/run/post-run/destruct progression. This non-virtual function is one form of the overloaded run_iterator function which automates the pre-run/run/post-run portions of the progression. This form does not accept an ostream and executes quietly.

void post_run ( ostream &  s  ) 

utility function to verbosely perform common operations following run()

Iterator supports a construct/pre-run/run/post-run/destruct progression. This function is one form of the overloaded post-run function. This form accepts an ostream and executes verbosely. This function is not virtual: derived portions are defined in derived_post_run().

void post_run (  ) 

utility function to quietly perform common operations following run()

Iterator supports a construct/pre-run/run/post-run/destruct progression. This function is one form of the overloaded post-run function. This form does not accept an ostream and executes quietly. This function is not virtual: derived portions are defined in derived_post_run().

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:

void derived_pre_run (  )  [protected, virtual]

portions of pre_run specific to derived iterators

Iterator supports a construct/pre-run/run/post-run/destruct progression. This function is the virtual derived class portion of pre_run(). Redefinition by derived classes is optional.

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

void derived_post_run (  )  [protected, virtual]

portions of post_run specific to derived iterators

Iterator supports a construct/pre-run/run/post-run/destruct progression. This function is the virtual derived class portion of post_run(). Redefinition by derived classes is optional.

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

Real Phi ( const Real &  beta  )  [inline, protected]

Standard normal cumulative distribution function.

returns a probability < 0.5 for negative beta and a probability > 0.5 for positive beta.

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 Nov 5 19:54:06 2008 for DAKOTA by  doxygen 1.5.1