本文整理汇总了C++中AbstractLinAlgPack::max_near_feas_step方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractLinAlgPack::max_near_feas_step方法的具体用法?C++ AbstractLinAlgPack::max_near_feas_step怎么用?C++ AbstractLinAlgPack::max_near_feas_step使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractLinAlgPack
的用法示例。
在下文中一共展示了AbstractLinAlgPack::max_near_feas_step方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_in_bounds
bool VariableBoundsTester::check_in_bounds(
std::ostream* out, bool print_all_warnings, bool print_vectors
,const Vector& xL, const char xL_name[]
,const Vector& xU, const char xU_name[]
,const Vector& x, const char x_name[]
)
{
using AbstractLinAlgPack::max_near_feas_step;
if(out)
*out
<< "\n*** Checking that variables are in bounds\n";
VectorSpace::vec_mut_ptr_t zero = x.space().create_member(0.0);
std::pair<value_type,value_type>
u = max_near_feas_step( x, *zero, xL, xU, warning_tol() );
if(u.first < 0.0) {
if(out)
*out << "\nWarning! the variables " << xL_name << " <= " << x_name << " <= " << xU_name
<< " are out of bounds by more than warning_tol = " << warning_tol() << "\n";
u = max_near_feas_step( x, *zero, xL, xU, error_tol() );
if(u.first < 0.0) {
if(out)
*out << "\nError! the variables " << xL_name << " <= " << x_name << " <= " << xU_name
<< " are out of bounds by more than error_tol = " << error_tol() << "\n";
return false;
}
}
return true;
}
示例2: do_step
bool TangentialStepWithInequStd_Step::do_step(
Algorithm& _algo, poss_type step_poss, IterationPack::EDoStepType type
,poss_type assoc_step_poss
)
{
using Teuchos::RCP;
using Teuchos::dyn_cast;
using ::fabs;
using LinAlgOpPack::Vt_S;
using LinAlgOpPack::V_VpV;
using LinAlgOpPack::V_VmV;
using LinAlgOpPack::Vp_StV;
using LinAlgOpPack::Vp_V;
using LinAlgOpPack::V_StV;
using LinAlgOpPack::V_MtV;
// using ConstrainedOptPack::min_abs;
using AbstractLinAlgPack::max_near_feas_step;
typedef VectorMutable::vec_mut_ptr_t vec_mut_ptr_t;
NLPAlgo &algo = rsqp_algo(_algo);
NLPAlgoState &s = algo.rsqp_state();
EJournalOutputLevel olevel = algo.algo_cntr().journal_output_level();
EJournalOutputLevel ns_olevel = algo.algo_cntr().null_space_journal_output_level();
std::ostream &out = algo.track().journal_out();
//const bool check_results = algo.algo_cntr().check_results();
// print step header.
if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
using IterationPack::print_algorithm_step;
print_algorithm_step( algo, step_poss, type, assoc_step_poss, out );
}
// problem dimensions
const size_type
//n = algo.nlp().n(),
m = algo.nlp().m(),
r = s.equ_decomp().size();
// Get the iteration quantity container objects
IterQuantityAccess<value_type>
&alpha_iq = s.alpha(),
&zeta_iq = s.zeta(),
&eta_iq = s.eta();
IterQuantityAccess<VectorMutable>
&dl_iq = dl_iq_(s),
&du_iq = du_iq_(s),
&nu_iq = s.nu(),
*c_iq = m > 0 ? &s.c() : NULL,
*lambda_iq = m > 0 ? &s.lambda() : NULL,
&rGf_iq = s.rGf(),
&w_iq = s.w(),
&qp_grad_iq = s.qp_grad(),
&py_iq = s.py(),
&pz_iq = s.pz(),
&Ypy_iq = s.Ypy(),
&Zpz_iq = s.Zpz();
IterQuantityAccess<MatrixOp>
&Z_iq = s.Z(),
//*Uz_iq = (m > r) ? &s.Uz() : NULL,
*Uy_iq = (m > r) ? &s.Uy() : NULL;
IterQuantityAccess<MatrixSymOp>
&rHL_iq = s.rHL();
IterQuantityAccess<ActSetStats>
&act_set_stats_iq = act_set_stats_(s);
// Accessed/modified/updated (just some)
VectorMutable *Ypy_k = (m ? &Ypy_iq.get_k(0) : NULL);
const MatrixOp &Z_k = Z_iq.get_k(0);
VectorMutable &pz_k = pz_iq.set_k(0);
VectorMutable &Zpz_k = Zpz_iq.set_k(0);
// Comupte qp_grad which is an approximation to rGf + Z'*HL*Y*py
// qp_grad = rGf
VectorMutable
&qp_grad_k = ( qp_grad_iq.set_k(0) = rGf_iq.get_k(0) );
// qp_grad += zeta * w
if( w_iq.updated_k(0) ) {
if(zeta_iq.updated_k(0))
Vp_StV( &qp_grad_k, zeta_iq.get_k(0), w_iq.get_k(0) );
else
Vp_V( &qp_grad_k, w_iq.get_k(0) );
}
//
// Set the bounds for:
//
// dl <= Z*pz + Y*py <= du -> dl - Ypy <= Z*pz <= du - Ypz
vec_mut_ptr_t
bl = s.space_x().create_member(),
bu = s.space_x().create_member();
if(m) {
// bl = dl_k - Ypy_k
V_VmV( bl.get(), dl_iq.get_k(0), *Ypy_k );
// bu = du_k - Ypy_k
V_VmV( bu.get(), du_iq.get_k(0), *Ypy_k );
//.........这里部分代码省略.........