Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MinimizerOptions.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file core/optimization/MinimizerOptions.cc
11 /// @brief Minimizer options class implementation
12 /// @author Phil Bradley
13 
14 
15 // Unit headers
17 
18 // Project headers
19 #include <basic/options/option.hh>
20 
21 // C++ headers
22 #include <string>
23 
24 // option key includes
25 #include <basic/options/keys/run.OptionKeys.gen.hh>
26 #include <basic/options/keys/optimization.OptionKeys.gen.hh>
27 
28 #include <utility/vector1.hh>
29 
30 
31 namespace core {
32 namespace optimization {
33 
34 /// @details Auto-generated virtual destructor
36 
38  std::string const & min_type_in,
39  Real const minimize_tolerance_in,
40  bool const use_nblist_in,
41  bool const deriv_check_in,
42  bool const deriv_check_verbose_in
43 ):
44  max_iter_(2000),
45  min_type_( min_type_in ),
46  minimize_tolerance_( minimize_tolerance_in ),
47  use_nblist_( use_nblist_in ),
48  nblist_auto_update_( false ),
49  deriv_check_( deriv_check_in ),
50  deriv_check_verbose_( deriv_check_verbose_in ),
51  deriv_check_to_stdout_( true ), // by default, send the result of a deriv-check call to the screen.
52  // should make these configurable of course
53  silent_( false ),
54  gmax_cutoff_for_convergence_( 1.0 ),
55  ax_init_( 0.0 ),
56  xx_init_( 0.1 ),
57  bx_init_( 0.2 ),
58  brent_abs_tolerance_( 0.01 ),
59  ga_mutation_probability_( 0.5 )
60 {
61  using namespace basic::options;
62  if ( option[ OptionKeys::run::nblist_autoupdate ].user() ) {
63  nblist_auto_update_ = option[ OptionKeys::run::nblist_autoupdate ]();
64  }
65  if ( option[ OptionKeys::optimization::default_max_cycles ].user() ) {
66  max_iter_ = option[ OptionKeys::optimization::default_max_cycles ]();
67  }
68 }
69 
70 ///
73 {
74  MinimizerOptionsOP minoptop = new MinimizerOptions(
77  if ( nblist_auto_update_ ) minoptop->nblist_auto_update_ = true;
78  if ( deriv_check_to_stdout_ ) minoptop->deriv_check_to_stdout_ = true;
79 
80  return minoptop;
81 }
82 
83 /////////////////////////////////////////////////////////////////////////////
84 // high-level params
85 
86 // the min-type, eg "dfpmin", "linmin"
87 std::string const &
89 {
90  return min_type_;
91 }
92 
93 void
95 {
96  min_type_ = min_type_in;
97 }
98 
101 {
102  return min_type_;
103 }
104 
105 void
106 MinimizerOptions::deriv_check( bool deriv_check_in )
107 {
108  deriv_check_ = deriv_check_in;
109 }
110 
111 void
113 {
114  deriv_check_to_stdout_ = setting;
115 }
116 
117 //
118 bool
120 {
121  return deriv_check_;
122 }
123 
124 //
125 bool
127 {
128  return deriv_check_verbose_;
129 }
130 
131 bool
133 {
134  return deriv_check_to_stdout_;
135 }
136 
137 
138 // the tolerance for dfpmin, dfpmin_atol etc
139 Real
141 {
142  return minimize_tolerance_;
143 }
144 
145 Real &
147 {
148  return minimize_tolerance_;
149 }
150 
151 void
153 {
154  minimize_tolerance_=minimize_tolerance_in;
155 }
156 
157 
158 bool
160 {
161  return use_nblist_;
162 }
163 
164 void
165 MinimizerOptions::use_nblist( bool use_nblist_in )
166 {
167  use_nblist_ = use_nblist_in;
168 }
169 
170 bool
172  return nblist_auto_update_;
173 }
174 
175 void
177  nblist_auto_update_ = setting;
178 }
179 
180 bool
182  return silent_;
183 }
184 
185 void
186 MinimizerOptions::silent( bool setting ) {
187  silent_ = setting;
188 }
189 
190 /////////////////////////////////////////////////////////////////////////////
191 // low-level params
192 
193 Real
196 }
197 
198 void
201 }
202 
203 // bracketing params for linmin
204 Real
206 {
207  return ax_init_;
208 }
209 
210 Real
212 {
213  return xx_init_;
214 }
215 
216 Real
218 {
219  return bx_init_;
220 }
221 
222 // abs tolerance for brent
223 Real
225 {
226  return brent_abs_tolerance_;
227 }
228 
229 int MinimizerOptions::max_iter() const { return max_iter_; }
231 
232 
235 
236 
237 } // namespace optimization
238 } // namespace core