这篇教程C++ ConstPtr函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ConstPtr函数的典型用法代码示例。如果您正苦于以下问题:C++ ConstPtr函数的具体用法?C++ ConstPtr怎么用?C++ ConstPtr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ConstPtr函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: DBG_START_METH SmartPtr<const Vector> NLPScalingObject::apply_vector_scaling_d_LU( const Matrix& Pd_LU, const SmartPtr<const Vector>& lu, const VectorSpace& d_space) { DBG_START_METH("NLPScalingObject::apply_vector_scaling_d_LU", dbg_verbosity); if (have_d_scaling()) { return ConstPtr(apply_vector_scaling_d_LU_NonConst(Pd_LU, lu, d_space)); } else { return lu; } }
开发者ID:ChinaQuants,项目名称:Ipopt,代码行数:13,
示例2: DBG_ASSERT void AlgorithmBuilder::BuildIpoptObjects(const Journalist& jnlst, const OptionsList& options, const std::string& prefix, const SmartPtr<NLP>& nlp, SmartPtr<IpoptNLP>& ip_nlp, SmartPtr<IpoptData>& ip_data, SmartPtr<IpoptCalculatedQuantities>& ip_cq) { DBG_ASSERT(prefix == ""); SmartPtr<NLPScalingObject> nlp_scaling ; std::string nlp_scaling_method; options.GetStringValue("nlp_scaling_method", nlp_scaling_method, ""); if (nlp_scaling_method == "user-scaling") { nlp_scaling = new UserScaling(ConstPtr(nlp)); } else if (nlp_scaling_method == "gradient-based") { nlp_scaling = new GradientScaling(nlp); } else if (nlp_scaling_method == "equilibration-based") { nlp_scaling = new EquilibrationScaling(nlp); } else { nlp_scaling = new NoNLPScalingObject(); } ip_nlp = new OrigIpoptNLP(&jnlst, GetRawPtr(nlp), nlp_scaling); // Create the IpoptData. Check if there is additional data that // is needed std::string lsmethod; SmartPtr<IpoptAdditionalData> add_data; options.GetStringValue("line_search_method", lsmethod, prefix); if (lsmethod=="cg-penalty") { add_data = new CGPenaltyData(); } ip_data = new IpoptData(add_data); // Create the IpoptCalculators. Check if there are additional // calcluated quantities that are needed ip_cq = new IpoptCalculatedQuantities(ip_nlp, ip_data); if (lsmethod=="cg-penalty") { SmartPtr<IpoptAdditionalCq> add_cq = new CGPenaltyCq(GetRawPtr(ip_nlp), GetRawPtr(ip_data), GetRawPtr(ip_cq)); ip_cq->SetAddCq(add_cq); } }
开发者ID:RobotLocomotion,项目名称:ipopt-mirror,代码行数:48,
示例3: MakeNewIteratesVector /** Use this method to create a new const IteratesVector. You must pass in * valid pointers for all of the entries. */ const SmartPtr<const IteratesVector> MakeNewIteratesVector(const Vector& x, const Vector& s, const Vector& y_c, const Vector& y_d, const Vector& z_L, const Vector& z_U, const Vector& v_L, const Vector& v_U) { SmartPtr<IteratesVector> newvec = MakeNewIteratesVector(false); newvec->Set_x(x); newvec->Set_s(s); newvec->Set_y_c(y_c); newvec->Set_y_d(y_d); newvec->Set_z_L(z_L); newvec->Set_z_U(z_U); newvec->Set_v_L(v_L); newvec->Set_v_U(v_U); return ConstPtr(newvec); }
开发者ID:Gurupradeep,项目名称:Compiler-Project,代码行数:19,
示例4: DBG_START_METH SmartPtr<const Vector> AugRestoSystemSolver::Neg_Omega_c_plus_D_c( const SmartPtr<const Vector>& sigma_tilde_n_c_inv, const SmartPtr<const Vector>& sigma_tilde_p_c_inv, const Vector* D_c, const Vector& any_vec_in_c) { DBG_START_METH("AugRestoSystemSolver::Neg_Omega_c_plus_D_c",dbg_verbosity); SmartPtr<Vector> retVec; if (IsValid(sigma_tilde_n_c_inv) || IsValid(sigma_tilde_p_c_inv) || D_c) { if (!neg_omega_c_plus_D_c_cache_. GetCachedResult3Dep(retVec, GetRawPtr(sigma_tilde_n_c_inv), GetRawPtr(sigma_tilde_p_c_inv), D_c)) { DBG_PRINT((1,"Not found in cache/n")); retVec = any_vec_in_c.MakeNew(); Number fact1, fact2; SmartPtr<const Vector> v1; SmartPtr<const Vector> v2; if (IsValid(sigma_tilde_n_c_inv)) { v1 = sigma_tilde_n_c_inv; fact1 = -1.; } else { v1 = &any_vec_in_c; fact1 = 0.; } if (IsValid(sigma_tilde_p_c_inv)) { v2 = sigma_tilde_p_c_inv; fact2 = -1.; } else { v2 = &any_vec_in_c; fact2 = 0.; } retVec->AddTwoVectors(fact1, *v1, fact2, *v2, 0.); if (D_c) { retVec->Axpy(1.0, *D_c); } neg_omega_c_plus_D_c_cache_. AddCachedResult3Dep(retVec, GetRawPtr(sigma_tilde_n_c_inv), GetRawPtr(sigma_tilde_p_c_inv), D_c); } } return ConstPtr(retVec); }
开发者ID:BRAINSia,项目名称:calatk,代码行数:47,
示例5: DBG_START_METH bool IndexPCalculator::ComputeP() { DBG_START_METH("IndexPCalculator::ComputeP", dbg_verbosity); bool retval = true; // 1. check whether all columns needed by data_A() are in map cols_ - we suppose data_A is IndexSchurData const std::vector<Index>* p2col_idx = dynamic_cast<const IndexSchurData*>(GetRawPtr(data_A()))->GetColIndices(); Index col; Number* col_values = NULL; Index curr_dim, curr_schur_row=0; SmartPtr<const DenseVector> comp_vec; const Number* comp_values; std::map< Index, SmartPtr<PColumn> >::iterator find_it; SmartPtr<IteratesVector> col_vec = IpData().curr()->MakeNewIteratesVector(); SmartPtr<IteratesVector> sol_vec = col_vec->MakeNewIteratesVector(); for (std::vector<Index>::const_iterator col_it=p2col_idx->begin(); col_it!=p2col_idx->end(); ++col_it){ col = *col_it; find_it = cols_.find(col); if (find_it==cols_.end()) { // column is in data_A but not in P-matrix ->create data_A()->GetRow(curr_schur_row, *col_vec); retval = Solver()->Solve(sol_vec, ConstPtr(col_vec)); DBG_ASSERT(retval); /* This part is for displaying norm2(I_z*K^(-1)*I_1) */ DBG_PRINT((dbg_verbosity,"/ncurr_schur_row=%d, ",curr_schur_row)); DBG_PRINT((dbg_verbosity,"norm2(z)=%23.16e/n",sol_vec->x()->Nrm2())); /* end displaying norm2 */ DBG_ASSERT(col_values== NULL); col_values = new Number[nrows_]; curr_dim = 0; for (Index j=0; j<sol_vec->NComps(); ++j) { comp_vec = dynamic_cast<const DenseVector*>(GetRawPtr(sol_vec->GetComp(j))); comp_values = comp_vec->Values(); IpBlasDcopy(comp_vec->Dim(), comp_values, 1, col_values+curr_dim,1); curr_dim += comp_vec->Dim(); } cols_[col] = new PColumn(nrows_, col_values); col_values = NULL; } curr_schur_row++; } return retval; }
开发者ID:liangboyun,项目名称:ipopt_wps,代码行数:47,
示例6: ConstPtr inline void CGPenaltyData::set_delta_cgfast(SmartPtr<IteratesVector>& delta_cgfast) { delta_cgfast_ = ConstPtr(delta_cgfast);#if COIN_IPOPT_CHECKLEVEL > 0 if (IsValid(delta_cgfast)) { debug_delta_cgfast_tag_ = delta_cgfast->GetTag(); debug_delta_cgfast_tag_sum_ = delta_cgfast->GetTagSum(); } else { debug_delta_cgfast_tag_ = 0; debug_delta_cgfast_tag_sum_ = delta_cgfast->GetTagSum(); }#endif delta_cgfast = NULL; }
开发者ID:FrozenXZeus,项目名称:cornell-urban-challenge,代码行数:18,
示例7: ConstPtr inline void IpoptData::set_delta_aff(SmartPtr<IteratesVector>& delta_aff) { delta_aff_ = ConstPtr(delta_aff);#if COIN_IPOPT_CHECKLEVEL > 0 if (IsValid(delta_aff)) { debug_delta_aff_tag_ = delta_aff->GetTag(); debug_delta_aff_tag_sum_ = delta_aff->GetTagSum(); } else { debug_delta_aff_tag_ = TaggedObject::Tag(); debug_delta_aff_tag_sum_ = delta_aff->GetTagSum(); }#endif delta_aff = NULL; }
开发者ID:CodeGuro,项目名称:Ipopt,代码行数:18,
示例8: ConstPtr inline void CGPenaltyData::set_delta_cgpen(SmartPtr<IteratesVector>& delta_cgpen) { delta_cgpen_ = ConstPtr(delta_cgpen);#if COIN_IPOPT_CHECKLEVEL > 0 if (IsValid(delta_cgpen)) { debug_delta_cgpen_tag_ = delta_cgpen->GetTag(); debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum(); } else { debug_delta_cgpen_tag_ = TaggedObject::Tag(); debug_delta_cgpen_tag_sum_ = delta_cgpen->GetTagSum(); }#endif delta_cgpen = NULL; }
开发者ID:aimanqais,项目名称:gerardus,代码行数:18,
示例9: ConstPtr inline void IpoptData::set_delta(SmartPtr<IteratesVector>& delta) { delta_ = ConstPtr(delta);#if COIN_IPOPT_CHECKLEVEL > 0 if (IsValid(delta)) { debug_delta_tag_ = delta->GetTag(); debug_delta_tag_sum_ = delta->GetTagSum(); } else { debug_delta_tag_ = 0; debug_delta_tag_sum_ = 0; }#endif delta = NULL; }
开发者ID:alyst,项目名称:Ipopt,代码行数:18,
示例10: apply_vector_scaling_x_NonConst SmartPtr<Vector> NLPScalingObject::apply_vector_scaling_x_LU_NonConst( const Matrix& Px_LU, const SmartPtr<const Vector>& lu, const VectorSpace& x_space) { SmartPtr<Vector> scaled_x_LU = lu->MakeNew(); if (have_x_scaling()) { SmartPtr<Vector> tmp_x = x_space.MakeNew(); // move to full x space Px_LU.MultVector(1.0, *lu, 0.0, *tmp_x); // scale in full x space tmp_x = apply_vector_scaling_x_NonConst(ConstPtr(tmp_x)); // move back to x_L space Px_LU.TransMultVector(1.0, *tmp_x, 0.0, *scaled_x_LU); } else { scaled_x_LU->Copy(*lu); } return scaled_x_LU; }
开发者ID:AyMaN-GhOsT,项目名称:simbody,代码行数:24,
示例11: unapply_vector_scaling_d_NonConst SmartPtr<Vector> NLPScalingObject::unapply_vector_scaling_d_LU_NonConst( const Matrix& Pd_LU, const SmartPtr<const Vector>& lu, const VectorSpace& d_space) { SmartPtr<Vector> unscaled_d_LU = lu->MakeNew(); if (have_d_scaling()) { SmartPtr<Vector> tmp_d = d_space.MakeNew(); // move to full d space Pd_LU.MultVector(1.0, *lu, 0.0, *tmp_d); // scale in full x space tmp_d = unapply_vector_scaling_d_NonConst(ConstPtr(tmp_d)); // move back to x_L space Pd_LU.TransMultVector(1.0, *tmp_d, 0.0, *unscaled_d_LU); } else { unscaled_d_LU->Copy(*lu); } return unscaled_d_LU; }
开发者ID:AyMaN-GhOsT,项目名称:simbody,代码行数:24,
示例12: ConstPtr inline SmartPtr<const Vector> ScaledMatrix::ColumnScaling() const { return ConstPtr(owner_space_->ColumnScaling()); }
开发者ID:Gjacquenot,项目名称:simbody,代码行数:5,
示例13: ColumnScaling /** return the vector for the column scaling */ SmartPtr<const Vector> ColumnScaling() const { return ConstPtr(column_scaling_); }
开发者ID:Gjacquenot,项目名称:simbody,代码行数:5,
示例14: RowScaling /** return the vector for the row scaling */ SmartPtr<const Vector> RowScaling() const { return ConstPtr(row_scaling_); }
开发者ID:Gjacquenot,项目名称:simbody,代码行数:5,
示例15: DBG_START_METH//.........这里部分代码省略......... *ip_data_, *ip_cq_, *pd_solver_); red_hess_calc->ComputeReducedHessian(); } if (run_sens_ && n_sens_steps_>0 && !sens_internal_abort) { SmartPtr<SensBuilder> schur_builder = new SensBuilder(); const std::string prefix = ""; // I should be getting this somewhere else... SmartPtr<SensAlgorithm> controller = schur_builder->BuildSensAlg(*jnlst_, *options_, prefix, *ip_nlp_, *ip_data_, *ip_cq_, *pd_solver_); retval = controller->Run(); } else if (run_sens_) { if (n_sens_steps_<=0) { jnlst_->Printf(J_WARNING, J_MAIN, "/n" "The run_sens option was set to true, but the specified/n" "number of sensitivity steps was set to zero./n" "Computation is aborted./n/n"); } } if (IsValid(ip_data_->curr()) && IsValid(ip_data_->curr()->x())) { SmartPtr<const Vector> c; SmartPtr<const Vector> d; SmartPtr<const Vector> zL; SmartPtr<const Vector> zU; SmartPtr<const Vector> yc; SmartPtr<const Vector> yd; Number obj = 0.; switch (status) { case SUCCESS: /*c = ip_cq_->curr_c(); d = ip_cq_->curr_d(); obj = ip_cq_->curr_f(); zL = ip_data_->curr()->z_L(); zU = ip_data_->curr()->z_U(); yc = ip_data_->curr()->y_c(); yd = ip_data_->curr()->y_d();*/ case MAXITER_EXCEEDED: case STOP_AT_TINY_STEP: case STOP_AT_ACCEPTABLE_POINT: case LOCAL_INFEASIBILITY: case USER_REQUESTED_STOP: case FEASIBLE_POINT_FOUND: case DIVERGING_ITERATES: case RESTORATION_FAILURE: case ERROR_IN_STEP_COMPUTATION: c = ip_cq_->curr_c(); d = ip_cq_->curr_d(); obj = ip_cq_->curr_f(); zL = ip_data_->curr()->z_L(); zU = ip_data_->curr()->z_U(); yc = ip_data_->curr()->y_c(); yd = ip_data_->curr()->y_d(); break; default: SmartPtr<Vector> tmp = ip_data_->curr()->y_c()->MakeNew(); tmp->Set(0.); c = ConstPtr(tmp); yc = ConstPtr(tmp); tmp = ip_data_->curr()->y_d()->MakeNew(); tmp->Set(0.); d = ConstPtr(tmp); yd = ConstPtr(tmp); tmp = ip_data_->curr()->z_L()->MakeNew(); tmp->Set(0.); zL = ConstPtr(tmp); tmp = ip_data_->curr()->z_U()->MakeNew(); tmp->Set(0.); zU = ConstPtr(tmp); } if (compute_red_hessian_ && redhess_internal_abort) { jnlst_->Printf(J_WARNING, J_MAIN, "/nReduced hessian was not computed " "because an error occured./n" "See exception message above for details./n/n"); } if (run_sens_ && sens_internal_abort) { jnlst_->Printf(J_WARNING, J_MAIN, "/nsIPOPT was not called " "because an error occured./n" "See exception message above for details./n/n"); } ip_nlp_->FinalizeSolution(status, *ip_data_->curr()->x(), *zL, *zU, *c, *d, *yc, *yd, obj, GetRawPtr(ip_data_), GetRawPtr(ip_cq_)); } return retval; }
开发者ID:liangboyun,项目名称:ipopt_wps,代码行数:101,
示例16: RowColScaling /** return the vector for the row and column scaling */ SmartPtr<const Vector> RowColScaling() const { return ConstPtr(scaling_); }
开发者ID:FrozenXZeus,项目名称:cornell-urban-challenge,代码行数:5,
示例17: IpNLP void SensAlgorithm::UnScaleIteratesVector(SmartPtr<IteratesVector> *V) { // unscale the iterates vector // pretty much a copy from IpOrigIpopt::finalize_solution SmartPtr<const Vector> unscaled_x; unscaled_x = IpNLP().NLP_scaling()->unapply_vector_scaling_x((*V)->x()); DBG_ASSERT(IsValid(unscaled_x)); (*V)->Set_x(*unscaled_x); unscaled_x = NULL ; SmartPtr<const Matrix> Px_L = IpNLP().Px_L(); SmartPtr<const Matrix> Px_U = IpNLP().Px_U(); SmartPtr<const VectorSpace> x_space = IpNLP().x_space(); SmartPtr<const Vector> y_c = (*V)->y_c(); SmartPtr<const Vector> y_d = (*V)->y_d(); SmartPtr<const Vector> z_L = (*V)->z_L(); SmartPtr<const Vector> z_U = (*V)->z_U(); // unscale y_c SmartPtr<const Vector> unscaled_yc; SmartPtr<const Vector> unscaled_yd; SmartPtr<const Vector> unscaled_z_L; SmartPtr<const Vector> unscaled_z_U; Number obj_unscale_factor = IpNLP().NLP_scaling()->unapply_obj_scaling(1.); if (obj_unscale_factor!=1.) { SmartPtr<Vector> tmp = IpNLP().NLP_scaling()->apply_vector_scaling_x_LU_NonConst(*Px_L, z_L, *x_space); tmp->Scal(obj_unscale_factor); unscaled_z_L = ConstPtr(tmp); tmp = IpNLP().NLP_scaling()->apply_vector_scaling_x_LU_NonConst(*Px_U, z_U, *x_space); tmp->Scal(obj_unscale_factor); unscaled_z_U = ConstPtr(tmp); tmp = IpNLP().NLP_scaling()->apply_vector_scaling_c_NonConst(y_c); tmp->Scal(obj_unscale_factor); unscaled_yc = ConstPtr(tmp); tmp = IpNLP().NLP_scaling()->apply_vector_scaling_d_NonConst(y_d); tmp->Scal(obj_unscale_factor); unscaled_yd = ConstPtr(tmp); } else { unscaled_z_L = IpNLP().NLP_scaling()->apply_vector_scaling_x_LU(*Px_L, z_L, *x_space); unscaled_z_U = IpNLP().NLP_scaling()->apply_vector_scaling_x_LU(*Px_U, z_U, *x_space); unscaled_yc = IpNLP().NLP_scaling()->apply_vector_scaling_c(y_c); unscaled_yd = IpNLP().NLP_scaling()->apply_vector_scaling_d(y_d); } (*V)->Set_z_U(*unscaled_z_U); (*V)->Set_z_L(*unscaled_z_L); (*V)->Set_y_c(*unscaled_yc); (*V)->Set_y_d(*unscaled_yd); }
开发者ID:ChinaQuants,项目名称:Ipopt,代码行数:64,
示例18: DBG_START_METH SensAlgorithmExitStatus SensAlgorithm::ComputeSensitivityMatrix(void) { DBG_START_METH("SensAlgorithm::ComputeSensitivityMatrix", dbg_verbosity); SensAlgorithmExitStatus retval = SOLVE_SUCCESS; /* Loop through all steps */ SmartPtr<IteratesVector> sol = IpData().curr()->MakeNewIteratesVector(); SmartPtr<const Vector> unscaled_x; SmartPtr<const Vector> unscaled_yc; SmartPtr<IteratesVector> trialcopy; SmartPtr<DenseVectorSpace> delta_u_space; delta_u_space = new DenseVectorSpace(2); SmartPtr<DenseVector> delta_u = new DenseVector(GetRawPtr(ConstPtr(delta_u_space))); Number* du_val = delta_u->Values(); std::string state; std::string statevalue; state = "sens_init_constr"; statevalue = "sens_init_constr"; SmartPtr<const DenseVectorSpace> x_owner_space_ = dynamic_cast<const DenseVectorSpace*>(GetRawPtr(IpData().curr()->y_c()->OwnerSpace())) ; //= dynamic_cast<const DenseVectorSpace*>(GetRawPtr(IpData().curr()->x()->OwnerSpace())); const std::vector<Index> idx_ipopt = x_owner_space_->GetIntegerMetaData(state.c_str()); char buffer[250] ; Index col = 0 ; for (Index Scol =0; Scol < idx_ipopt.size(); ++Scol) { if ( idx_ipopt[Scol] > 0 ) { // reset rhs vector to zero for (Index j = 0; j < idx_ipopt.size(); ++j) { if ( idx_ipopt[j] > 0 ) du_val[ idx_ipopt[j] - 1 ] = 0 ; } sprintf(buffer,"Column %i",idx_ipopt[Scol]) ; sens_step_calc_->SetSchurDriver(driver_vec_[0]); // set rhs to 1 (eq. 9-10) du_val[idx_ipopt[Scol]-1] = 1; delta_u->SetValues(du_val) ; //delta_u->Print(Jnlst(),J_VECTOR,J_USER1,"delta_u 1234567"); sens_step_calc_->Step(*delta_u, *sol); SmartPtr<IteratesVector> saved_sol = sol->MakeNewIteratesVectorCopy(); saved_sol->Print(Jnlst(),J_VECTOR,J_USER1,"sol_vec"); // unscale solution... UnScaleIteratesVector(&saved_sol) ; saved_sol->Print(Jnlst(),J_VECTOR,J_USER1,buffer); // Save column GetSensitivityMatrix(col) ; ++col ; // increase column counter } } return retval ; }
开发者ID:ChinaQuants,项目名称:Ipopt,代码行数:68,
示例19: ConstPtr inline SmartPtr<const Vector> SymScaledMatrix::RowColScaling() const { return ConstPtr(owner_space_->RowColScaling()); }
开发者ID:FrozenXZeus,项目名称:cornell-urban-challenge,代码行数:4,
注:本文中的ConstPtr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ConstantString函数代码示例 C++ ConsolePrint函数代码示例 |