MOOCHO (Single Doxygen Collection) Version of the Day
Classes | Private Member Functions | Private Attributes
NLPInterfacePack::NLPSerialPreprocessExplJac Class Reference

NLP node subclass complementing NLPSerialPreprocess for explicit Jacobians. More...

#include <NLPInterfacePack_NLPSerialPreprocessExplJac.hpp>

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

List of all members.

Classes

struct  FirstOrderExplInfo
 Struct for zero and explicit first order quantities that subclass must fill in. More...

Private Member Functions

void imp_calc_Gc_or_Gh (bool calc_Gc, const Vector &x, bool newx, const FirstOrderInfo &first_order_info) const
void imp_fill_jacobian_entries (size_type n, size_type n_full, bool load_struct, const index_type col_offset, const value_type *val_full, const value_type *val_full_end, const index_type *ivect_full, const index_type *jvect_full, index_type *nz, value_type *val_itr, index_type *ivect_itr, index_type *jvect_itr) const

Private Attributes

bool initialized_
bool test_setup_
options_ptr_t options_
factory_mat_ptr_t factory_Gc_full_
mat_fcty_ptr_t factory_Gc_
size_type Gc_nz_orig_
size_type Gh_nz_orig_
size_type Gc_nz_full_
size_type Gh_nz_full_
FirstOrderExplInfo::val_t Gc_val_orig_
FirstOrderExplInfo::ivect_t Gc_ivect_orig_
FirstOrderExplInfo::jvect_t Gc_jvect_orig_
FirstOrderExplInfo::val_t Gh_val_orig_
FirstOrderExplInfo::ivect_t Gh_ivect_orig_
FirstOrderExplInfo::jvect_t Gh_jvect_orig_
bool Gc_perm_new_basis_updated_

Public types

typedef Teuchos::RCP< const
Teuchos::AbstractFactory
< MatrixOp > > 
factory_mat_ptr_t
 

Constructors / initializers

 STANDARD_COMPOSITION_MEMBERS (BasisSystemFactory, basis_sys_fcty)
 Set the BasisSystemFactory object used to create the basis system.
 NLPSerialPreprocessExplJac (const basis_sys_fcty_ptr_t &basis_sys_fcty=Teuchos::rcp(new BasisSystemFactoryStd()), const factory_mat_ptr_t &factory_Gc_full=Teuchos::null)
 Calls this->set_basis_sys_fcty() and this->set_mat_factories() methods.
void set_factory_Gc_full (const factory_mat_ptr_t &factory_Gc_full)
 Initialize with matrix factory for original matrices Gc.

Overridden public members from NLP

void set_options (const options_ptr_t &options)
 Passes these options on to this->basis_sys_fcty().set_options(options).
const options_ptr_tget_options () const
 
void initialize (bool test_setup)
 
bool is_initialized () const
 

Overridden public members from NLPFirstOrder

const mat_fcty_ptr_t factory_Gc () const
 
const basis_sys_ptr_t basis_sys () const
 Calls basis_sys_fcty()->create()
void set_Gc (MatrixOp *Gc)
 Validates the type of Gc is correct.

Overridden public members from NLPVarReductPerm

bool get_next_basis (Permutation *P_var, Range1D *var_dep, Permutation *P_equ, Range1D *equ_decomp)
 
void set_basis (const Permutation &P_var, const Range1D &var_dep, const Permutation *P_equ, const Range1D *equ_decomp)
 

Overridden protected members from NLPFirstOrder

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

Pure virtual template methods to be defined by subclasses

virtual size_type imp_Gc_nz_orig () const =0
 Return the number of nonzero elements in Gc before elements are removed for fixed variables.
virtual size_type imp_Gh_nz_orig () const =0
 Return the number of nonzero elements in Gh before elements are removed for fixed variables.
virtual void imp_calc_Gc_orig (const DVectorSlice &x_full, bool newx, const FirstOrderExplInfo &first_order_expl_info) const =0
 Calculate the COOR matrix for the gradient for all of the c(x) constaints in the original NLP.
