NLPInterfacePack: C++ Interfaces and Implementation for Non-Linear Programs  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Types | Protected Member Functions | List of all members
NLPInterfacePack::NLPFirstOrder Class Referenceabstract

NLP first order information interface class {abstract}. More...

#include <NLPInterfacePack_NLPFirstOrder.hpp>

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

Classes

struct  FirstOrderInfo
 Struct for zero and first order quantities (pointers) More...
 

Public Types

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 Teuchos::RCP< const
VectorSpace > 
vec_space_ptr_t
 
typedef Teuchos::RCP< const
OptionsFromStreamPack::OptionsFromStream
options_ptr_t
 

Protected Member Functions

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...
 
virtual void imp_calc_Gf (const Vector &x, bool newx, const ObjGradInfo &obj_grad_info) const =0
 Overridden to compute f(x) and perhaps c(x) (if multiple calculaiton = true). 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_f (const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info) const =0
 Overridden to compute f(x) (and perhaps other quantities if set). More...
 
virtual void imp_calc_c (const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info) const =0
 Overridden to compute c(x) and perhaps f(x) and/or h(x) (if multiple calculaiton = true). 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...
 

Constructors

 NLPFirstOrder ()
 Initialize to no reference set to calculation quanities. More...
 

NLP initialization

void initialize (bool test_setup)
 Initialize the NLP for its first use. More...
 

Matrix factory objects

virtual const mat_fcty_ptr_t factory_Gc () const =0
 Return a matrix factory object for creating Gc. More...
 

BasisSystem

virtual const basis_sys_ptr_t basis_sys () const
 Return a BasisSystem object compatible with Gc and Gh. More...
 

<<std aggr>> members for the gradient of the objective function Gc(x)

virtual void set_Gc (MatrixOp *Gc)
 Set a pointer to a matrix object to be updated when this->calc_Gc() is called. 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...
 

Unset calculation quantities

void unset_quantities ()
 Call to unset all storage quantities (both in this class and all subclasses). More...
 

Calculation Members

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...
 

Function evaluation counts

virtual size_type num_Gc_evals () const
 Gradient of constraints matrix Gc evaluations count. More...
 

Protected methods to be overridden by subclasses

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). More...
 

Additional Inherited Members

- Public Member Functions inherited from NLPInterfacePack::NLPObjGrad
 NLPObjGrad ()
 Initialize to no reference set to calculation quanities. More...
 
void initialize (bool test_setup)
 Initialize the NLP for its first use. 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 force_xinit_in_bounds (bool force_xinit_in_bounds)=0
 Set if the initial point must be within the bounds. More...
 
virtual bool force_xinit_in_bounds () const =0
 Returns if the initial point must be within the bounds. 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 bool is_initialized () const =0
 Return if this is initialized. More...
 
virtual size_type n () const
 Return the number of variables. More...
 
virtual size_type m () const
 Return the number of general equality constraints. More...
 
virtual vec_space_ptr_t space_x () const =0
 Vector space object for unknown variables x (dimension n). More...
 
virtual vec_space_ptr_t space_c () const =0
 Vector space object for general equality constraints c(x) (dimension m). More...
 
virtual size_type num_bounded_x () const =0
 Returns the number of variables in x(i) for which xl(i)> -infinite_bound() or xu(i) < +infinite_bound(). More...
 
virtual const Vectorxl () const =0
 Returns the lower bounds on the variables x. More...
 
virtual const Vectorxu () const =0
 Returns a reference to the vector of upper bounds on the variables x. More...
 
virtual value_type max_var_bounds_viol () const =0
 Set the maximum absolute value for which the variable bounds may be violated by when computing function and gradient values. More...
 
virtual const Vectorxinit () const =0
 Returns a reference to the vector of the initial guess for the solution x. 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 scale_f (value_type scale_f)=0
 Set the scaling of the objective function. More...
 
virtual value_type scale_f () const =0
 Return the scaling being used for the objective function. 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 void report_final_solution (const Vector &x, const Vector *lambda, const Vector *nu, bool is_optimal)
 Used by the solver to report the final solution and multipliers. 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...
 
