MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
NLPInterfacePack::ExampleNLPFirstOrder Class Reference

Simple example NLP subclass to illustrate how to implement the NLPFirstOrder interface for a specialized NLP. More...

#include <NLPInterfacePack_ExampleNLPFirstOrder.hpp>

Inheritance diagram for NLPInterfacePack::ExampleNLPFirstOrder:
Inheritance graph
[legend]

Public Member Functions

 ExampleNLPFirstOrder (const VectorSpace::space_ptr_t &vec_space, value_type xo, bool has_bounds, bool dep_bounded)
 Constructor (see ExampleNLPDirect::ExampleNLPDirect()). More...
 
- Public Member Functions inherited from NLPInterfacePack::NLPFirstOrder
 NLPFirstOrder ()
 Initialize to no reference set to calculation quanities. More...
 
virtual MatrixOp * get_Gc ()
 Return pointer passed to this->set_Gc(). More...
 
virtual MatrixOp & Gc ()
 Returns non-const *this->get_Gc(). More...
 
virtual const MatrixOp & Gc () const
 Returns const *this->get_Gc(). More...
 
void unset_quantities ()
 Call to unset all storage quantities (both in this class and all subclasses). More...
 
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. More...
 
virtual size_type num_Gc_evals () const
 Gradient of constraints matrix Gc evaluations count. More...
 
- Public Member Functions inherited from NLPInterfacePack::NLPObjGrad
 NLPObjGrad ()
 Initialize to no reference set to calculation quanities. More...
 
virtual bool supports_Gf () const
 Determine if the objective gradient is supported or not. More...
 
virtual bool supports_Gf_prod () const
 Determine if the objective gradient product is supported or not. More...
 
virtual void set_Gf (VectorMutable *Gf)
 Set a pointer to a vector to be updated when this->calc_Gf() is called. More...
 
virtual VectorMutableget_Gf ()
 Return pointer passed to this->set_Gf(). More...
 
virtual VectorMutableGf ()
 Returns non-const *this->get_Gf(). More...
 
virtual const VectorGf () const
 Returns const *this->get_Gf(). More...
 
void unset_quantities ()
 Call to unset all storage quantities (both in this class and all subclasses). More...
 
virtual void calc_Gf (const Vector &x, bool newx=true) const
 Update the vector for Gf at the point x and put it in the stored reference. More...
 
virtual value_type calc_Gf_prod (const Vector &x, const Vector &d, bool newx=true) const
 Calculate the inner product Gf(x)'*d at the point x and put it in the stored reference. More...
 
virtual size_type num_Gf_evals () const
 Objective gradient evaluations count. More...
 
- Public Member Functions inherited from NLPInterfacePack::NLP
const ZeroOrderInfo zero_order_info () const
 Return pointer to set quantities. More...
 
const ZeroOrderInfo zero_order_info_breve () const
 Return pointer to set hat quantities. More...
 
 NLP ()
 Initialize to no reference set to calculation quanities. More...
 
virtual ~NLP ()
 Destructor that cleans all the memory it owns. More...
 
virtual void set_options (const options_ptr_t &options)
 Set the options that this NLP may be interested in. More...
 
virtual const options_ptr_tget_options () const
 Get the OptionsFromStream object being used to extract the options from. More...
 
virtual void get_init_lagrange_mult (VectorMutable *lambda, VectorMutable *nu) const
 Get the initial value of the Lagrange multipliers lambda. More...
 
virtual void set_f (value_type *f)
 Set a pointer to an value to be updated when this->calc_f() is called. More...
 
virtual value_type * get_f ()
 Return pointer passed to this->set_f(). More...
 
virtual value_type & f ()
 Returns non-const *this->get_f(). More...
 
virtual const value_type & f () const
 Returns const *this->get_f(). More...
 
virtual void set_c (VectorMutable *c)
 Set a pointer to a vector to be updated when this->calc_c() is called. More...
 
