49 namespace NLPInterfacePack {
66 ,
bool nlp_selects_basis
72 ,
bool ignore_constraints
74 :is_initialized_(false)
75 ,nlp_selects_basis_(nlp_selects_basis)
76 ,basis_selection_was_given_(false)
77 ,has_var_bounds_(false)
84 ,ignore_constraints_(ignore_constraints)
85 ,diag_scal_(diag_scal)
86 ,diag_vary_(diag_vary)
87 ,fu_( sym_basis ? 3 : 6 )
90 const char msg_err_head[] =
"ExampleNLPBanded::ExampleNLPBanded(...) : Error";
92 nD <= 0, std::invalid_argument
95 nI <= 0 || nD < nI, std::invalid_argument
98 bw < 1 || nD < bw, std::invalid_argument
101 mU < 0, std::invalid_argument
102 ,msg_err_head<<
"!" );
104 mI < 0, std::invalid_argument
105 ,msg_err_head<<
"!" );
107 mU != 0, std::invalid_argument
108 ,msg_err_head<<
", can't handle undecomposed equalities yet!" );
132 if( xDl > -inf || xDu < +inf || xIl > -inf || xIu < +inf )
237 &
c = *zero_order_info.
c;
246 const size_type num_I_per_D_local = num_I_per_D + ( q_i <= I_remainder ? 1 : 0 );
247 for(
size_type q_k = 0; q_k < num_I_per_D_local; ++q_k ) {
250 klu = ( j -
bw_ >= 0 ? bw_-1 : j-1 ),
251 kuu = ( j + bw_ - 1 <=
nD_ ? bw_-1 :
nD_-j );
253 ds_j = ds_alpha * (j-1) + ds_beta;
255 &c_j = (
c(j) = ds_j *
x_full(j));
257 c_j -= (3.0 / k) *
x_full(j-k);
264 c_j *= (term * term);
279 &h = *zero_order_info.
h;
286 const size_type num_I_per_D_local = num_I_per_D + ( q_i <= I_remainder ? 1 : 0 );
287 for(
size_type q_k = 0; q_k < num_I_per_D_local; ++q_k ) {
289 if( jI >
mI_ )
return;
303 (*obj_grad_info.
Gf)(var_orig) =
x_full(var_orig);
307 IVector *var_perm_full
308 ,IVector *equ_perm_full
328 var_perm_full->resize(n_full);
329 equ_perm_full->resize(m_full);
333 for( k = 1; k <=
nD_; ++k, ++i_perm )
334 (*var_perm_full)(i_perm) = k;
335 for( k = 1; k <=
mI_; ++k, ++i_perm )
336 (*var_perm_full)(i_perm) = n_orig + k;
338 for( k = 1; k <=
nI_; ++k, ++i_perm )
339 (*var_perm_full)(i_perm) =
nD_ + k;
360 *rank = m_full - num_fixed;
403 &
c = *first_order_expl_info.
c;
406 &Gc_nz = *first_order_expl_info.
Gc_nz;
408 *Gc_val = &(*first_order_expl_info.
Gc_val)[0];
410 *Gc_ivect = ( first_order_expl_info.
Gc_ivect
411 ? &(*first_order_expl_info.
Gc_ivect)[0] : NULL ),
412 *Gc_jvect = ( first_order_expl_info.
Gc_jvect
413 ? &(*first_order_expl_info.
Gc_jvect)[0] : NULL );
427 x_q_term = (x_q + 1) * (x_q + 1);
428 const size_type num_I_per_D_local = num_I_per_D + ( q_i <= I_remainder ? 1 : 0 );
429 for(
size_type q_k = 0; q_k < num_I_per_D_local; ++q_k ) {
432 klu = ( j -
bw_ >= 0 ? bw_-1 : j-1 ),
433 kuu = ( j + bw_ - 1 <=
nD_ ? bw_-1 :
nD_-j );
435 ds_j = ds_alpha * (j-1) + ds_beta;
439 *Gc_val++ = -3.0 / k * x_q_term;
447 *Gc_val++ = ds_j * x_q_term;
455 *Gc_val++ = -
fu_ / k * x_q_term;
463 *Gc_val++ = 2.0 * (
c(j) -
co_orig_(j)) / (x_q + 1);
465 *Gc_ivect++ =
nD_ + q_i;
480 &Gh_nz = *first_order_expl_info.
Gh_nz;
482 *Gh_val = &(*first_order_expl_info.
Gh_val)[0];
484 *Gh_ivect = ( first_order_expl_info.
Gh_ivect
485 ? &(*first_order_expl_info.
Gh_ivect)[0] : NULL ),
486 *Gh_jvect = ( first_order_expl_info.
Gh_jvect
487 ? &(*first_order_expl_info.
Gh_jvect)[0] : NULL );
497 const size_type num_I_per_D_local = num_I_per_D + ( q_i <= I_remainder ? 1 : 0 );
498 for(
size_type q_k = 0; q_k < num_I_per_D_local; ++q_k ) {
500 if( jI >
mI_ )
return;
512 *Gh_ivect++ = nD_q_i;
size_type imp_mI_orig() const
AbstractLinAlgPack::size_type size_type
value_type * f
Pointer to objective function f (may be NULL if not set)
size_type imp_Gh_nz_orig() const
RTOp_index_type index_type
bool nlp_selects_basis() const
DVector * h
Pointer to constraints residual h (may be NULL if not set)
size_type imp_n_orig() const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
int resize(OrdinalType length_in)
bool is_initialized() const
DVectorSlice x_full() const
Give reference to current x_full.
size_type imp_Gc_nz_orig() const
const DVectorSlice imp_xu_orig() const
const DVectorSlice imp_hu_orig() const
bool imp_nlp_has_changed() const
void inform_new_point(bool newx) const
bool imp_get_next_basis(IVector *var_perm_full, IVector *equ_perm_full, size_type *rank_full, size_type *rank)
void initialize(bool test_setup)
Struct for objective and constriants (pointer) as serial vectors.
Struct for zero and explicit first order quantities that subclass must fill in.
void imp_calc_h_orig(const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info) const
DVector * Gf
Gradient of objective function Gf (may be NULL if not set)
void imp_calc_Gc_orig(const DVectorSlice &x_full, bool newx, const FirstOrderExplInfo &first_order_expl_info) const
DVector * c
Pointer to constraints residual c (may be NULL if not set)
void assert_is_initialized() const
bool basis_selection_was_given_
void identity_perm(IVector *perm)
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
void imp_calc_c_orig(const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info) const
value_type max_var_bounds_viol() const
AbstractLinAlgPack::value_type value_type
const DVectorSlice imp_hl_orig() const
Struct for serial gradient (objective), objective and constriants (pointers)
const ZeroOrderInfoSerial zero_order_orig_info() const
void imp_calc_Gf_orig(const DVectorSlice &x_full, bool newx, const ObjGradInfoSerial &obj_grad_info) const
void imp_calc_f_orig(const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info) const
void imp_report_orig_final_solution(const DVectorSlice &x_orig, const DVectorSlice *lambda_orig, const DVectorSlice *lambdaI_orig, const DVectorSlice *nu_orig, bool is_optimal)
const DVectorSlice imp_xinit_orig() const
static value_type infinite_bound()
Value for an infinite bound.
size_type imp_m_orig() const
RangePack::Range1D Range1D
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
void imp_calc_Gh_orig(const DVectorSlice &x_full, bool newx, const FirstOrderExplInfo &first_order_expl_info) const
value_type dot(const DVectorSlice &vs_rhs1, const DVectorSlice &vs_rhs2)
result = vs_rhs1' * vs_rhs2 (BLAS xDOT)
virtual VectorMutable & c()
Returns non-const *this->get_c().
void initialize(bool test_setup)
bool imp_has_var_bounds() const
const DVectorSlice imp_xl_orig() const