- Static Public Member Functions inherited from NLPInterfacePack::NLP
static value_type infinite_bound ()
 Value for an infinite bound. More...
 

Detailed Description

NLP first order information interface class {abstract}.

Overview:

This class adds Jacobian information for the constraints. This augments the information provided by the NLP and NLPObjGrad interfaces. This interface includes access to matrix space objects which must be used by the client to create the matrix objects that are used with this interface. This totally decouples the client from the implementation of these matrix objects.

Client Usage:

As with the NLP base interface, the initialize() method must be called before the NLP object can be used.

The matrix space object returned from factory_Gc()must be used to create the matrix objects for Gc used with this interface. Note that the matrix objects returned from this matrix space object can not be expected to be usable until they are passed to the calculation routines.

The method set_Gc() si used to set a pointer to matrix object to be updated when Gc is computed using calc_Gc().

The number of evaluations of Gc using calc_Gc() and calc_Gh() is returned by num_Gc_evals().

Subclass developer's notes:

In addition to the methods that must be overridden by the NLPObjGrad interface (see) the following methods must also be overridden: factory_Gc(), imp_calc_Gc().

In addition to the methods that should be overridden from NLPObjGrad by most subclasses (see), the following additional methods should be overridden: initialize().

The following methods should never have to be overridden by most subclasses except in some very specialized situations: set_Gc(), get_Gc(), Gc(), num_Gc_evals().

Definition at line 89 of file NLPInterfacePack_NLPFirstOrder.hpp.

Member Typedef Documentation

Definition at line 94 of file NLPInterfacePack_NLPFirstOrder.hpp.

Definition at line 96 of file NLPInterfacePack_NLPFirstOrder.hpp.

Constructor & Destructor Documentation

NLPInterfacePack::NLPFirstOrder::NLPFirstOrder ( )

Initialize to no reference set to calculation quanities.

Definition at line 54 of file NLPInterfacePack_NLPFirstOrder.cpp.

Member Function Documentation

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

Initialize the NLP for its first use.

This function implementation should be called by subclass implementations in order to reset counts for f(x), c(x), h(x), Gf(x), Gc(x) and Gh(x) evaluations. This implementation calls this->NLPObjGrad::initialize()

Postconditions:

Reimplemented from NLPInterfacePack::NLP.

Reimplemented in NLPInterfacePack::NLPSerialPreprocessExplJac, and NLPInterfacePack::NLPSecondOrder.

Definition at line 58 of file NLPInterfacePack_NLPFirstOrder.cpp.

virtual const mat_fcty_ptr_t NLPInterfacePack::NLPFirstOrder::factory_Gc ( ) const
pure virtual

Return a matrix factory object for creating Gc.

This method may return return.get() == NULL if m() == 0. Otherwise, it must must return a valid matrix factory object.

Implemented in NLPInterfacePack::NLPSerialPreprocessExplJac.

virtual const basis_sys_ptr_t NLPInterfacePack::NLPFirstOrder::basis_sys ( ) const
virtual

Return a BasisSystem object compatible with Gc and Gh.

Note that multiple calls to this method may return the same return.get() value so the client must not assume that they are unique.

The default implementation returns return.get() == NULL.

Reimplemented in NLPInterfacePack::NLPSerialPreprocessExplJac.

void NLPInterfacePack::NLPFirstOrder::set_Gc ( MatrixOp *  Gc)
virtual

Set a pointer to a matrix object to be updated when this->calc_Gc() is called.

Parameters
Gc[in] Pointer to matrix of gradients. May be NULL.

Preconditions:

  • this->is_initialized() == true (throw NotInitialized)
  • [Gc != NULL] Gc->space().is_compatible(*this->factory_Gc(),no_trans) == true (throw VectorSpace::IncompatibleVectorSpaces)

Postconditions:

Reimplemented in NLPInterfacePack::NLPSerialPreprocessExplJac.

Definition at line 73 of file NLPInterfacePack_NLPFirstOrder.cpp.

