Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Iterator Class Reference

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

Inheritance diagram for Iterator:

Analyzer Minimizer NonD PStudyDACE LeastSq Optimizer NonDReliability NonDSampling DDACEDesignCompExp FSUDesignCompExp ParamStudy NL2SOLLeastSq NLSSOLLeastSq SNLLLeastSq CONMINOptimizer DOTOptimizer JEGAOptimizer NPSOLOptimizer rSQPOptimizer SGOPTOptimizer SNLLOptimizer List of all members.

Public Member Functions

 Iterator ()
 default constructor
 Iterator (Model &model)
 standard constructor for envelope
 Iterator (const Iterator &iterator)
 copy constructor
virtual ~Iterator ()
 destructor
Iterator operator= (const Iterator &iterator)
 assignment operator
virtual void run_iterator ()
 run the iterator
virtual const Variablesiterator_variable_results () const
 return the final iterator solution (variables)
virtual const Responseiterator_response_results () const
 return the final iterator solution (response)
virtual void print_iterator_results (ostream &s) const
 print the final iterator results
virtual void multi_objective_weights (const RealVector &multi_obj_wts)
 set the relative weightings for multiple objective functions. Used by ConcurrentStrategy for Pareto set optimization.
virtual void sampling_reset (int min_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 RealVectorArrayall_c_variables () const
 return the complete set of evaluated continuous variables
virtual const ResponseArrayall_responses () const
 return the complete set of computed responses
virtual const RealVectorArrayall_fn_responses () const
 return the complete set of computed function responses
void assign_rep (Iterator *iterator_rep)
 replaces existing letter with a new one
void user_defined_model (const Model &the_model)
 set the model
Model user_defined_model () const
 return the model
const Stringmethod_name () const
 return the method name
const int & maximum_concurrency () const
 return the maximum concurrency supported by the iterator
void active_set_vector (const IntArray &asv)
 set the default active set vector (for use with iterators that employ evaluate_parameter_sets())
void iterator_response_results_asv (const IntArray &asv)
 set the requested data for the final iterator response results
void sub_iterator_flag (bool si_flag)
 set subIteratorFlag
bool is_null () const
 function to check iteratorRep (does this envelope contain a letter?)

Protected Member Functions

 Iterator (BaseConstructor, Model &model)
 constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the derived class constructors - Coplien, p. 139)
 Iterator (NoDBBaseConstructor, Model &model)
 base class for iterator classes constructed on the fly (no DB queries)

Protected Attributes

Model userDefinedModel
 shallow copy (shared rep) of the model passed into the constructor. A class member reference is not needed in this case due to the presence of representation sharing in Models.
const ProblemDescDBprobDescDB
 class member reference to the problem description database
String methodName
 name of the iterator (the user's method spec)
int maxIterations
 maximum number of iterations for the iterator
int maxFunctionEvals
 maximum number of fn evaluations for the iterator
int numFunctions
 number of response functions
int maxConcurrency
 maximum coarse-grained concurrency
int numContinuousVars
 number of active continuous vars.
int numDiscreteVars
 number of active discrete vars.
int numVars
 total number of vars. (active and inactive)
IntArray activeSetVector
 this vector tracks the data requirements for the response functions. It uses a 0 value for inactive functions and, for active functions, sums 1 for value, 2 for gradient, and 4 for Hessian.
IntArray finalResultsASV
 this active set vector specifies the required final results to be returned by iterator_response_results()
bool subIteratorFlag
 flag indicating if this Iterator is a sub-iterator (NestedModel::subIterator) or SurrLayeredModel::daceIterator).
String gradientType
 type of gradient data: analytic, numerical, mixed, or none
String intervalType
 type of numerical gradient interval: central or forward
String methodSource
 source of numerical gradient routine: dakota or vendor
String hessianType
 type of Hessian data: analytic, numerical, quasi, mixed, or none
Real fdGradStepSize
 relative finite difference step size for numerical gradients
Real fdHessByGradStepSize
 relative finite difference step size for numerical Hessians estimated using first-order differences of gradients
Real fdHessByFnStepSize
 relative finite difference step size for numerical Hessians estimated using second-order differences of function values
bool silentOutput
 flag for really quiet (silent) algorithm output
bool quietOutput
 flag for quiet algorithm output
bool verboseOutput
 flag for verbose algorithm output
bool debugOutput
 flag for really verbose (debug) algorithm 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.

Private Attributes

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 constructor for envelope

Used in iterator instantiations within strategy constructors. Envelope constructor only needs to extract enough data to properly execute get_iterator, since Iterator(BaseConstructor, model) builds the actual base class data inherited by the derived iterators.

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]
 

constructor initializes the base class part of letter classes (BaseConstructor overloading avoids infinite recursion in the 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]
 

base class for iterator classes constructed on the fly (no DB queries)

This constructor also builds base class data for inherited iterators. However, it is used for on-the-fly instantiations for which DB queries cannot be used (e.g., ApproximationInterface instantiation of DDACEDesignCompExp or NonDSampling, NonDReliability usage of optimizers, etc.). Therefore it only sets attributes taken from the incoming model.


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

run the iterator

This function is the primary run function for the iterator class hierarchy. All derived classes need to redefine it.

Reimplemented in LeastSq, NonD, Optimizer, and PStudyDACE.

void assign_rep Iterator iterator_rep  ) 
 

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 is modeled after get_iterator() in that it does not increment the referenceCount for the new iteratorRep.

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.


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]
 

relative finite difference step size for numerical Hessians estimated 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]
 

relative finite difference step size for numerical Hessians estimated 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 Tue Jan 4 14:47:39 2005 for DAKOTA by doxygen 1.3.8