|
NLPInterfacePack: C++ Interfaces and Implementation for Non-Linear Programs
Version of the Day
|
NLP node subclass complementing NLPSerialPreprocess for explicit Jacobians.
More...
#include <NLPInterfacePack_NLPSerialPreprocessExplJac.hpp>

Classes | |
| struct | FirstOrderExplInfo |
| Struct for zero and explicit first order quantities that subclass must fill in. More... | |
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_t & | get_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 |
| | |
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 93 of file NLPInterfacePack_NLPSerialPreprocessExplJac.hpp.
| typedef Teuchos::RCP< const Teuchos::AbstractFactory<MatrixOp> > NLPInterfacePack::NLPSerialPreprocessExplJac::factory_mat_ptr_t |
Definition at line 104 of file NLPInterfacePack_NLPSerialPreprocessExplJac.hpp.
| 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 68 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| 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.
| 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 78 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| void NLPInterfacePack::NLPSerialPreprocessExplJac::set_options | ( | const options_ptr_t & | options | ) |
Passes these options on to this->basis_sys_fcty().set_options(options).
Definition at line 92 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| const NLP::options_ptr_t & NLPInterfacePack::NLPSerialPreprocessExplJac::get_options | ( | ) | const [virtual] |
Reimplemented from NLPInterfacePack::NLP.
Definition at line 98 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| void NLPInterfacePack::NLPSerialPreprocessExplJac::initialize | ( | bool | test_setup | ) | [virtual] |
Reimplemented from NLPInterfacePack::NLPFirstOrder.
Definition at line 103 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| bool NLPInterfacePack::NLPSerialPreprocessExplJac::is_initialized | ( | ) | const [virtual] |
Reimplemented from NLPInterfacePack::NLPSerialPreprocess.
Definition at line 137 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| const NLPFirstOrder::mat_fcty_ptr_t NLPInterfacePack::NLPSerialPreprocessExplJac::factory_Gc | ( | ) | const [virtual] |
Implements NLPInterfacePack::NLPFirstOrder.
Definition at line 144 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| const NLPFirstOrder::basis_sys_ptr_t NLPInterfacePack::NLPSerialPreprocessExplJac::basis_sys | ( | ) | const [virtual] |
Calls basis_sys_fcty()->create()
Reimplemented from NLPInterfacePack::NLPFirstOrder.
Definition at line 150 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 157 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| bool NLPInterfacePack::NLPSerialPreprocessExplJac::get_next_basis | ( | Permutation * | P_var, |
| Range1D * | var_dep, | ||
| Permutation * | P_equ, | ||
| Range1D * | equ_decomp | ||
| ) | [virtual] |
Reimplemented from NLPInterfacePack::NLPSerialPreprocess.
Definition at line 169 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| void NLPInterfacePack::NLPSerialPreprocessExplJac::set_basis | ( | const Permutation & | P_var, |
| const Range1D & | var_dep, | ||
| const Permutation * | P_equ, | ||
| const Range1D * | equ_decomp | ||
| ) | [virtual] |
Reimplemented from NLPInterfacePack::NLPSerialPreprocess.
Definition at line 183 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| void NLPInterfacePack::NLPSerialPreprocessExplJac::imp_calc_Gc | ( | const Vector & | x, |
| bool | newx, | ||
| const FirstOrderInfo & | first_order_info | ||
| ) | const [protected, virtual] |
Implements NLPInterfacePack::NLPFirstOrder.
Definition at line 196 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| void NLPInterfacePack::NLPSerialPreprocessExplJac::assert_initialized | ( | ) | const [protected] |
Assert if we have been initizlized (throws UnInitialized)
Reimplemented from NLPInterfacePack::NLPSerialPreprocess.
Definition at line 448 of file NLPInterfacePack_NLPSerialPreprocessExplJac.cpp.
| const NLPSerialPreprocessExplJac::FirstOrderExplInfo NLPInterfacePack::NLPSerialPreprocessExplJac::first_order_expl_info | ( | ) | const [inline, protected] |
Definition at line 458 of file NLPInterfacePack_NLPSerialPreprocessExplJac.hpp.
1.7.6.1