MoochoPack : Framework for Large-Scale Optimization Algorithms Version of the Day
MoochoPack_DecompositionSystemStateStepBuilderStd.hpp
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef DECOMPOSITION_SYSTEM_STATE_STEP_BUILDER_STD_H
00043 #define DECOMPOSITION_SYSTEM_STATE_STEP_BUILDER_STD_H
00044 
00045 #include "MoochoPack_Types.hpp"
00046 #ifndef MOOCHO_NO_BASIS_PERM_DIRECT_SOLVERS
00047 #include "AbstractLinAlgPack_BasisSystemPerm.hpp"
00048 #endif
00049 #include "MoochoPack_NewDecompositionSelection_Strategy.hpp"
00050 
00051 namespace OptionsFromStreamPack {
00052   class OptionsFromStream;
00053 }
00054 
00055 namespace MoochoPack {
00056 
00065 class DecompositionSystemStateStepBuilderStd
00066 {
00067 public:
00068   
00071 
00073   enum ENullSpaceMatrixType {
00074     NULL_SPACE_MATRIX_AUTO, NULL_SPACE_MATRIX_EXPLICIT
00075     , NULL_SPACE_MATRIX_IMPLICIT };
00077   enum ERangeSpaceMatrixType {
00078     RANGE_SPACE_MATRIX_AUTO, RANGE_SPACE_MATRIX_COORDINATE
00079     , RANGE_SPACE_MATRIX_ORTHOGONAL };
00080 
00082 
00085 
00087   struct SOptionValues {
00088     // Constructor (sets default values)
00089     SOptionValues();
00090     ENullSpaceMatrixType  null_space_matrix_type_;
00091     ERangeSpaceMatrixType range_space_matrix_type_;
00092     int           max_dof_quasi_newton_dense_;    // If < 0, don't change default
00093   };
00094 
00096   
00098   typedef Teuchos::RCP<
00099     const OptionsFromStreamPack::OptionsFromStream>             options_ptr_t;
00100 
00102   DecompositionSystemStateStepBuilderStd();
00103 
00112   void set_options( const options_ptr_t& options );
00114   const options_ptr_t& get_options() const;
00123   void process_nlp_and_options(
00124     std::ostream          *trase_out
00125     ,NLP                  &nlp
00126     ,NLPFirstOrder        **nlp_foi
00127     ,NLPSecondOrder       **nlp_soi
00128     ,NLPDirect            **nlp_fod
00129     ,bool                 *tailored_approach
00130     );
00135   void create_decomp_sys(
00136     std::ostream                                       *trase_out
00137     ,NLP                                               &nlp
00138     ,NLPFirstOrder                                     *nlp_foi
00139     ,NLPSecondOrder                                    *nlp_soi
00140     ,NLPDirect                                         *nlp_fod
00141     ,bool                                              tailored_approach
00142     ,Teuchos::RCP<DecompositionSystem>         *decomp_sys
00143     );
00148   void add_iter_quantities(
00149     std::ostream                                           *trase_out
00150     ,NLP                                                   &nlp
00151     ,NLPFirstOrder                                         *nlp_foi
00152     ,NLPSecondOrder                                        *nlp_soi
00153     ,NLPDirect                                             *nlp_fod
00154     ,bool                                                  tailored_approach
00155     ,const Teuchos::RCP<DecompositionSystem>       &decomp_sys
00156     ,const Teuchos::RCP<NLPAlgoState>              &state
00157     );
00158 
00163   void create_eval_new_point(
00164     std::ostream                                                 *trase_out
00165     ,NLP                                                         &nlp
00166     ,NLPFirstOrder                                               *nlp_foi
00167     ,NLPSecondOrder                                              *nlp_soi
00168     ,NLPDirect                                                   *nlp_fod
00169     ,bool                                                        tailored_approach
00170     ,const Teuchos::RCP<DecompositionSystem>             &decomp_sys
00171     ,Teuchos::RCP<IterationPack::AlgorithmStep>          *eval_new_point_step
00172     ,Teuchos::RCP<CalcFiniteDiffProd>                    *calc_fd_prod
00173     ,Teuchos::RCP<VariableBoundsTester>                  *bounds_tester
00174     ,Teuchos::RCP<NewDecompositionSelection_Strategy>    *new_decomp_selection_strategy
00175     );
00176 
00179   SOptionValues& current_option_values();
00180 
00181 private:
00182   
00183   // ///////////////////////////
00184   // Private data members
00185 
00187   options_ptr_t   options_;
00188 
00190   SOptionValues       uov_; // options set by user
00191   SOptionValues       cov_; // current option values actually used
00192 
00193 #ifndef MOOCHO_NO_BASIS_PERM_DIRECT_SOLVERS
00194   Teuchos::RCP<BasisSystemPerm> basis_sys_perm_;
00195 #endif
00196 
00197   // /////////////////////////
00198   // Private member functions
00199 
00201   static void readin_options(
00202     const OptionsFromStreamPack::OptionsFromStream& options
00203     ,SOptionValues *option_values, std::ostream* trase_out
00204     );
00205 
00207   static void set_default_options(
00208     const SOptionValues& user_option_values
00209     ,SOptionValues *current_option_values
00210     ,std::ostream* trase_out
00211     );
00212 
00213 }; // end class DecompositionSystemStateStepBuilderStd
00214 
00215 // ///////////////////////////////
00216 // Inline members
00217 
00218 inline
00219 DecompositionSystemStateStepBuilderStd::SOptionValues&
00220 DecompositionSystemStateStepBuilderStd::current_option_values()
00221 {
00222   return cov_;
00223 }
00224 
00225 }  // end namespace MoochoPack
00226 
00227 #endif // DECOMPOSITION_SYSTEM_STATE_STEP_BUILDER_STD_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends