44 #include "NLPInterfacePack_NLP.hpp"
45 #include "AbstractLinAlgPack_VectorMutable.hpp"
46 #include "AbstractLinAlgPack_VectorSpace.hpp"
47 #include "Teuchos_Assert.hpp"
50 const char name_f[] =
"f";
51 const char name_c[] =
"c";
52 const char name_c_breve[] =
"c_breve";
53 const char name_h_breve[] =
"h_breve";
57 namespace NLPInterfacePack {
88 num_f_evals_ = num_c_evals_ = 0;
102 VectorSpace::space_ptr_t spc = this->
space_c();
103 return spc.get() ? spc->dim() : 0;
135 first_order_info_.
f =
f;
140 return StandardCompositionRelationshipsPack::get_role_name(first_order_info_.
f,
false, name_f);
145 return StandardCompositionRelationshipsPack::role_name(first_order_info_.
f,
false, name_f);
150 return StandardCompositionRelationshipsPack::role_name(first_order_info_.
f,
false, name_f);
161 first_order_info_.
c =
c;
169 return StandardCompositionRelationshipsPack::get_role_name(first_order_info_.
c,
false, name_c);
177 return StandardCompositionRelationshipsPack::role_name(first_order_info_.
c,
false, name_c);
185 return StandardCompositionRelationshipsPack::role_name(first_order_info_.
c,
false, name_c);
200 StandardCompositionRelationshipsPack::assert_role_name_set(first_order_info_.
f,
"NLP::calc_f()", name_f);
210 StandardCompositionRelationshipsPack::assert_role_name_set(first_order_info_.
c,
"NLP::calc_c()", name_c);
243 return space_h_breve.
get() ? space_h_breve->dim() : 0;
253 return Teuchos::null;
259 true, std::logic_error
260 ,
"NLP::hl_breve(): Error, this method must be overridden if space_h_breve is defined" );
274 true, std::logic_error
275 ,
"NLP::hl_breve(): Error, this method must be overridden if space_h_breve is defined" );
292 first_order_info_breve_.
c =
c_breve;
300 return first_order_info_breve_.
c;
308 return StandardCompositionRelationshipsPack::role_name(first_order_info_breve_.
c,
false, name_c_breve);
316 return StandardCompositionRelationshipsPack::role_name(first_order_info_breve_.
c,
false, name_c_breve);
325 first_order_info_breve_.
c =
h_breve;
333 return first_order_info_breve_.
h;
341 return StandardCompositionRelationshipsPack::role_name(first_order_info_breve_.
c,
false, name_h_breve);
349 return StandardCompositionRelationshipsPack::role_name(first_order_info_breve_.
c,
false, name_h_breve);
371 StandardCompositionRelationshipsPack::assert_role_name_set(first_order_info_breve_.
c,
"NLP::calc_c_breve()", name_c_breve);
381 StandardCompositionRelationshipsPack::assert_role_name_set(first_order_info_breve_.
h,
"NLP::calc_h_breve()", name_h_breve);
404 true, std::logic_error
405 ,
"NLP::hl_breve(): Error, this method must be overridden if space_h_breve is defined" );
virtual value_type & f()
Returns non-const *this->get_f().
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...
VectorMutable * c
Pointer to constraints residual c (Will be NULL if not set)
virtual size_type ns() const
Return the number of slack variables (i.e. number of general inequalities).
virtual const VectorSpace & space() const =0
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.
virtual size_type num_c_evals() const
Gives the number of constraint function c(x) evaluations called by the solver since initialize() was ...
virtual VectorMutable & c_breve()
Returns non-const *this->get_c_breve().
virtual VectorMutable * get_c_breve()
Return pointer passed to this->set_c_breve().
virtual vec_space_ptr_t space_x() const =0
Vector space object for unknown variables x (dimension n).
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual vec_space_ptr_t space_c_breve() const
Vector space object for the original equalities c_breve(x_breve)
virtual void get_init_lagrange_mult(VectorMutable *lambda, VectorMutable *nu) const
Get the initial value of the Lagrange multipliers lambda.
const ZeroOrderInfo zero_order_info() const
Return pointer to set quantities.
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)
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).
virtual void set_options(const options_ptr_t &options)
Set the options that this NLP may be interested in.
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).
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)...
virtual void unset_quantities()
Call to unset all storage quantities (both in this class and all subclasses).
virtual const Vector & hl_breve() const
Returns a reference to the vector of lower bounds on the general inequality constraints h_breve(x_bre...
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 size_type n() const
Return the number of variables.
virtual vec_space_ptr_t space_c() const =0
Vector space object for general equality constraints c(x) (dimension m).
const ZeroOrderInfo zero_order_info_breve() const
Return pointer to set hat quantities.
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...
virtual void set_c(VectorMutable *c)
Set a pointer to a vector to be updated when this->calc_c() is called.
virtual value_type * get_f()
Return pointer passed to this->set_f().
Teuchos::RCP< const VectorSpace > vec_space_ptr_t
virtual ~NLP()
Destructor that cleans all the memory it owns.
Struct for objective and constriants (pointer).
virtual const options_ptr_t & get_options() const
Get the OptionsFromStream object being used to extract the options from.
virtual vec_space_ptr_t space_h_breve() const
Vector space object for the original inequalities h_breve(x_breve)
virtual const Permutation & P_var() const
Return the permutation object for the variables.
NLP()
Initialize to no reference set to calculation quanities.
virtual void set_c_breve(VectorMutable *c_breve)
Set a pointer to a vector to be updated when this->calc_c_breve() is called.
virtual const Permutation & P_equ() const
Return the permutation object for the constraints.
virtual const Vector & hu_breve() const
Returns a reference to the vector of upper bounds on the general inequality constraints h_breve(x_bre...
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...
value_type * f
Pointer to objective function f (Will be NULL if not set)
virtual void set_h_breve(VectorMutable *h_breve)
Set a pointer to a vector to be updated when this->calc_h_breve() is called.
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...
virtual size_type m() const
Return the number of general equality constraints.
virtual void initialize(bool test_setup=false)
Initialize the NLP before it is used.
virtual size_type num_f_evals() const
Gives the number of object function f(x) evaluations called by the solver since initialize() was call...
virtual VectorMutable * get_h_breve()
Return pointer passed to this->set_h_breve().
static value_type infinite_bound()
Value for an infinite bound.
virtual VectorMutable * get_c()
Return pointer passed to this->set_c().
VectorMutable * h
Pointer to inequality constraints h (Will be NULL if not set)
virtual void set_f(value_type *f)
Set a pointer to an value to be updated when this->calc_f() is called.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
virtual VectorMutable & c()
Returns non-const *this->get_c().
virtual VectorMutable & h_breve()
Returns non-const *this->get_h_breve().