42 #ifndef NLP_FULL_TO_REDUCED_H
43 #define NLP_FULL_TO_REDUCED_H
47 #include "NLPInterfacePack_NLPFirstOrder.hpp"
48 #include "NLPInterfacePack_NLPVarReductPerm.hpp"
49 #include "AbstractLinAlgPack_SpVectorClass.hpp"
50 #include "AbstractLinAlgPack_VectorMutableDense.hpp"
51 #include "AbstractLinAlgPack_PermutationSerial.hpp"
52 #include "DenseLinAlgPack_DVectorClass.hpp"
53 #include "DenseLinAlgPack_IVector.hpp"
55 namespace NLPInterfacePack {
232 {
public:
InconsistantBounds(
const std::string& what_arg) : std::logic_error(what_arg) {}};
311 const Permutation&
P_var()
const;
313 const Permutation&
P_equ()
const;
413 :
f(f_in),
c(c_in),
h(h_in)
438 :
Gf(Gf_in),
f(first_order_info_in.
f),
c(first_order_info_in.
c),
h(first_order_info_in.
h)
480 virtual const DVectorSlice
imp_xl_orig()
const = 0;
490 virtual const DVectorSlice
imp_xu_orig()
const = 0;
498 virtual const DVectorSlice
imp_hl_orig()
const = 0;
506 virtual const DVectorSlice
imp_hu_orig()
const = 0;
510 const DVectorSlice &
x_full
517 const DVectorSlice &
x_full
524 const DVectorSlice &
x_full
540 const DVectorSlice &
x_full
607 IVector *var_perm_full
608 ,IVector *equ_perm_full
624 const DVectorSlice &
x_full
625 ,
const DVectorSlice *lambda_orig
626 ,
const DVectorSlice *lambdaI_orig
627 ,
const DVectorSlice *nu_orig
644 void set_x_full(
const DVectorSlice& x,
bool newx, DVectorSlice*
x_full)
const;
647 DVectorSlice
x_full()
const;
715 void var_from_full( DVectorSlice::const_iterator vec_full, DVectorSlice::iterator vec )
const;
718 void var_to_full(DVectorSlice::const_iterator vec, DVectorSlice::iterator vec_full)
const;
722 const DVectorSlice &c_orig
723 ,
const DVectorSlice &h_orig
724 ,
const DVectorSlice &s_orig
725 ,DVectorSlice *c_full
735 mutable value_type f_orig_;
736 mutable DVector c_orig_;
737 mutable DVector h_orig_;
738 mutable DVector Gf_full_;
743 bool force_xinit_in_bounds_;
749 IVector var_full_to_fixed_;
758 IVector inv_var_full_to_fixed_;
778 IVector inv_equ_perm_;
782 mutable DVector x_full_;
794 VectorSpaceSerial space_x_;
795 VectorSpaceSerial space_c_;
796 VectorSpaceSerial space_c_breve_;
797 VectorSpaceSerial space_h_breve_;
799 VectorMutableDense xinit_;
800 VectorMutableDense xl_;
801 VectorMutableDense xu_;
802 VectorMutableDense hl_breve_;
803 VectorMutableDense hu_breve_;
804 PermutationSerial P_var_;
805 PermutationSerial P_equ_;
814 int basis_selection_num_;
822 bool get_next_basis_remove_fixed(
828 void assert_and_set_basis(
832 void assert_bounds_on_variables()
const;
835 void do_force_xinit_in_bounds();
847 initialized_ =
false;
873 return var_full_to_fixed_;
879 return inv_var_full_to_fixed_;
897 return inv_equ_perm_;
902 #endif // NLP_FULL_TO_REDUCED_H
NLP interface class that adds gradient information for the objective function {abstract}.
size_type num_bounded_x() const
void set_basis(const Permutation &P_var, const Range1D &var_dep, const Permutation *P_equ, const Range1D *equ_decomp)
virtual bool imp_nlp_has_changed() const
Return if the definition of the NLP has changed since the last call to initialize() ...
value_type * f
Pointer to objective function f (may be NULL if not set)
Struct for gradient (objective), objective and constriants (pointers)
const IVector & var_full_to_remove_fixed() const
Inverse permutation vector of var_remove_fixed_to_full().
void imp_calc_h_breve(const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info_breve) const
virtual size_type imp_m_orig() const =0
Return the number of general equality constraints in the original problem.
bool is_initialized() const
const Permutation & P_var() const
value_type scale_f() const
const IVector & equ_perm() const
Permutes from the original constriant ordering to the current basis selection.
const IVector & var_remove_fixed_to_full() const
Permutation vector for partitioning free and fixed variables.
const Vector & xl() const
virtual size_type ns() const
Range1D equ_decomp() const
const Permutation & P_equ() const
const perm_fcty_ptr_t factory_P_equ() const
DVector * h
Pointer to constraints residual h (may be NULL if not set)
NLPSerialPreprocess()
Default Constructor.
vec_space_ptr_t space_x() const
virtual size_type imp_n_orig() const =0
Return the number of variables in the original problem (including those fixed by bounds) ...
DVector * c
Pointer to constraints residual c (may be NULL if not set)
void set_not_initialized()
Used by subclasses to set the state of the NLP to not initialized.
const ZeroOrderInfo zero_order_info() const
Return pointer to set quantities.
vec_space_ptr_t space_c() const
const ObjGradInfo obj_grad_info() const
Return objective gradient and zero order information.
vec_space_ptr_t space_h_breve() const
virtual void imp_calc_c_orig(const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info) const =0
Calculate the vector for all of the general equality constaints in the original NLP.
NLP interface class that adds variable and constriant permutations for variable reduction basis selec...
const IVector & var_perm() const
Permutes from the compated variable vector (removing fixed variables) to the current basis selection...
NLP node implementation subclass for preprocessing and basis manipulation.
DVectorSlice x_full() const
Give reference to current x_full.
const ObjGradInfoSerial obj_grad_orig_info() const
value_type * f
Pointer to objective function f (may be NULL if not set)
virtual void imp_calc_Gf_orig(const DVectorSlice &x_full, bool newx, const ObjGradInfoSerial &obj_grad_info) const =0
Calculate the vector for the gradient of the objective in the original NLP.
virtual void imp_calc_h_orig(const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info) const =0
Calculate the vector for all of the general inequality constaints in the original NLP...
void report_final_solution(const Vector &x, const Vector *lambda, const Vector *nu, bool is_optimal)
Overridden to permute the variables back into an order that is natural to the subclass.
void get_basis(Permutation *P_var, Range1D *var_dep, Permutation *P_equ, Range1D *equ_decomp) const
bool force_xinit_in_bounds() const
virtual const DVectorSlice imp_xinit_orig() const =0
Return the original initial point (size imp_n_orig()).
void imp_calc_f(const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info) const
virtual const DVectorSlice imp_xu_orig() const =0
Return the original upper variable bounds (size imp_n_orig()).
bool nlp_selects_basis() const
const Vector & xu() const
const ZeroOrderInfo zero_order_info_breve() const
Return pointer to set hat quantities.
void initialize(bool test_setup)
Struct for objective and constriants (pointer) as serial vectors.
void imp_calc_c(const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info) const
const Vector & xinit() const
DVector * Gf
Gradient of objective function Gf (may be NULL if not set)
ZeroOrderInfoSerial(value_type *f_in, DVector *c_in, DVector *h_in)
Teuchos::RCP< const Teuchos::AbstractFactory< Permutation > > perm_fcty_ptr_t
virtual bool imp_has_var_bounds() const =0
Return if the NLP has bounds.
void assert_initialized() const
Assert if we have been initizlized (throws UnInitialized)
Struct for objective and constriants (pointer).
virtual void imp_report_orig_final_solution(const DVectorSlice &x_full, const DVectorSlice *lambda_orig, const DVectorSlice *lambdaI_orig, const DVectorSlice *nu_orig, bool optimal)
To be overridden by subclasses to report the final solution in the original ordering natural to the s...
DVector * c
Pointer to constraints residual c (may be NULL if not set)
virtual const DVectorSlice imp_hu_orig() const =0
Return the original upper general inequality bounds (size imp_mI_orig()).
const Vector & hu_breve() const
virtual void imp_calc_f_orig(const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info) const =0
Calculate the objective function for the original NLP.
Range1D equ_undecomp() const
virtual size_type imp_mI_orig() const =0
Return the number of general inequality constraints in the original problem.
void imp_calc_c_breve(const Vector &x, bool newx, const ZeroOrderInfo &zero_order_info_breve) const
const perm_fcty_ptr_t factory_P_var() const
const IVector & inv_equ_perm() const
Inverse of equ_perm()
Struct for serial gradient (objective), objective and constriants (pointers)
virtual bool imp_get_next_basis(IVector *var_perm_full, IVector *equ_perm_full, size_type *rank_full, size_type *rank)
Return the next basis selection (default returns false).
const ZeroOrderInfoSerial zero_order_orig_info() const
const Vector & hl_breve() const
void get_init_lagrange_mult(VectorMutable *lambda, VectorMutable *nu) const
virtual const DVectorSlice imp_xl_orig() const =0
Return the original lower variable bounds (size imp_n_orig()).
Range1D var_indep() const
void set_x_full(const DVectorSlice &x, bool newx, DVectorSlice *x_full) const
Set the full x vector if newx == true
static value_type fixed_var_mult()
Gives the value of a Lagrange multipler for a fixed variable bound .that has been preprocessed out of...
ObjGradInfoSerial(DVector *Gf_in, const ZeroOrderInfoSerial &first_order_info_in)
DVector * h
Pointer to constraints residual h (may be NULL if not set)
virtual const DVectorSlice imp_hl_orig() const =0
Return the original lower general inequality bounds (size imp_mI_orig()).
vec_space_ptr_t space_c_breve() const
void imp_calc_Gf(const Vector &x, bool newx, const ObjGradInfo &obj_grad_info) const
bool get_next_basis(Permutation *P_var, Range1D *var_dep, Permutation *P_equ, Range1D *equ_decomp)