MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NLPInterfacePack_NLPFirstOrder.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 NLP_FIRST_ORDER_INFO_H
43 #define NLP_FIRST_ORDER_INFO_H
44 
47 
48 namespace NLPInterfacePack {
89 class NLPFirstOrder : virtual public NLPObjGrad {
90 public:
91 
93  typedef Teuchos::RCP<
97 
100 
102  NLPFirstOrder();
103 
105 
108 
122  void initialize(bool test_setup);
123 
125 
128 
134  virtual const mat_fcty_ptr_t factory_Gc() const = 0;
135 
137 
140 
148  virtual const basis_sys_ptr_t basis_sys() const;
149 
151 
154 
169  virtual void set_Gc(MatrixOp* Gc);
176  virtual MatrixOp* get_Gc();
184  virtual MatrixOp& Gc();
192  virtual const MatrixOp& Gc() const;
193 
195 
198 
212  void unset_quantities();
213 
215 
218 
242  virtual void calc_Gc(const Vector& x, bool newx = true) const;
243 
245 
248 
254  virtual size_type num_Gc_evals() const;
255 
257 
260  struct FirstOrderInfo {
263  : Gc(NULL), Gf(NULL), f(NULL), c(NULL)
264  {}
266  FirstOrderInfo( MatrixOp* Gc_in, const ObjGradInfo& obj_grad )
267  : Gc(Gc_in), Gf(obj_grad.Gf), f(obj_grad.f), c(obj_grad.c)
268  {}
270  MatrixOp* Gc;
277  }; // end struct FirstOrderInfo
278 
279 protected:
280 
282  const FirstOrderInfo first_order_info() const;
283 
286 
309  virtual void imp_calc_Gc(const Vector& x, bool newx, const FirstOrderInfo& first_order_info) const = 0;
310 
312 
313 private:
314 
315 #ifdef DOXYGEN_COMPILE
318 #endif
319  mutable MatrixOp *Gc_;
321 
322 }; // end class NLPFirstOrder
323 
324 // /////////////////////
325 // Inline members
326 
327 inline
329 {
330  return FirstOrderInfo(Gc_,obj_grad_info());
331 }
332 
333 } // end namespace NLPInterfacePack
334 
335 #endif // NLP_FIRST_ORDER_INFO_H
NLP interface class that adds gradient information for the objective function {abstract}.
AbstractLinAlgPack::size_type size_type
VectorMutable * Gf
Pointer to gradient of objective function Gf (may be NULL if not set)
virtual void calc_Gc(const Vector &x, bool newx=true) const
Update the matrix for Gc at the point x and put it in the stored reference.
Struct for gradient (objective), objective and constriants (pointers)
NLPFirstOrder()
Initialize to no reference set to calculation quanities.
MatrixOp * Gc
Pointer to Jacobian of equality constraints Gc (may be NULL if not set)
void initialize(bool test_setup)
Initialize the NLP for its first use.
Interface for the creation and maintainance of a basis matrix for a decomposition of linearlized cons...
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
virtual void imp_calc_Gc(const Vector &x, bool newx, const FirstOrderInfo &first_order_info) const =0
Overridden to compute Gc(x) and perhaps Gf(x), f(x) and c(x).
const ObjGradInfo obj_grad_info() const
Return objective gradient and zero order information.
const FirstOrderInfo first_order_info() const
Return objective gradient and zero order information.
virtual size_type num_Gc_evals() const
Gradient of constraints matrix Gc evaluations count.
Teuchos::AbstractFactory< AbstractLinAlgPack::MatrixOp > * factory_Gc
FirstOrderInfo(MatrixOp *Gc_in, const ObjGradInfo &obj_grad)
void unset_quantities()
Call to unset all storage quantities (both in this class and all subclasses).
Struct for zero and first order quantities (pointers)
AbstractLinAlgPack::VectorMutable VectorMutable
virtual const mat_fcty_ptr_t factory_Gc() const =0
Return a matrix factory object for creating Gc.
NLP first order information interface class {abstract}.
AbstractLinAlgPack::BasisSystem * basis_sys
VectorMutable * c
Pointer to equality constraints residule c (may be NULL if not set)
Teuchos::RCP< const Teuchos::AbstractFactory< MatrixOp > > mat_fcty_ptr_t
virtual MatrixOp & Gc()
Returns non-const *this->get_Gc().
AbstractLinAlgPack::value_type value_type
virtual MatrixOp * get_Gc()
Return pointer passed to this->set_Gc().
value_type * f
Pointer to objective function f (may be NULL if not set)
virtual const basis_sys_ptr_t basis_sys() const
Return a BasisSystem object compatible with Gc and Gh.
virtual void set_Gc(MatrixOp *Gc)
Set a pointer to a matrix object to be updated when this->calc_Gc() is called.