MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NLPInterfacePack_ExampleNLPBanded.hpp
Go to the documentation of this file.
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 EXAMPLE_NLP_BANDED_H
43 #define EXAMPLE_NLP_BANDED_H
44 
45 
47 
48 
49 namespace NLPInterfacePack {
50 
51 
161 {
162 public:
163 
166 
172  size_type nD
173  ,size_type nI
174  ,size_type bw = 1
175  ,size_type mU = 0
176  ,size_type mI = 0
177  ,value_type xo = 0.1
184  ,bool nlp_selects_basis = false
185  ,value_type diag_scal = 10.0
186  ,value_type diag_vary = 1.0
187  ,bool sym_basis = false
188  ,value_type f_offset = 0.0
189  ,value_type co = 0.0
190  ,bool ignore_constraints = false
191  );
192 
194 
195  // Todo: Add methods to manipulate bounds and co ...
196 
199 
200  // ToDo: Add these ...
201 
203 
206 
208  void initialize(bool test_setup);
210  bool is_initialized() const;
213 
215 
218 
220  bool nlp_selects_basis() const;
221 
223 
224 protected:
225 
228 
230  bool imp_nlp_has_changed() const;
232  size_type imp_n_orig() const;
234  size_type imp_m_orig() const;
236  size_type imp_mI_orig() const;
238  const DVectorSlice imp_xinit_orig() const;
240  bool imp_has_var_bounds() const;
242  const DVectorSlice imp_xl_orig() const;
244  const DVectorSlice imp_xu_orig() const;
246  const DVectorSlice imp_hl_orig() const;
248  const DVectorSlice imp_hu_orig() const;
250  void imp_calc_f_orig(
251  const DVectorSlice &x_full
252  ,bool newx
254  ) const;
256  void imp_calc_c_orig(
257  const DVectorSlice &x_full
258  ,bool newx
259  ,const ZeroOrderInfoSerial &zero_order_info
260  ) const;
262  void imp_calc_h_orig(
263  const DVectorSlice &x_full
264  ,bool newx
265  ,const ZeroOrderInfoSerial &zero_order_info
266  ) const;
268  void imp_calc_Gf_orig(
269  const DVectorSlice &x_full
270  ,bool newx
272  ) const;
274  bool imp_get_next_basis(
275  IVector *var_perm_full
276  ,IVector *equ_perm_full
277  ,size_type *rank_full
278  ,size_type *rank
279  );
282  const DVectorSlice &x_orig
283  ,const DVectorSlice *lambda_orig
284  ,const DVectorSlice *lambdaI_orig
285  ,const DVectorSlice *nu_orig
286  ,bool is_optimal
287  );
288 
290 
293 
295  size_type imp_Gc_nz_orig() const;
297  size_type imp_Gh_nz_orig() const;
299  void imp_calc_Gc_orig(
300  const DVectorSlice& x_full, bool newx
302  ) const;
304  void imp_calc_Gh_orig(
305  const DVectorSlice& x_full, bool newx
306  , const FirstOrderExplInfo& first_order_expl_info
307  ) const;
308 
310 
311 private:
312 
313  // /////////////////////////////////////////
314  // Private types
315 
316  // /////////////////////////////////////////
317  // Private data members
318 
320 
323 
325 
327 
333 
335 
338 
344 
346 
347  mutable bool c_orig_updated_;
348 
352 
353  // /////////////////////////////////////////
354  // Private member functions
355 
357  void assert_is_initialized() const;
358 
360  void inform_new_point(bool newx) const;
361 
362  // Not defined and not to be called
366 
367 
368 }; // end class ExampleNLPBanded
369 
370 
371 } // end namespace NLPInterfacePack
372 
373 
374 #endif // EXAMPLE_NLP_BANDED_H
AbstractLinAlgPack::size_type size_type
NLP node subclass complementing NLPSerialPreprocess for explicit Jacobians.
const ZeroOrderInfo zero_order_info() const
Return pointer to set quantities.
const ObjGradInfo obj_grad_info() const
Return objective gradient and zero order information.
DVectorSlice x_full() const
Give reference to current x_full.
bool imp_get_next_basis(IVector *var_perm_full, IVector *equ_perm_full, size_type *rank_full, size_type *rank)
Struct for objective and constriants (pointer) as serial vectors.
ExampleNLPBanded & operator=(const ExampleNLPBanded &)
Struct for zero and explicit first order quantities that subclass must fill in.
void imp_calc_h_orig(const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info) const
void imp_calc_Gc_orig(const DVectorSlice &x_full, bool newx, const FirstOrderExplInfo &first_order_expl_info) const
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
void imp_calc_c_orig(const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info) const
AbstractLinAlgPack::value_type value_type
Struct for serial gradient (objective), objective and constriants (pointers)
void imp_calc_Gf_orig(const DVectorSlice &x_full, bool newx, const ObjGradInfoSerial &obj_grad_info) const
void imp_calc_f_orig(const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info) const
void imp_report_orig_final_solution(const DVectorSlice &x_orig, const DVectorSlice *lambda_orig, const DVectorSlice *lambdaI_orig, const DVectorSlice *nu_orig, bool is_optimal)
static value_type infinite_bound()
Value for an infinite bound.
void imp_calc_Gh_orig(const DVectorSlice &x_full, bool newx, const FirstOrderExplInfo &first_order_expl_info) const