MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NLPInterfacePack_ExampleNLPDirect.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_FIRST_ORDER_DIRECT_H
43 #define EXAMPLE_NLP_FIRST_ORDER_DIRECT_H
44 
50 
51 namespace NLPInterfacePack {
52 
104  : virtual public NLPDirect
105  , virtual public ExampleNLPObjGrad
106 {
107 public:
108 
123  const VectorSpace::space_ptr_t& vec_space
124  ,value_type xo
125  ,bool has_bounds
126  ,bool dep_bounded
127  );
128 
131 
133  void initialize(bool test_setup);
135  bool is_initialized() const;
136 
138 
141 
143  Range1D var_dep() const;
145  Range1D var_indep() const;
147  const mat_fcty_ptr_t factory_D() const;
149  void calc_point(
150  const Vector &x
151  ,value_type *f
152  ,VectorMutable *c
153  ,bool recalc_c
154  ,VectorMutable *Gf
155  ,VectorMutable *py
156  ,VectorMutable *rGf
157  ,MatrixOp *GcU
158  ,MatrixOp *D
159  ,MatrixOp *Uz
160  ) const;
163  const Vector &x
164  ,VectorMutable *c
165  ,bool recalc_c
166  ,VectorMutable *py
167  ) const;
168 
170 
171 private:
172 
173  // /////////////////////////////////////////
174  // Private data members
175 
176  mat_fcty_ptr_t factory_D_; // Matrix space object for D
177 
178  bool initialized_; // flag for if initialized has been called.
179 
180  // /////////////////////////////////////////
181  // Private member functions
182 
184  void assert_is_initialized() const;
185 
186 }; // end class ExampleNLPDirect
187 
188 // ///////////////////////////////////////////////
189 // Inline member functions
190 
191 inline
193 {
194  typedef NLPInterfacePack::NLP NLP;
195  if( !is_initialized() )
196  throw NLP::UnInitialized("ExampleNLPDirect::assert_is_initialized() : Error, "
197  "ExampleNLPDirect::initialize() has not been called yet." );
198 }
199 
200 } // end namespace NLPInterfacePack
201 
202 #endif // EXAMPLE_NLP_FIRST_ORDER_DIRECT_H
virtual value_type & f()
Returns non-const *this->get_f().
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
void calc_semi_newton_step(const Vector &x, VectorMutable *c, bool recalc_c, VectorMutable *py) const
Interface providing only direct first order sensitivity information.
ExampleNLPDirect(const VectorSpace::space_ptr_t &vec_space, value_type xo, bool has_bounds, bool dep_bounded)
Constructor.
Simple example NLP subclass to illustrate how to implement the NLPObjGrad interface for a specialized...
NLP interface class {abstract}.
Thrown if any member functions are called before initialize() has been called.
NLP()
Initialize to no reference set to calculation quanities.
AbstractLinAlgPack::value_type value_type
Abstract interface for mutable coordinate vectors {abstract}.
Simple example NLP subclass to illustrate how to implement the NLPDirect interface for a specialized ...
virtual VectorMutable & Gf()
Returns non-const *this->get_Gf().
void calc_point(const Vector &x, value_type *f, VectorMutable *c, bool recalc_c, VectorMutable *Gf, VectorMutable *py, VectorMutable *rGf, MatrixOp *GcU, MatrixOp *D, MatrixOp *Uz) const
virtual VectorMutable & c()
Returns non-const *this->get_c().