MatrixOp * NLPInterfacePack::NLPFirstOrder::get_Gc ( )
virtual

Return pointer passed to this->set_Gc().

Preconditions:

Definition at line 81 of file NLPInterfacePack_NLPFirstOrder.cpp.

MatrixOp & NLPInterfacePack::NLPFirstOrder::Gc ( )
virtual

Returns non-const *this->get_Gc().

Preconditions:

Definition at line 89 of file NLPInterfacePack_NLPFirstOrder.cpp.

const MatrixOp & NLPInterfacePack::NLPFirstOrder::Gc ( ) const
virtual

Returns const *this->get_Gc().

Preconditions:

Definition at line 97 of file NLPInterfacePack_NLPFirstOrder.cpp.

void NLPInterfacePack::NLPFirstOrder::unset_quantities ( )
virtual

Call to unset all storage quantities (both in this class and all subclasses).

Preconditions:

Postconditions:

This method must be called by all subclasses that override it.

Reimplemented from NLPInterfacePack::NLP.

Reimplemented in NLPInterfacePack::NLPSecondOrder.

Definition at line 105 of file NLPInterfacePack_NLPFirstOrder.cpp.

void NLPInterfacePack::NLPFirstOrder::calc_Gc ( const Vector x,
bool  newx = true 
) const
virtual

Update the matrix for Gc at the point x and put it in the stored reference.

Parameters
x[in] Point at which to calculate the matrix of gradients Gc(x).
newx[in] (default true) If false, the values in x are assumed to be the same as the last call to a this->imp_calc_*(x,newx) member. If true, the values in x are assumed to not be the same as the last call to a this->imp_calc_*(x,newx) member.

Preconditions:

  • this->is_initialized() == true (throw NotInitialized)
  • x.space().is_compatible(*this->space_x()) == true (throw VectorSpace::IncompatibleVectorSpaces)
  • this->get_Gc() != NULL (throw NoRefSet)

Postconditions:

  • this->Gc() is updated to Gc(x)

The storage reference for f and/or c may also be updated at this point (if get_f() != NULL and/or get_c() != NULL) but is not guarentied to be. But no other quanities from possible subclasses are allowed to be updated as a side effect.

Definition at line 113 of file NLPInterfacePack_NLPFirstOrder.cpp.

size_type NLPInterfacePack::NLPFirstOrder::num_Gc_evals ( ) const
virtual

Gradient of constraints matrix Gc evaluations count.

This function can be called to find out how many evaluations this->calc_Gc() the client requested since this->initialize() was called.

Definition at line 123 of file NLPInterfacePack_NLPFirstOrder.cpp.

const NLPFirstOrder::FirstOrderInfo NLPInterfacePack::NLPFirstOrder::first_order_info ( ) const
inlineprotected

Return objective gradient and zero order information.

Definition at line 328 of file NLPInterfacePack_NLPFirstOrder.hpp.

virtual void NLPInterfacePack::NLPFirstOrder::imp_calc_Gc ( const Vector x,
bool  newx,
const FirstOrderInfo first_order_info 
) const
protectedpure virtual

Overridden to compute Gc(x) and perhaps Gf(x), f(x) and c(x).

Preconditions:

  • x.space().is_compatible(*this->space_x()) (throw IncompatibleType)
  • obj_grad_info.Gc != NULL (throw std::invalid_argument)

Postconditions:

  • *obj_grad_info.Gc is updated to Gc(x).
Parameters
x[in] Unknown vector (size n).
newx[in] (default true) If false, the values in x are assumed to be the same as the last call to a this->imp_calc_*(x,newx) member. If true, the values in x are assumed to not be the same as the last call to a this->imp_calc_*(x,newx) member.
obj_grad_info[out] Pointers to f, c, Gf and Gc On output *obj_grad_info.Gc is updated to Gc(x). Any of the other objects pointed to in obj_grad_info may also be set but are now guaranteed to be.

Implemented in NLPInterfacePack::NLPSerialPreprocessExplJac.


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