virtual void imp_calc_Gh_orig (const DVectorSlice &x_full, bool newx, const FirstOrderExplInfo &first_order_expl_info) const =0
 Calculate the COOR matrix for the gradient for all of the h(x) constaints in the original NLP.

Protected member functions for subclasses to use

void assert_initialized () const
 Assert if we have been initizlized (throws UnInitialized)
const FirstOrderExplInfo first_order_expl_info () const
 

Detailed Description

NLP node subclass complementing NLPSerialPreprocess for explicit Jacobians.

This subclass does a lot of work. It has to consider several different types of variability. The matrices Gc and Gh that are computed must take into consideration whether or not inequalities are converted to equalities (convert_inequ_to_equ) and the permutation of the entries according to the current basis selection.


    Gc = P_var * [  Gc_orig    Gh_orig   ] * P_equ'
                 [     0          -I     ]

 

This class also comes with a default implementation for the BasisSystemPerm object which is created by a BasisSystemPermFactory object that the client (or the subclass) can specify. The default implementation for this factory object is from BasisSystemPermFactoryStd which uses the AbstractLinAlgPack::BasisSystemPermDirectSparse subclass and supports several different linear solvers by default. The client (or subclass) can augment the list of supported linear solvers easily.

ToDo: Finish documentation!

Subclass developers

Subclass developer's don't have to worry about slack variables or basis permutations. A concreate subclass just has to override the functions that defined the original NLP (see the tutorial example NLP ???).

In addition to the methods that must be overridden in NLPSerialPreprocess (see) the following methods must be overridden as well: imp_Gc_nz_orig(), imp_Gh_nz_orig(), imp_calc_Gc_orig(), imp_calc_Gh_orig().

Definition at line 80 of file NLPInterfacePack_NLPSerialPreprocessExplJac.hpp.


Member Typedef Documentation


Constructor & Destructor Documentation

NLPInterfacePack::NLPSerialPreprocessExplJac::NLPSerialPreprocessExplJac ( const basis_sys_fcty_ptr_t &  basis_sys_fcty = Teuchos::rcp(new BasisSystemFactoryStd()),
const factory_mat_ptr_t factory_Gc_full = Teuchos::null 
)

Calls this->set_basis_sys_fcty() and this->set_mat_factories() methods.

Definition at line 55 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.


Member Function Documentation

NLPInterfacePack::NLPSerialPreprocessExplJac::STANDARD_COMPOSITION_MEMBERS ( BasisSystemFactory  ,
basis_sys_fcty   
)

Set the BasisSystemFactory object used to create the basis system.

void NLPInterfacePack::NLPSerialPreprocessExplJac::set_factory_Gc_full ( const factory_mat_ptr_t factory_Gc_full)

Initialize with matrix factory for original matrices Gc.

This matrix type will be used for AbstractLinAlgPack::MatrixPermAggr::mat_orig() returned by the initialized Gc.

Parameters:
factory_Gc_full[in] Smart pointer to matrix factory for Gc_full. If factory_Gc_full.get() == NULL then the concrete matrix type ??? will be used as the default.

Definition at line 65 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.

void NLPInterfacePack::NLPSerialPreprocessExplJac::set_options ( const options_ptr_t options) [virtual]

Passes these options on to this->basis_sys_fcty().set_options(options).

Reimplemented from NLPInterfacePack::NLP.

Definition at line 79 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.

const NLP::options_ptr_t & NLPInterfacePack::NLPSerialPreprocessExplJac::get_options ( ) const [virtual]

Reimplemented from NLPInterfacePack::NLP.

Definition at line 85 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.

void NLPInterfacePack::NLPSerialPreprocessExplJac::initialize ( bool  test_setup) [virtual]
bool NLPInterfacePack::NLPSerialPreprocessExplJac::is_initialized ( ) const [virtual]
const NLPFirstOrder::mat_fcty_ptr_t NLPInterfacePack::NLPSerialPreprocessExplJac::factory_Gc ( ) const [virtual]
const NLPFirstOrder::basis_sys_ptr_t NLPInterfacePack::NLPSerialPreprocessExplJac::basis_sys ( ) const [virtual]

