63 class init_rtop_server_t {
65 init_rtop_server_t() {
69 init_rtop_server_t init_rtop_server;
73 namespace NLPInterfacePack {
76 const VectorSpace::space_ptr_t& vec_space
83 namespace rcp = MemMngPack;
160 x.
dim() !=
n, std::invalid_argument
161 ,
"ExampleNLPDirect::calc_point(...), Error x.dim() = " << x.
dim()
162 <<
" != n = " <<
n );
164 c && !this->
space_c()->is_compatible(c->
space()), std::invalid_argument
165 ,
"ExampleNLPDirect::calc_point(...), Error c is not compatible" );
166 TEUCHOS_TEST_FOR_EXCEPTION(
167 Gf && !this->
space_x()->is_compatible(Gf->
space()), std::invalid_argument
168 ,
"ExampleNLPDirect::calc_point(...), Error, Gf is not compatible" );
169 TEUCHOS_TEST_FOR_EXCEPTION(
170 py && !this->
space_x()->sub_space(this->
var_dep())->is_compatible(py->
space()), std::invalid_argument
171 ,
"ExampleNLPDirect::calc_point(...), Error, py is not compatible" );
172 TEUCHOS_TEST_FOR_EXCEPTION(
173 rGf && !this->
space_x()->sub_space(this->
var_dep())->is_compatible(rGf->
space()), std::invalid_argument
174 ,
"ExampleNLPDirect::calc_point(...), Error, py is not compatible" );
175 TEUCHOS_TEST_FOR_EXCEPTION(
176 GcU, std::invalid_argument
177 ,
"ExampleNLPDirect::calc_point(...), Error, there are no undecomposed equalities" );
178 TEUCHOS_TEST_FOR_EXCEPTION(
179 D && !dynamic_cast<MatrixSymDiagStd*>(D), std::invalid_argument
180 ,
"ExampleNLPDirect::calc_point(...), Error, D is not compatible" );
181 TEUCHOS_TEST_FOR_EXCEPTION(
182 py!=NULL && c==NULL, std::invalid_argument
183 ,
"ExampleNLPDirect::calc_point(...) : "
184 "Error, if py!=NULL then c!=NULL must also be true" );
193 VectorSpace::vec_mut_ptr_t Gf_ptr;
195 Gf_ptr = this->
space_x()->create_member();
200 mat_fcty_ptr_t::element_type::obj_ptr_t D_ptr;
211 const_cast<this_t*
>(
this)->
set_f(f);
212 const_cast<this_t*
>(
this)->
set_c(c);
213 const_cast<this_t*
>(
this)->
set_Gf(Gf);
221 const_cast<this_t*
>(
this)->
set_f(f_saved);
222 const_cast<this_t*
>(
this)->
set_c(c_saved);
223 const_cast<this_t*
>(
this)->
set_Gf(Gf_saved);
242 *D_diag =
dynamic_cast<MatrixSymDiagStd*
>(D);
249 if ( py && !D ) task = 0;
250 else if( !py && D ) task = 1;
251 else if( py && D ) task = 2;
255 const int num_vecs = task < 2 ? 2 : 3;
256 const Vector* vecs[3] = { NULL, NULL, NULL };
257 const int num_targ_vecs = task < 2 ? 1 : 2;
262 D_diag->init_identity( *this->
space_c(), 0.0 );
263 targ_vecs[0]= &D_diag->diag();
275 vecs[k] = xD.
get(); ++k;
276 if(D) { vecs[k] = xI.get(); ++k; }
277 if(py) { vecs[k] =
c; ++k; }
280 explnlp2_calc_py_D_op, num_vecs, vecs, num_targ_vecs, num_targ_vecs?targ_vecs:NULL
300 calc_point(x,NULL,c,recalc_c,NULL,py,NULL,NULL,NULL,NULL);
virtual vec_ptr_t sub_view(const Range1D &rng) const
Create an abstract view of a vector object .
AbstractLinAlgPack::size_type size_type
virtual vec_mut_ptr_t sub_view(const Range1D &rng)
Create a mutable abstract view of a vector object.
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...
void initialize(bool test_setup)
void assert_is_initialized() const
virtual const VectorSpace & space() const =0
Return the vector space that this vector belongs to.
Adapter subclass that uses a RTOp_RTOp object.
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
void calc_semi_newton_step(const Vector &x, VectorMutable *c, bool recalc_c, VectorMutable *py) const
const mat_fcty_ptr_t factory_D() const
void set_factories(const mat_sym_fcty_ptr_t &factory_transDtD, const mat_sym_nonsing_fcty_ptr_t &factory_S)
Initialize the factory objects for the special matrices for D'*D and S = I + D'*D.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
int RTOp_TOp_explnlp2_calc_py_D_set_task(int task, struct RTOp_RTOp *op)
virtual Range1D var_dep() const
virtual VectorMutable * get_Gf()
Return pointer passed to this->set_Gf().
void Vp_MtV(VectorMutable *v_lhs, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const V &V_rhs2)
v_lhs += op(M_rhs1) * V_rhs2.
ExampleNLPDirect(const VectorSpace::space_ptr_t &vec_space, value_type xo, bool has_bounds, bool dep_bounded)
Constructor.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
int RTOp_TOp_explnlp2_calc_py_D_construct(int task, struct RTOp_RTOp *op)
void initialize(bool test_setup)
Initialize the NLP for its first use.
T_To & dyn_cast(T_From &from)
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.
virtual void set_c(VectorMutable *c)
Set a pointer to a vector to be updated when this->calc_c() is called.
Simple example NLP subclass to illustrate how to implement the NLPObjGrad interface for a specialized...
bool is_initialized() const
virtual value_type * get_f()
Return pointer passed to this->set_f().
virtual Range1D var_indep() const
vec_space_ptr_t space_x() const
virtual index_type dim() const
Return the dimension of this vector.
void initialize(bool test_setup)
AbstractLinAlgPack::value_type value_type
Abstract interface for mutable coordinate vectors {abstract}.
virtual obj_ptr_t create() const =0
void apply_op(EApplyBy apply_by, const RTOpPack::RTOp &primary_op, const size_t num_multi_vecs, const MultiVector *multi_vecs[], const size_t num_targ_multi_vecs, MultiVectorMutable *targ_multi_vecs[], RTOpPack::ReductTarget *reduct_objs[]=NULL, const index_type primary_first_ele=1, const index_type primary_sub_dim=0, const index_type primary_global_offset=0, const index_type secondary_first_ele=1, const index_type secondary_sub_dim=0)
Apply a reduction/transformation operator column by column and return an array of the reduction objec...
vec_space_ptr_t space_c() const
Simple example NLP subclass to illustrate how to implement the NLPDirect interface for a specialized ...
virtual VectorMutable * get_c()
Return pointer passed to this->set_c().
virtual void set_Gf(VectorMutable *Gf)
Set a pointer to a vector to be updated when this->calc_Gf() is called.
RangePack::Range1D Range1D
virtual void set_f(value_type *f)
Set a pointer to an value to be updated when this->calc_f() is called.
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.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
mat_fcty_ptr_t factory_D_
void calc_point(const Vector &x, value_type *f, VectorMutable *c, bool recalc_c, VectorMutable *Gf, VectorMutable *py, VectorMutable *rGf, MatrixOp *GcU, MatrixOp *D, MatrixOp *Uz) const
virtual VectorMutable & c()
Returns non-const *this->get_c().
Range1D var_indep() const