virtual VectorMutableget_c ()
 Return pointer passed to this->set_c(). More...
 
virtual VectorMutablec ()
 Returns non-const *this->get_c(). More...
 
virtual const Vectorc () const
 Returns const *this->get_c(). More...
 
virtual void calc_f (const Vector &x, bool newx=true) const
 Update the value for the objective f at the point x and put it in the stored reference. More...
 
virtual void calc_c (const Vector &x, bool newx=true) const
 Update the constraint residual vector for c at the point x and put it in the stored reference. More...
 
virtual size_type num_f_evals () const
 Gives the number of object function f(x) evaluations called by the solver since initialize() was called. More...
 
virtual size_type num_c_evals () const
 Gives the number of constraint function c(x) evaluations called by the solver since initialize() was called. Throws exception if this->m() == 0. More...
 
virtual size_type ns () const
 Return the number of slack variables (i.e. number of general inequalities). More...
 
virtual vec_space_ptr_t space_c_breve () const
 Vector space object for the original equalities c_breve(x_breve) More...
 
virtual vec_space_ptr_t space_h_breve () const
 Vector space object for the original inequalities h_breve(x_breve) More...
 
virtual const Vectorhl_breve () const
 Returns a reference to the vector of lower bounds on the general inequality constraints h_breve(x_breve). More...
 
virtual const Vectorhu_breve () const
 Returns a reference to the vector of upper bounds on the general inequality constraints h_breve(x_breve). More...
 
virtual void set_c_breve (VectorMutable *c_breve)
 Set a pointer to a vector to be updated when this->calc_c_breve() is called. More...
 
virtual VectorMutableget_c_breve ()
 Return pointer passed to this->set_c_breve(). More...
 
virtual VectorMutablec_breve ()
 Returns non-const *this->get_c_breve(). More...
 
virtual const Vectorc_breve () const
 Returns const *this->get_c_breve(). More...
 
virtual void set_h_breve (VectorMutable *h_breve)
 Set a pointer to a vector to be updated when this->calc_h_breve() is called. More...
 
virtual VectorMutableget_h_breve ()
 Return pointer passed to this->set_h_breve(). More...
 
virtual VectorMutableh_breve ()
 Returns non-const *this->get_h_breve(). More...
 
virtual const Vectorh_breve () const
 Returns const *this->get_h_breve(). More...
 
virtual const Permutation & P_var () const
 Return the permutation object for the variables. More...
 
virtual const Permutation & P_equ () const
 Return the permutation object for the constraints. More...
 
virtual void calc_c_breve (const Vector &x, bool newx=true) const
 Update the constraint residual vector for c_breve at the point x and put it in the stored reference. More...
 
virtual void calc_h_breve (const Vector &x, bool newx=true) const
 Update the constraint residual vector for h_breve at the point x and put it in the stored reference. More...
 
- Public Member Functions inherited from Teuchos::VerboseObject< NLP >
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
RCP< const ParameterList
getValidVerboseObjectSublist ()
 
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
void 
setupVerboseObjectSublist (ParameterList *paramList)
 
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
void 
readVerboseObjectSublist (ParameterList *paramList, RCP< FancyOStream > *oStream, EVerbosityLevel *verbLevel)
 
void readVerboseObjectSublist (ParameterList *paramList, VerboseObject< NLP > *verboseObject)
 
 VerboseObject (const EVerbosityLevel verbLevel=VERB_DEFAULT, const RCP< FancyOStream > &oStream=Teuchos::null)
 
virtual void initializeVerboseObject (const EVerbosityLevel verbLevel=VERB_DEFAULT, const RCP< FancyOStream > &oStream=Teuchos::null)
 
virtual const VerboseObjectsetVerbLevel (const EVerbosityLevel verbLevel) const
 
virtual const VerboseObjectsetOverridingVerbLevel (const EVerbosityLevel verbLevel) const
 