Calls basis_sys_fcty()->create()

Reimplemented from NLPInterfacePack::NLPFirstOrder.

Definition at line 137 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.

void NLPInterfacePack::NLPSerialPreprocessExplJac::set_Gc ( MatrixOp *  Gc) [virtual]

Validates the type of Gc is correct.

Reimplemented from NLPInterfacePack::NLPFirstOrder.

Definition at line 144 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.

bool NLPInterfacePack::NLPSerialPreprocessExplJac::get_next_basis ( Permutation *  P_var,
Range1D *  var_dep,
Permutation *  P_equ,
Range1D *  equ_decomp 
) [virtual]
void NLPInterfacePack::NLPSerialPreprocessExplJac::set_basis ( const Permutation &  P_var,
const Range1D &  var_dep,
const Permutation *  P_equ,
const Range1D *  equ_decomp 
) [virtual]
void NLPInterfacePack::NLPSerialPreprocessExplJac::imp_calc_Gc ( const Vector x,
bool  newx,
const FirstOrderInfo first_order_info 
) const [protected, virtual]
virtual size_type NLPInterfacePack::NLPSerialPreprocessExplJac::imp_Gc_nz_orig ( ) const [protected, pure virtual]

Return the number of nonzero elements in Gc before elements are removed for fixed variables.

The value returned from this method before the first time imp_calc_Gc() is called is an upper estimate of the number of nonzeros. To get the actual number of nonzeros, call this function again after imp_calc_Gc() has been called.

Implemented in NLPInterfacePack::ExampleNLPBanded, and NLPInterfacePack::NLPWBCounterExample.

virtual size_type NLPInterfacePack::NLPSerialPreprocessExplJac::imp_Gh_nz_orig ( ) const [protected, pure virtual]

Return the number of nonzero elements in Gh before elements are removed for fixed variables.

The value returned from this method before the first time imp_calc_Gh() is called is an upper estimate of the number of nonzeros. To get the actual number of nonzeros, call this function again after imp_calc_Gh() has been called.

Implemented in NLPInterfacePack::ExampleNLPBanded, and NLPInterfacePack::NLPWBCounterExample.

virtual void NLPInterfacePack::NLPSerialPreprocessExplJac::imp_calc_Gc_orig ( const DVectorSlice &  x_full,
bool  newx,
const FirstOrderExplInfo first_order_expl_info 
) const [protected, pure virtual]

Calculate the COOR matrix for the gradient for all of the c(x) constaints in the original NLP.

Parameters:
x_full[in] Unknown vector (size n_full).
newx[in] True if is a new point.
first_order_expl_info[out] Pointers to zero and first order quantities . On output, *first_order_expl_info.Gc_nz must be set to the actual number of nonzero elements in Gc and the array of nonzero entry values *first_order_expl_info.Gc_val must also be set. The nonzero structure must also be set in the arrays *first_order_expl_info.Gc_ivect and *first_order_expl_info.Gc_jvect if first_order_expl_info.Gc_ivect != NULL. In addition, any of the other quantities pointed to in first_order_expl_info may be set on output, but are not guaranteed to be.

Preconditions:

  • first_order_expl_info.Gc_nz != NULL
  • first_order_expl_info.Gc_val != NULL
  • (first_order_expl_info.Gc_ivect != NULL) == (first_order_expl_info.Gc_jvect != NULL)

