本文整理汇总了C++中OptionsList::GetEnumValue方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionsList::GetEnumValue方法的具体用法?C++ OptionsList::GetEnumValue怎么用?C++ OptionsList::GetEnumValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionsList
的用法示例。
在下文中一共展示了OptionsList::GetEnumValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitializeImpl
bool OrigIterationOutput::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
options.GetBoolValue("print_info_string", print_info_string_, prefix);
Index enum_int;
options.GetEnumValue("inf_pr_output", enum_int, prefix);
inf_pr_output_ = InfPrOutput(enum_int);
return true;
}
示例2: InitializeImpl
bool RestoIterationOutput::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
options.GetBoolValue("print_info_string", print_info_string_, prefix);
Index enum_int;
options.GetEnumValue("inf_pr_output", enum_int, prefix);
inf_pr_output_ = InfPrOutput(enum_int);
bool retval = true;
if (IsValid(resto_orig_iteration_output_)) {
retval = resto_orig_iteration_output_->Initialize(Jnlst(), IpNLP(),
IpData(), IpCq(),
options, prefix);
}
return retval;
}
示例3: OptimalityErrorConvergenceCheck
//.........这里部分代码省略.........
if (linear_system_scaling=="mc19") {
#ifndef COINHSL_HAS_MC19
# ifdef HAVE_LINEARSOLVERLOADER
ScalingMethod = new Mc19TSymScalingMethod();
if (!LSL_isMC19available()) {
char buf[256];
int rc = LSL_loadHSL(NULL, buf, 255);
if (rc) {
std::string errmsg;
errmsg = "Selected linear system scaling method MC19 not available.\n";
errmsg += buf;
THROW_EXCEPTION(OPTION_INVALID, errmsg.c_str());
}
}
# else
THROW_EXCEPTION(OPTION_INVALID, "Support for MC19 has not been compiled into Ipopt.");
# endif
#else
ScalingMethod = new Mc19TSymScalingMethod();
#endif
}
else if (linear_system_scaling=="slack-based") {
ScalingMethod = new SlackBasedTSymScalingMethod();
}
SmartPtr<SymLinearSolver> ScaledSolver =
new TSymLinearSolver(SolverInterface, ScalingMethod);
AugSolver = new StdAugSystemSolver(*ScaledSolver);
}
Index enum_int;
options.GetEnumValue("hessian_approximation", enum_int, prefix);
HessianApproximationType hessian_approximation =
HessianApproximationType(enum_int);
if (hessian_approximation==LIMITED_MEMORY) {
std::string lm_aug_solver;
options.GetStringValue("limited_memory_aug_solver", lm_aug_solver,
prefix);
if (lm_aug_solver == "sherman-morrison") {
AugSolver = new LowRankAugSystemSolver(*AugSolver);
}
else if (lm_aug_solver == "extended") {
Index lm_history;
options.GetIntegerValue("limited_memory_max_history", lm_history,
prefix);
Index max_rank;
std::string lm_type;
options.GetStringValue("limited_memory_update_type", lm_type, prefix);
if (lm_type == "bfgs") {
max_rank = 2*lm_history;
}
else if (lm_type == "sr1") {
max_rank = lm_history;
}
else {
THROW_EXCEPTION(OPTION_INVALID, "Unknown value for option \"limited_memory_update_type\".");
}
AugSolver = new LowRankSSAugSystemSolver(*AugSolver, max_rank);
}
else {
THROW_EXCEPTION(OPTION_INVALID, "Unknown value for option \"limited_memory_aug_solver\".");
}
}
示例4: InitializeImpl
bool IterativePardisoSolverInterface::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
Index enum_int;
options.GetEnumValue("pardiso_matching_strategy", enum_int, prefix);
match_strat_ = PardisoMatchingStrategy(enum_int);
options.GetBoolValue("pardiso_redo_symbolic_fact_only_if_inertia_wrong",
pardiso_redo_symbolic_fact_only_if_inertia_wrong_,
prefix);
options.GetBoolValue("pardiso_repeated_perturbation_means_singular",
pardiso_repeated_perturbation_means_singular_,
prefix);
Index pardiso_out_of_core_power;
options.GetIntegerValue("pardiso_out_of_core_power",
pardiso_out_of_core_power, prefix);
options.GetBoolValue("pardiso_skip_inertia_check",
skip_inertia_check_, prefix);
// PD system
options.GetIntegerValue("pardiso_max_iter", pardiso_max_iter_, prefix);
options.GetNumericValue("pardiso_iter_relative_tol",
pardiso_iter_relative_tol_, prefix);
options.GetIntegerValue("pardiso_iter_coarse_size",
pardiso_iter_coarse_size_, prefix);
options.GetIntegerValue("pardiso_iter_max_levels",
pardiso_iter_max_levels_, prefix);
options.GetNumericValue("pardiso_iter_dropping_factor",
pardiso_iter_dropping_factor_, prefix);
options.GetNumericValue("pardiso_iter_dropping_schur",
pardiso_iter_dropping_schur_, prefix);
options.GetIntegerValue("pardiso_iter_max_row_fill",
pardiso_iter_max_row_fill_, prefix);
options.GetNumericValue("pardiso_iter_inverse_norm_factor",
pardiso_iter_inverse_norm_factor_, prefix);
// Normal system
options.GetIntegerValue("pardiso_max_iter", normal_pardiso_max_iter_,
prefix+"normal.");
options.GetNumericValue("pardiso_iter_relative_tol",
normal_pardiso_iter_relative_tol_,
prefix+"normal.");
options.GetIntegerValue("pardiso_iter_coarse_size",
normal_pardiso_iter_coarse_size_,
prefix+"normal.");
options.GetIntegerValue("pardiso_iter_max_levels",
normal_pardiso_iter_max_levels_,
prefix+"normal.");
options.GetNumericValue("pardiso_iter_dropping_factor",
normal_pardiso_iter_dropping_factor_,
prefix+"normal.");
options.GetNumericValue("pardiso_iter_dropping_schur",
normal_pardiso_iter_dropping_schur_,
prefix+"normal.");
options.GetIntegerValue("pardiso_iter_max_row_fill",
normal_pardiso_iter_max_row_fill_,
prefix+"normal.");
options.GetNumericValue("pardiso_iter_inverse_norm_factor",
normal_pardiso_iter_inverse_norm_factor_,
prefix+"normal.");
int pardiso_msglvl;
options.GetIntegerValue("pardiso_msglvl", pardiso_msglvl, prefix);
options.GetIntegerValue("pardiso_max_droptol_corrections",
pardiso_max_droptol_corrections_, prefix);
// Number value = 0.0;
// Tell Pardiso to release all memory if it had been used before
if (initialized_) {
ipfint PHASE = -1;
ipfint N = dim_;
ipfint NRHS = 0;
ipfint ERROR;
ipfint idmy;
double ddmy;
F77_FUNC(pardiso,PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N,
&ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_,
&MSGLVL_, &ddmy, &ddmy, &ERROR, DPARM_) ;
DBG_ASSERT(ERROR==0);
}
// Reset all private data
dim_=0;
nonzeros_=0;
have_symbolic_factorization_=false;
initialized_=false;
delete[] a_;
a_ = NULL;
#ifdef HAVE_PARDISO_OLDINTERFACE
THROW_EXCEPTION(OPTION_INVALID, "The inexact version works only with a new version of Pardiso (at least 4.0)");
#endif
// Call Pardiso's initialization routine
IPARM_[0] = 0; // Tell it to fill IPARM with default values(?)
ipfint ERROR = 0;
ipfint SOLVER = 1; // initialze only direct solver
F77_FUNC(pardisoinit,PARDISOINIT)(PT_, &MTYPE_, &SOLVER,
IPARM_, DPARM_, &ERROR);
// Set some parameters for Pardiso
//.........这里部分代码省略.........
示例5: InitializeImpl
bool AdaptiveMuUpdate::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
options.GetNumericValue("mu_max_fact", mu_max_fact_, prefix);
if (!options.GetNumericValue("mu_max", mu_max_, prefix)) {
// Set to a negative value as a hint that this value still has
// to be computed
mu_max_ = -1.;
}
options.GetNumericValue("tau_min", tau_min_, prefix);
options.GetNumericValue("adaptive_mu_safeguard_factor", adaptive_mu_safeguard_factor_, prefix);
options.GetNumericValue("adaptive_mu_kkterror_red_fact", refs_red_fact_, prefix);
options.GetIntegerValue("adaptive_mu_kkterror_red_iters", num_refs_max_, prefix);
Index enum_int;
options.GetEnumValue("adaptive_mu_globalization", enum_int, prefix);
adaptive_mu_globalization_ = AdaptiveMuGlobalizationEnum(enum_int);
options.GetNumericValue("filter_max_margin", filter_max_margin_, prefix);
options.GetNumericValue("filter_margin_fact", filter_margin_fact_, prefix);
options.GetBoolValue("adaptive_mu_restore_previous_iterate", restore_accepted_iterate_, prefix);
bool retvalue = free_mu_oracle_->Initialize(Jnlst(), IpNLP(), IpData(),
IpCq(), options, prefix);
if (!retvalue) {
return retvalue;
}
if (IsValid(fix_mu_oracle_)) {
retvalue = fix_mu_oracle_->Initialize(Jnlst(), IpNLP(), IpData(),
IpCq(), options, prefix);
if (!retvalue) {
return retvalue;
}
}
options.GetNumericValue("adaptive_mu_monotone_init_factor", adaptive_mu_monotone_init_factor_, prefix);
options.GetNumericValue("barrier_tol_factor", barrier_tol_factor_, prefix);
options.GetNumericValue("mu_linear_decrease_factor", mu_linear_decrease_factor_, prefix);
options.GetNumericValue("mu_superlinear_decrease_power", mu_superlinear_decrease_power_, prefix);
options.GetEnumValue("quality_function_norm_type", enum_int, prefix);
adaptive_mu_kkt_norm_ = QualityFunctionMuOracle::NormEnum(enum_int);
options.GetEnumValue("quality_function_centrality", enum_int, prefix);
adaptive_mu_kkt_centrality_ = QualityFunctionMuOracle::CentralityEnum(enum_int);
options.GetEnumValue("quality_function_balancing_term", enum_int, prefix);
adaptive_mu_kkt_balancing_term_ = QualityFunctionMuOracle::BalancingTermEnum(enum_int);
options.GetNumericValue("compl_inf_tol", compl_inf_tol_, prefix);
if (prefix == "resto.") {
if (!options.GetNumericValue("mu_min", mu_min_, prefix)) {
// For restoration phase, we choose a more conservative mu_min
mu_min_ = 1e2*mu_min_;
// Compute mu_min based on tolerance (once the NLP scaling is known)
mu_min_default_ = true;
}
else {
mu_min_default_ = false;
}
}
else {
if (!options.GetNumericValue("mu_min", mu_min_, prefix)) {
// Compute mu_min based on tolerance (once the NLP scaling is known)
mu_min_default_ = true;
}
else {
mu_min_default_ = false;
}
}
options.GetNumericValue("mu_target", mu_target_, prefix);
init_dual_inf_ = -1.;
init_primal_inf_ = -1.;
refs_vals_.clear();
check_if_no_bounds_ = false;
no_bounds_ = false;
filter_.Clear();
IpData().SetFreeMuMode(true);
accepted_point_ = NULL;
// The following lines are only here so that
// IpoptCalculatedQuantities::CalculateSafeSlack and the first
// output line have something to work with
IpData().Set_mu(1.);
IpData().Set_tau(0.);
return retvalue;
}
示例6: InitializeImpl
bool PardisoSolverInterface::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
Index enum_int;
options.GetEnumValue("pardiso_matching_strategy", enum_int, prefix);
match_strat_ = PardisoMatchingStrategy(enum_int);
options.GetBoolValue("pardiso_redo_symbolic_fact_only_if_inertia_wrong",
pardiso_redo_symbolic_fact_only_if_inertia_wrong_,
prefix);
options.GetBoolValue("pardiso_repeated_perturbation_means_singular",
pardiso_repeated_perturbation_means_singular_,
prefix);
//Index pardiso_out_of_core_power;
//options.GetIntegerValue("pardiso_out_of_core_power",
// pardiso_out_of_core_power, prefix);
options.GetBoolValue("pardiso_skip_inertia_check",
skip_inertia_check_, prefix);
int pardiso_msglvl;
options.GetIntegerValue("pardiso_msglvl", pardiso_msglvl, prefix);
int max_iterref_steps;
options.GetIntegerValue("pardiso_max_iterative_refinement_steps", max_iterref_steps, prefix);
int order;
options.GetEnumValue("pardiso_order", order, prefix);
#if !defined(HAVE_PARDISO_OLDINTERFACE) && !defined(HAVE_PARDISO_MKL)
options.GetBoolValue("pardiso_iterative", pardiso_iterative_, prefix);
int pardiso_max_iter;
options.GetIntegerValue("pardiso_max_iter", pardiso_max_iter, prefix);
Number pardiso_iter_relative_tol;
options.GetNumericValue("pardiso_iter_relative_tol",
pardiso_iter_relative_tol, prefix);
Index pardiso_iter_coarse_size;
options.GetIntegerValue("pardiso_iter_coarse_size",
pardiso_iter_coarse_size, prefix);
Index pardiso_iter_max_levels;
options.GetIntegerValue("pardiso_iter_max_levels",
pardiso_iter_max_levels, prefix);
Number pardiso_iter_dropping_factor;
options.GetNumericValue("pardiso_iter_dropping_factor",
pardiso_iter_dropping_factor, prefix);
Number pardiso_iter_dropping_schur;
options.GetNumericValue("pardiso_iter_dropping_schur",
pardiso_iter_dropping_schur, prefix);
Index pardiso_iter_max_row_fill;
options.GetIntegerValue("pardiso_iter_max_row_fill",
pardiso_iter_max_row_fill, prefix);
Number pardiso_iter_inverse_norm_factor;
options.GetNumericValue("pardiso_iter_inverse_norm_factor",
pardiso_iter_inverse_norm_factor, prefix);
options.GetIntegerValue("pardiso_max_droptol_corrections",
pardiso_max_droptol_corrections_, prefix);
#else
pardiso_iterative_ = false;
#endif
// Number value = 0.0;
// Tell Pardiso to release all memory if it had been used before
if (initialized_) {
ipfint PHASE = -1;
ipfint N = dim_;
ipfint NRHS = 0;
ipfint ERROR;
ipfint idmy;
double ddmy;
PARDISO_FUNC(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N,
&ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_,
&MSGLVL_, &ddmy, &ddmy, &ERROR, DPARM_);
DBG_ASSERT(ERROR==0);
}
// Reset all private data
dim_=0;
nonzeros_=0;
have_symbolic_factorization_=false;
initialized_=false;
delete[] a_;
a_ = NULL;
#ifdef PARDISO_MATCHING_PREPROCESS
delete[] ia2;
ia2 = NULL;
delete[] ja2;
ja2 = NULL;
delete[] a2_;
a2_ = NULL;
delete[] perm2;
perm2 = NULL;
delete[] scale2;
scale2 = NULL;
#endif
// Call Pardiso's initialization routine
IPARM_[0] = 0; // Tell it to fill IPARM with default values(?)
#if ! defined(HAVE_PARDISO_OLDINTERFACE) && ! defined(HAVE_PARDISO_MKL)
ipfint ERROR = 0;
//.........这里部分代码省略.........