virtual EVerbosityLevel getVerbLevel () const
 
- Public Member Functions inherited from NLPInterfacePack::ExampleNLPObjGrad
 ExampleNLPObjGrad (const VectorSpace::space_ptr_t &vec_space, value_type xo, bool has_bounds, bool dep_bounded)
 Constructor. More...
 
virtual Range1D var_dep () const
 
virtual Range1D var_indep () const
 
size_type n () const
 
size_type m () const
 
vec_space_ptr_t space_x () const
 
vec_space_ptr_t space_c () const
 
size_type num_bounded_x () const
 
void force_xinit_in_bounds (bool force_xinit_in_bounds)
 
bool force_xinit_in_bounds () const
 
const Vectorxinit () const
 
const Vectorxl () const
 
const Vectorxu () const
 
value_type max_var_bounds_viol () const
 
void scale_f (value_type scale_f)
 
value_type scale_f () const
 
void report_final_solution (const Vector &x, const Vector *lambda, const Vector *nu, bool optimal)
 

Private Member Functions

void assert_is_initialized () const
 

Private Attributes

bool initialized_
 
NLPFirstOrder::mat_fcty_ptr_t factory_Gc_
 
NLPFirstOrder::basis_sys_ptr_t basis_sys_
 

Overridden public members from NLP

void initialize (bool test_setup)
 
bool is_initialized () const
 

Overridden public members from NLPFirstOrder

void set_Gc (MatrixOp *Gc)
 Overridden to check the concrete type of Gc. More...
 
const NLPFirstOrder::mat_fcty_ptr_t factory_Gc () const
 
const basis_sys_ptr_t basis_sys () const
 Returns an ExampleBasisSystem. More...
 

Overridden protected members from NLPFirstOrder

void imp_calc_Gc (const Vector &x, bool newx, const FirstOrderInfo &first_order_info) const
 

Additional Inherited Members

- Public Types inherited from NLPInterfacePack::NLPFirstOrder
typedef Teuchos::RCP< const
Teuchos::AbstractFactory
< MatrixOp > > 
mat_fcty_ptr_t
 
typedef Teuchos::RCP< BasisSystem > basis_sys_ptr_t
 
- Public Types inherited from NLPInterfacePack::NLP
typedef AbstractLinAlgPack::Vector Vector
 
typedef
AbstractLinAlgPack::VectorMutable 
VectorMutable
 
typedef Teuchos::RCP< const
VectorSpace > 
vec_space_ptr_t
 
typedef Teuchos::RCP< const
OptionsFromStreamPack::OptionsFromStream
options_ptr_t
 
- Static Public Member Functions inherited from NLPInterfacePack::NLP
static value_type infinite_bound ()
 Value for an infinite bound. More...
 
- Static Public Member Functions inherited from Teuchos::VerboseObject< NLP >
static void setDefaultVerbLevel (const EVerbosityLevel defaultVerbLevel)
 
static EVerbosityLevel getDefaultVerbLevel ()
 
- Protected Member Functions inherited from NLPInterfacePack::NLPFirstOrder
const FirstOrderInfo first_order_info () const
 Return objective gradient and zero order information. More...
 
- Protected Member Functions inherited from NLPInterfacePack::NLPObjGrad
const ObjGradInfo obj_grad_info () const
 Return objective gradient and zero order information. More...
 
- Protected Member Functions inherited from NLPInterfacePack::NLP
template<class T >
void assert_ref_set (T *p, std::string info) const
 Assert referece has been set for a quanity. More...
 
virtual void imp_calc_c_breve (const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info_breve) const
 Overridden to compute c_breve(x_breve) and perhaps f(x) and/or h_breve(x_breve) More...
 
virtual void imp_calc_h_breve (const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info_breve) const
 Overridden to compute h_breve(x_breve) and perhaps f(x) and/or c_breve(x_breve). More...
 
