MoochoPack : Framework for Large-Scale Optimization Algorithms  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MoochoPack_DecompositionSystemStateStepBuilderStd.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef DECOMPOSITION_SYSTEM_STATE_STEP_BUILDER_STD_H
43 #define DECOMPOSITION_SYSTEM_STATE_STEP_BUILDER_STD_H
44 
45 #include "MoochoPack_Types.hpp"
46 #ifndef MOOCHO_NO_BASIS_PERM_DIRECT_SOLVERS
47 #include "AbstractLinAlgPack_BasisSystemPerm.hpp"
48 #endif
49 #include "MoochoPack_NewDecompositionSelection_Strategy.hpp"
50 
51 namespace OptionsFromStreamPack {
52  class OptionsFromStream;
53 }
54 
55 namespace MoochoPack {
56 
66 {
67 public:
68 
71 
74  NULL_SPACE_MATRIX_AUTO, NULL_SPACE_MATRIX_EXPLICIT
75  , NULL_SPACE_MATRIX_IMPLICIT };
78  RANGE_SPACE_MATRIX_AUTO, RANGE_SPACE_MATRIX_COORDINATE
79  , RANGE_SPACE_MATRIX_ORTHOGONAL };
80 
82 
85 
87  struct SOptionValues {
88  // Constructor (sets default values)
89  SOptionValues();
90  ENullSpaceMatrixType null_space_matrix_type_;
91  ERangeSpaceMatrixType range_space_matrix_type_;
92  int max_dof_quasi_newton_dense_; // If < 0, don't change default
93  };
94 
96 
98  typedef Teuchos::RCP<
100 
103 
112  void set_options( const options_ptr_t& options );
114  const options_ptr_t& get_options() const;
124  std::ostream *trase_out
125  ,NLP &nlp
126  ,NLPFirstOrder **nlp_foi
127  ,NLPSecondOrder **nlp_soi
128  ,NLPDirect **nlp_fod
129  ,bool *tailored_approach
130  );
135  void create_decomp_sys(
136  std::ostream *trase_out
137  ,NLP &nlp
138  ,NLPFirstOrder *nlp_foi
139  ,NLPSecondOrder *nlp_soi
140  ,NLPDirect *nlp_fod
141  ,bool tailored_approach
143  );
148  void add_iter_quantities(
149  std::ostream *trase_out
150  ,NLP &nlp
151  ,NLPFirstOrder *nlp_foi
152  ,NLPSecondOrder *nlp_soi
153  ,NLPDirect *nlp_fod
154  ,bool tailored_approach
155  ,const Teuchos::RCP<DecompositionSystem> &decomp_sys
156  ,const Teuchos::RCP<NLPAlgoState> &state
157  );
158 
164  std::ostream *trase_out
165  ,NLP &nlp
166  ,NLPFirstOrder *nlp_foi
167  ,NLPSecondOrder *nlp_soi
168  ,NLPDirect *nlp_fod
169  ,bool tailored_approach
170  ,const Teuchos::RCP<DecompositionSystem> &decomp_sys
171  ,Teuchos::RCP<IterationPack::AlgorithmStep> *eval_new_point_step
172  ,Teuchos::RCP<CalcFiniteDiffProd> *calc_fd_prod
173  ,Teuchos::RCP<VariableBoundsTester> *bounds_tester
174  ,Teuchos::RCP<NewDecompositionSelection_Strategy> *new_decomp_selection_strategy
175  );
176 
180 
181 private:
182 
183  // ///////////////////////////
184  // Private data members
185 
187  options_ptr_t options_;
188 
190  SOptionValues uov_; // options set by user
191  SOptionValues cov_; // current option values actually used
192 
193 #ifndef MOOCHO_NO_BASIS_PERM_DIRECT_SOLVERS
194  Teuchos::RCP<BasisSystemPerm> basis_sys_perm_;
195 #endif
196 
197  // /////////////////////////
198  // Private member functions
199 
201  static void readin_options(
203  ,SOptionValues *option_values, std::ostream* trase_out
204  );
205 
207  static void set_default_options(
208  const SOptionValues& user_option_values
210  ,std::ostream* trase_out
211  );
212 
213 }; // end class DecompositionSystemStateStepBuilderStd
214 
215 // ///////////////////////////////
216 // Inline members
217 
218 inline
221 {
222  return cov_;
223 }
224 
225 } // end namespace MoochoPack
226 
227 #endif // DECOMPOSITION_SYSTEM_STATE_STEP_BUILDER_STD_H
Standard builder object for creating DecompositionSystem, EvalNewPoint Step and other objects and set...
void process_nlp_and_options(std::ostream *trase_out, NLP &nlp, NLPFirstOrder **nlp_foi, NLPSecondOrder **nlp_soi, NLPDirect **nlp_fod, bool *tailored_approach)
Process the NLP and process the options passed in from set_options(). Postconditions: ...
void create_eval_new_point(std::ostream *trase_out, NLP &nlp, NLPFirstOrder *nlp_foi, NLPSecondOrder *nlp_soi, NLPDirect *nlp_fod, bool tailored_approach, const Teuchos::RCP< DecompositionSystem > &decomp_sys, Teuchos::RCP< IterationPack::AlgorithmStep > *eval_new_point_step, Teuchos::RCP< CalcFiniteDiffProd > *calc_fd_prod, Teuchos::RCP< VariableBoundsTester > *bounds_tester, Teuchos::RCP< NewDecompositionSelection_Strategy > *new_decomp_selection_strategy)
Create the EvalNewPoint step object and allocated objects.
SOptionValues & current_option_values()
Return the current option values being used.
void add_iter_quantities(std::ostream *trase_out, NLP &nlp, NLPFirstOrder *nlp_foi, NLPSecondOrder *nlp_soi, NLPDirect *nlp_fod, bool tailored_approach, const Teuchos::RCP< DecompositionSystem > &decomp_sys, const Teuchos::RCP< NLPAlgoState > &state)
Add the common iteration quantities to the state object.
void create_decomp_sys(std::ostream *trase_out, NLP &nlp, NLPFirstOrder *nlp_foi, NLPSecondOrder *nlp_soi, NLPDirect *nlp_fod, bool tailored_approach, Teuchos::RCP< DecompositionSystem > *decomp_sys)
Create the decomposition system object.
Teuchos::RCP< const OptionsFromStreamPack::OptionsFromStream > options_ptr_t
void set_options(const options_ptr_t &options)
Set the options that will be used to configure the algorithmic objects.