Postconditions:

  • *first_order_expl_info.Gc_nz is updated to number of nonzero elements set in *first_order_expl_info.Gc_val.
  • (*first_order_expl_info.Gc_val)[k], for k = 1...*first_order_expl_info.Gc_nz is set to the nonzero entry values in Gc.
  • [first_order_expl_info.Gc_ivect != NULL] (*first_order_expl_info.Gc_ivect)[k], for k = 1...*first_order_expl_info.Gc_nz is set to the row indexes for the nonzero entires in Gc.
  • [first_order_expl_info.Gc_jvect != NULL] (*first_order_expl_info.Gc_jvect)[k], for k = 1...*first_order_expl_info.Gc_nz is set to the column indexes for the nonzero entires in Gc.

Note that duplicate entires with the same row and column indexes are allowed. In this case, the matrix entries are considered to be summed.

Implemented in NLPInterfacePack::ExampleNLPBanded, and NLPInterfacePack::NLPWBCounterExample.

virtual void NLPInterfacePack::NLPSerialPreprocessExplJac::imp_calc_Gh_orig ( const DVectorSlice &  x_full,
bool  newx,
const FirstOrderExplInfo first_order_expl_info 
) const [protected, pure virtual]

Calculate the COOR matrix for the gradient for all of the h(x) constaints in the original NLP.

Parameters:
x_full[in] Unknown vector (size n_full).
newx[in] True if is a new point.
first_order_expl_info[out] Pointers to zero and first order quantities . On output, *first_order_expl_info.Gh_nz must be set to the actual number of nonzero elements in Gh and the array of nonzero entry values *first_order_expl_info.Gh_val must also be set. The nonzero structure must also be set in the arrays *first_order_expl_info.Gh_ivect and *first_order_expl_info.Gh_jvect if first_order_expl_info.Gh_ivect != NULL. In addition, any of the other quantities pointed to in first_order_expl_info may be set on output, but are not guaranteed to be.

Preconditions:

  • first_order_expl_info.Gh_nz != NULL
  • first_order_expl_info.Gh_val != NULL
  • (first_order_expl_info.Gh_ivect != NULL) == (first_order_expl_info.Gh_jvect != NULL)

Postconditions:

  • *first_order_expl_info.Gh_nz is updated to number of nonzero elements set in *first_order_expl_info.Gh_val.
  • (*first_order_expl_info.Gh_val)[k], for k = 1...*first_order_expl_info.Gh_nz is set to the nonzero entry values in Gh.
  • [first_order_expl_info.Gh_ivect != NULL] (*first_order_expl_info.Gh_ivect)[k], for k = 1...*first_order_expl_info.Gh_nz is set to the row indexes for the nonzero entires in Gh.
  • [first_order_expl_info.Gh_jvect != NULL] (*first_order_expl_info.Gh_jvect)[k], for k = 1...*first_order_expl_info.Gh_nz is set to the column indexes for the nonzero entires in Gh.

Note that duplicate entires with the same row and column indexes are allowed. In this case, the matrix entries are considered to be summed.

Implemented in NLPInterfacePack::ExampleNLPBanded, and NLPInterfacePack::NLPWBCounterExample.

void NLPInterfacePack::NLPSerialPreprocessExplJac::assert_initialized ( ) const [protected]

Assert if we have been initizlized (throws UnInitialized)

Reimplemented from NLPInterfacePack::NLPSerialPreprocess.

Definition at line 435 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.

const NLPSerialPreprocessExplJac::FirstOrderExplInfo NLPInterfacePack::NLPSerialPreprocessExplJac::first_order_expl_info ( ) const [inline, protected]
void NLPInterfacePack::NLPSerialPreprocessExplJac::imp_calc_Gc_or_Gh ( bool  calc_Gc,
const Vector x,
bool  newx,
const FirstOrderInfo first_order_info 
) const [private]
void NLPInterfacePack::NLPSerialPreprocessExplJac::imp_fill_jacobian_entries ( size_type  n,
size_type  n_full,
bool  load_struct,
const index_type  col_offset,
const value_type *  val_full,
const value_type *  val_full_end,
const index_type *  ivect_full,
const index_type *  jvect_full,
index_type *  nz,
value_type *  val_itr,
index_type *  ivect_itr,
index_type *  jvect_itr 
) const [private]

Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines