45 #include "MoochoPack_NLPAlgoState.hpp"
46 #include "ConstrainedOptPack_MeritFuncNLP.hpp"
47 #include "AbstractLinAlgPack_MatrixSymOp.hpp"
48 #include "AbstractLinAlgPack_MatrixOpNonsing.hpp"
49 #include "Teuchos_dyn_cast.hpp"
51 #include "IterationPack_IterQuantityAccess.hpp"
52 #include "IterationPack_cast_iq.hpp"
53 #include "IterationPack_IterQuantityAccessContiguous.hpp"
58 const std::string MoochoPack::num_basis_name =
"num_basis";
60 const std::string MoochoPack::x_name =
"x";
61 const std::string MoochoPack::f_name =
"f";
62 const std::string MoochoPack::Gf_name =
"Gf";
63 const std::string MoochoPack::HL_name =
"HL";
64 const std::string MoochoPack::c_name =
"c";
65 const std::string MoochoPack::Gc_name =
"Gc";
67 const std::string MoochoPack::Y_name =
"Y";
68 const std::string MoochoPack::Z_name =
"Z";
69 const std::string MoochoPack::R_name =
"R";
70 const std::string MoochoPack::Uy_name =
"Uy";
71 const std::string MoochoPack::Uz_name =
"Uz";
73 const std::string MoochoPack::py_name =
"py";
74 const std::string MoochoPack::Ypy_name =
"Ypy";
75 const std::string MoochoPack::pz_name =
"pz";
76 const std::string MoochoPack::Zpz_name =
"Zpz";
77 const std::string MoochoPack::d_name =
"d";
79 const std::string MoochoPack::rGf_name =
"rGf";
80 const std::string MoochoPack::rHL_name =
"rHL";
81 const std::string MoochoPack::w_name =
"w";
82 const std::string MoochoPack::zeta_name =
"zeta";
83 const std::string MoochoPack::qp_grad_name =
"qp_grad";
84 const std::string MoochoPack::eta_name =
"eta";
86 const std::string MoochoPack::alpha_name =
"alpha";
87 const std::string MoochoPack::merit_func_nlp_name =
"merit_func_nlp";
88 const std::string MoochoPack::mu_name =
"mu";
89 const std::string MoochoPack::phi_name =
"phi";
91 const std::string MoochoPack::opt_kkt_err_name =
"opt_kkt_err";
92 const std::string MoochoPack::feas_kkt_err_name =
"feas_kkt_err";
93 const std::string MoochoPack::comp_kkt_err_name =
"comp_kkt_err";
94 const std::string MoochoPack::GL_name =
"GL";
95 const std::string MoochoPack::rGL_name =
"rGL";
96 const std::string MoochoPack::lambda_name =
"lambda";
97 const std::string MoochoPack::nu_name =
"nu";
99 namespace MoochoPack {
105 space_range_ = space_range;
106 update_vector_factories(VST_SPACE_RANGE,space_range);
111 space_null_ = space_null;
112 update_vector_factories(VST_SPACE_NULL,space_null);
116 const decomp_sys_ptr_t& decomp_sys
122 :decomp_sys_(decomp_sys)
125 ,space_range_(space_range)
126 ,space_null_(space_null)
146 STATE_IQ_DEF( NLPAlgoState, MatrixOpNonsing, R, R_name )
161 STATE_IQ_DEF( NLPAlgoState, MatrixSymOp, rHL, rHL_name )
164 STATE_VECTOR_IQ_DEF( NLPAlgoState, qp_grad, qp_grad_name, get_space_null(), VST_SPACE_NULL )
170 STATE_IQ_DEF( NLPAlgoState, MeritFuncNLP, merit_func_nlp, merit_func_nlp_name )
186 void NLPAlgoState::update_iq_id(
187 const std::
string& iq_name
191 namespace rcp = MemMngPack;
192 if(iq_id->iq_id == DOES_NOT_EXIST)
193 iq_id->iq_id = this->get_iter_quant_id(iq_name);
196 ,
"NLPAlgoState::update_iq_id(iq_name,iq_id) : Error, "
197 " The iteration quantity with name \'" << iq_name <<
198 "\' does not exist!" );
202 const std::string& iq_name
206 namespace rcp = MemMngPack;
207 if(iq_id->iq_id == DOES_NOT_EXIST) {
210 if(_iq_id == DOES_NOT_EXIST) {
214 new IterQuantityAccessContiguous<index_type>(
226 iq_id->iq_id = _iq_id;
232 const std::string& iq_name
236 namespace rcp = MemMngPack;
237 if(iq_id->iq_id == DOES_NOT_EXIST) {
240 if(_iq_id == DOES_NOT_EXIST) {
244 new IterQuantityAccessContiguous<value_type>(
256 iq_id->iq_id = _iq_id;
262 const std::string& iq_name
263 ,
const VectorSpace::space_ptr_t& vec_space
264 ,EVecSpaceType vec_space_type
268 namespace rcp = MemMngPack;
269 if(iq_id->iq_id == DOES_NOT_EXIST) {
272 if(_iq_id == DOES_NOT_EXIST) {
276 new IterQuantityAccessContiguous<VectorMutable>(
285 iq_id->iq_id = _iq_id;
288 vector_iqs_lists_[vec_space_type].push_back(iq_id->iq_id);
294 void NLPAlgoState::update_vector_factories(
295 EVecSpaceType vec_space_type
296 ,
const vec_space_ptr_t& vec_space
300 iq_vector_list_t &iq_vector_list = vector_iqs_lists_[vec_space_type];
301 for( iq_vector_list_t::const_iterator iq_itr = iq_vector_list.begin(); iq_itr != iq_vector_list.end(); ++iq_itr )
302 dyn_cast<IterQuantityAccessContiguous<VectorMutable> >(this->
iter_quant(*iq_itr)).set_factory(vec_space);
#define STATE_SCALAR_IQ_DEF(CLASS, NAME, NAME_STR)
Add class definitions for a value_type iteration quantity.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
T_To & dyn_cast(T_From &from)
#define STATE_INDEX_IQ_DEF(CLASS, NAME, NAME_STR)
Add class definitions for a index_type iteration quantity.
void update_vector_iq_id(const std::string &iq_name, const VectorSpace::space_ptr_t &vec_space, EVecSpaceType vec_space_type, iq_id_encap *iq_id)
virtual iq_id_type set_iter_quant(const std::string &iq_name, const IQ_ptr &iq)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
#define STATE_VECTOR_IQ_DEF(CLASS, NAME, NAME_STR, VEC_SPC, VEC_RN)
Add class definitions for a VectorMutable iteration quantity.
virtual IterQuantity & iter_quant(const std::string &iq_name)
void update_value_type_iq_id(const std::string &iq_name, iq_id_encap *iq_id)
Reduced space SQP state encapsulation interface.
virtual iq_id_type get_iter_quant_id(const std::string &iq_name) const
#define STATE_IQ_DEF(CLASS, TYPE, NAME, NAME_STR)
Add class definitions for an arbitrary iteration quantity.
void set_space_null(const vec_space_ptr_t &space_null)
Set the VectorSpace of the null space (pz).
void update_index_type_iq_id(const std::string &iq_name, iq_id_encap *iq_id)
NLPAlgoState(const decomp_sys_ptr_t &decomp_sys=Teuchos::null, const vec_space_ptr_t &space_x=Teuchos::null, const vec_space_ptr_t &space_c=Teuchos::null, const vec_space_ptr_t &space_range=Teuchos::null, const vec_space_ptr_t &space_null=Teuchos::null)
Construct.
void set_space_range(const vec_space_ptr_t &space_range)
Set the VectorSpace of the range space (py).