- Protected Member Functions inherited from NLPInterfacePack::ExampleNLPObjGrad
void imp_calc_f (const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info) const
 
void imp_calc_c (const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info) const
 
void imp_calc_h (const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info) const
 This implementation does nothing (should never be called though). More...
 
void imp_calc_Gf (const Vector &x, bool newx, const ObjGradInfo &obj_grad_info) const
 

Detailed Description

Simple example NLP subclass to illustrate how to implement the NLPFirstOrder interface for a specialized NLP.

The example NLP we will use is a scalable problem where the basis of the jacobian of the constraints is a diagonal matrix.

   min    f(x) = (1/2) * sum( x(i)^2, for i = 1..n )
   s.t.   c(x)(j) = x(j) * (x(m+j) -1) - 10 * x(m+j) = 0, for j = 1..m
         0.01 < x(i) < 20, for i = p...p+m

   where:
       m = n/2
       p = 1 if dep_bounded == true or m+1 if dep_bounded = false

This subclass inherits from the subclass ExampleNLPDirect mostly out of lazyness but also to show how flexible these interfaces can be using mutiple inheritance.

ToDo: Finish documentation!

Definition at line 73 of file NLPInterfacePack_ExampleNLPFirstOrder.hpp.

Constructor & Destructor Documentation

NLPInterfacePack::ExampleNLPFirstOrder::ExampleNLPFirstOrder ( const VectorSpace::space_ptr_t &  vec_space,
value_type  xo,
bool  has_bounds,
bool  dep_bounded 
)

Member Function Documentation

void NLPInterfacePack::ExampleNLPFirstOrder::initialize ( bool  test_setup)
virtual

Reimplemented from NLPInterfacePack::NLPFirstOrder.

Definition at line 99 of file NLPInterfacePack_ExampleNLPFirstOrder.cpp.

bool NLPInterfacePack::ExampleNLPFirstOrder::is_initialized ( ) const
virtual
void NLPInterfacePack::ExampleNLPFirstOrder::set_Gc ( MatrixOp *  Gc)
virtual

Overridden to check the concrete type of Gc.

Reimplemented from NLPInterfacePack::NLPFirstOrder.

Definition at line 78 of file NLPInterfacePack_ExampleNLPFirstOrder.cpp.

const NLPFirstOrder::mat_fcty_ptr_t NLPInterfacePack::ExampleNLPFirstOrder::factory_Gc ( ) const
virtual
const NLPFirstOrder::basis_sys_ptr_t NLPInterfacePack::ExampleNLPFirstOrder::basis_sys ( ) const
virtual

Returns an ExampleBasisSystem.

Reimplemented from NLPInterfacePack::NLPFirstOrder.

Definition at line 92 of file NLPInterfacePack_ExampleNLPFirstOrder.cpp.

void NLPInterfacePack::ExampleNLPFirstOrder::imp_calc_Gc ( const Vector x,
bool  newx,
const FirstOrderInfo first_order_info 
) const
protectedvirtual
void NLPInterfacePack::ExampleNLPFirstOrder::assert_is_initialized ( ) const
inlineprivate

Definition at line 141 of file NLPInterfacePack_ExampleNLPFirstOrder.hpp.

Member Data Documentation

bool NLPInterfacePack::ExampleNLPFirstOrder::initialized_
private

Definition at line 125 of file NLPInterfacePack_ExampleNLPFirstOrder.hpp.

NLPFirstOrder::mat_fcty_ptr_t NLPInterfacePack::ExampleNLPFirstOrder::factory_Gc_
private

Definition at line 126 of file NLPInterfacePack_ExampleNLPFirstOrder.hpp.

NLPFirstOrder::basis_sys_ptr_t NLPInterfacePack::ExampleNLPFirstOrder::basis_sys_
private

Definition at line 127 of file NLPInterfacePack_ExampleNLPFirstOrder.hpp.


The documentation for this class was generated from the following files: