本文整理汇总了C++中OptionsList类的典型用法代码示例。如果您正苦于以下问题:C++ OptionsList类的具体用法?C++ OptionsList怎么用?C++ OptionsList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OptionsList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitializeImpl
bool PDFullSpaceSolver::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
// Check for the algorithm options
options.GetIntegerValue("min_refinement_steps", min_refinement_steps_, prefix);
options.GetIntegerValue("max_refinement_steps", max_refinement_steps_, prefix);
ASSERT_EXCEPTION(max_refinement_steps_ >= min_refinement_steps_, OPTION_INVALID,
"Option \"max_refinement_steps\": This value must be larger than or equal to min_refinement_steps (default 1)");
options.GetNumericValue("residual_ratio_max", residual_ratio_max_, prefix);
options.GetNumericValue("residual_ratio_singular", residual_ratio_singular_, prefix);
ASSERT_EXCEPTION(residual_ratio_singular_ >= residual_ratio_max_, OPTION_INVALID,
"Option \"residual_ratio_singular\": This value must be not smaller than residual_ratio_max.");
options.GetNumericValue("residual_improvement_factor", residual_improvement_factor_, prefix);
options.GetNumericValue("neg_curv_test_tol", neg_curv_test_tol_, prefix);
// Reset internal flags and data
augsys_improved_ = false;
if (!augSysSolver_->Initialize(Jnlst(), IpNLP(), IpData(), IpCq(),
options, prefix)) {
return false;
}
return perturbHandler_->Initialize(Jnlst(), IpNLP(), IpData(), IpCq(),
options, prefix);
}
示例2: Initialize
bool IpoptData::Initialize(const Journalist& jnlst,
const OptionsList& options,
const std::string& prefix)
{
if (prefix=="resto.") {
// The default for the restoration phase is 1e-2 time the value
// for the regular algorithm
if (!options.GetNumericValue("resto.tol", tol_, "")) {
options.GetNumericValue("tol", tol_, prefix);
tol_ *= 1e-2;
}
}
else {
options.GetNumericValue("tol", tol_, prefix);
}
iter_count_ = 0;
curr_mu_ = -1.;
mu_initialized_ = false;
curr_tau_ = -1.;
tau_initialized_ = false;
have_prototypes_ = false;
have_deltas_ = false;
have_affine_deltas_ = false;
free_mu_mode_ = false;
tiny_step_flag_ = false;
ResetInfo();
initialize_called_ = true;
return cgpen_data_->Initialize(jnlst, options, prefix);
}
示例3: initialize
void AgentConfiguration::initialize(int aArgc, const char *aArgv[])
{
MTConnectService::initialize(aArgc, aArgv);
const char *configFile = "agent.cfg";
OptionsList optionList;
optionList.append(new Option(0, configFile, "The configuration file", "file", false));
optionList.parse(aArgc, (const char**) aArgv);
mConfigFile = configFile;
try
{
configureLogger();
ifstream file(mConfigFile.c_str());
loadConfig(file);
}
catch (std::exception & e)
{
sLogger << LFATAL << "Agent failed to load: " << e.what();
cerr << "Agent failed to load: " << e.what() << std::endl;
optionList.usage();
}
}
示例4: InitializeImpl
bool PDSearchDirCalculator::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
options.GetBoolValue("fast_step_computation", fast_step_computation_,
prefix);
options.GetBoolValue("mehrotra_algorithm", mehrotra_algorithm_, prefix);
return pd_solver_->Initialize(Jnlst(), IpNLP(), IpData(), IpCq(),
options, prefix);
}
示例5: InitializeImpl
bool StdStepCalculator::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
options.GetNumericValue("sens_bound_eps", bound_eps_, prefix);
options.GetBoolValue("sens_kkt_residuals", kkt_residuals_, prefix);
SensitivityStepCalculator::InitializeImpl(options,
prefix);
return true;
}
示例6: Initialize
bool IpoptData::Initialize(const Journalist& jnlst,
const OptionsList& options,
const std::string& prefix)
{
#if 0
// I (AW) took the following heuristic out again, since it seemed
// that the restoration phase tolerance became too tight by
// default. I originally probably put it in to avoid that a claim
// of infeasibility is made prematurely... let's see if someone
// starts screaming...
if (prefix=="resto.") {
// The default for the restoration phase is 1e-2 time the value
// for the regular algorithm
if (!options.GetNumericValue("resto.tol", tol_, "")) {
options.GetNumericValue("tol", tol_, prefix);
tol_ *= 1e-2;
}
}
else {
options.GetNumericValue("tol", tol_, prefix);
}
#else
options.GetNumericValue("tol", tol_, prefix);
#endif
iter_count_ = 0;
curr_mu_ = -1.;
mu_initialized_ = false;
curr_tau_ = -1.;
tau_initialized_ = false;
have_prototypes_ = false;
have_deltas_ = false;
have_affine_deltas_ = false;
free_mu_mode_ = false;
tiny_step_flag_ = false;
info_ls_count_ = 0;
ResetInfo();
info_last_output_ = -1.;
info_iters_since_header_ = 1000; // need to be larger 10
initialize_called_ = true;
if (cpu_time_start_==-1.) {
cpu_time_start_ = CpuTime();
}
bool retval = true;
if (IsValid(add_data_)) {
retval = add_data_->Initialize(jnlst, options, prefix);
}
return retval;
}
示例7: 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;
}
示例8: parseThreadSpecificOptions
void parseThreadSpecificOptions(OptionsList& threadOptions, const Options& opts)
{
unsigned numThreads = opts.getThreads();
for(unsigned i = 0; i < numThreads; ++i) {
threadOptions.push_back_copy(opts);
Options& tOpts = threadOptions.back();
// Set thread identifier
tOpts.setThreadId(i);
const std::vector<std::string>& optThreadArgvs = opts.getThreadArgv();
if(i < optThreadArgvs.size() && (! optThreadArgvs[i].empty())) {
// separate out the thread's individual configuration string
stringstream optidss;
optidss << "--thread" << i;
string optid = optidss.str();
int targc = 1;
char* tbuf = strdup(optThreadArgvs[i].c_str());
char* p = tbuf;
// string length is certainly an upper bound on size needed
char** targv = new char*[optThreadArgvs[i].size()];
char** vp = targv;
*vp++ = strdup(optid.c_str());
p = strtok(p, " ");
while(p != NULL) {
*vp++ = p;
++targc;
p = strtok(NULL, " ");
}
*vp++ = NULL;
if(targc > 1) { // this is necessary in case you do e.g. --thread0=" "
try {
Options::parseOptions(&tOpts, targc, targv);
} catch(OptionException& e) {
stringstream ss;
ss << optid << ": " << e.getMessage();
throw OptionException(ss.str());
}
if(tOpts.getThreads() != numThreads ||
tOpts.getThreadArgv() != opts.getThreadArgv()) {
stringstream ss;
ss << "not allowed to set thread options in " << optid << " !";
throw OptionException(ss.str());
}
}
free(targv[0]);
delete [] targv;
free(tbuf);
}
}
assert(numThreads >= 1); //do we need this?
}
示例9: InitializeImpl
bool GradientScaling::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
options.GetNumericValue("nlp_scaling_max_gradient",
scaling_max_gradient_, prefix);
options.GetNumericValue("nlp_scaling_obj_target_gradient",
scaling_obj_target_gradient_, prefix);
options.GetNumericValue("nlp_scaling_constr_target_gradient",
scaling_constr_target_gradient_, prefix);
options.GetNumericValue("nlp_scaling_min_value",
scaling_min_value_, prefix);
return StandardScalingBase::InitializeImpl(options, prefix);
}
示例10: numbering
bool Ma86SolverInterface::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
ma86_default_control(&control_);
control_.f_arrays = 1; // Use Fortran numbering (faster)
/* Note: we can't set control_.action = false as we need to know the
* intertia. (Otherwise we just enter the restoration phase and fail) */
options.GetIntegerValue("ma86_print_level", control_.diagnostics_level,
prefix);
options.GetIntegerValue("ma86_nemin", control_.nemin, prefix);
options.GetNumericValue("ma86_small", control_.small_, prefix);
options.GetNumericValue("ma86_static", control_.static_, prefix);
options.GetNumericValue("ma86_u", control_.u, prefix);
options.GetNumericValue("ma86_umax", umax_, prefix);
std::string order_method, scaling_method;
options.GetStringValue("ma86_order", order_method, prefix);
if(order_method == "metis") {
ordering_ = ORDER_METIS;
} else if(order_method == "amd") {
ordering_ = ORDER_AMD;
} else {
ordering_ = ORDER_AUTO;
}
options.GetStringValue("ma86_scaling", scaling_method, prefix);
if(scaling_method == "mc64") {
control_.scaling = 1;
} else if(scaling_method == "mc77") {
control_.scaling = 2;
} else {
control_.scaling = 0;
}
return true; // All is well
}
示例11: InitializeImpl
bool RestoConvergenceCheck::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
options.GetNumericValue("required_infeasibility_reduction", kappa_resto_, prefix);
options.GetIntegerValue("max_iter", maximum_iters_, prefix);
options.GetIntegerValue("max_resto_iter", maximum_resto_iters_, prefix);
// The original constraint violation tolerance
options.GetNumericValue("constr_viol_tol", orig_constr_viol_tol_, "");
first_resto_iter_ = true;
successive_resto_iter_ = 0;
return OptimalityErrorConvergenceCheck::InitializeImpl(options, prefix);
}
示例12: InitializeImpl
bool OrigIterationOutput::InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
options.GetBoolValue("print_info_string", print_info_string_, prefix);
return true;
}
示例13: 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;
}
示例14: InitializeImpl
bool EquilibrationScaling::
InitializeImpl(const OptionsList& options,
const std::string& prefix)
{
options.GetNumericValue("point_perturbation_radius",
point_perturbation_radius_, prefix);
return StandardScalingBase::InitializeImpl(options, prefix);
}
示例15: getDateFormat
DateFormatPtr DatePatternConverter::getDateFormat(const OptionsList& options) {
DateFormatPtr df;
int maximumCacheValidity = 1000000;
if (options.size() == 0) {
df = new ISO8601DateFormat();
} else {
LogString dateFormatStr(options[0]);
if(dateFormatStr.empty() ||
StringHelper::equalsIgnoreCase(dateFormatStr,
LOG4CXX_STR("ISO8601"), LOG4CXX_STR("iso8601"))) {
df = new ISO8601DateFormat();
} else if(StringHelper::equalsIgnoreCase(dateFormatStr,
LOG4CXX_STR("ABSOLUTE"), LOG4CXX_STR("absolute"))) {
df = new AbsoluteTimeDateFormat();
} else if(StringHelper::equalsIgnoreCase(dateFormatStr,
LOG4CXX_STR("DATE"), LOG4CXX_STR("date"))) {
df = new DateTimeDateFormat();
} else {
if (dateFormatStr.find(0x25 /*'%'*/) == std::string::npos) {
try {
df = new SimpleDateFormat(dateFormatStr);
maximumCacheValidity =
CachedDateFormat::getMaximumCacheValidity(dateFormatStr);
} catch(IllegalArgumentException& e) {
df = new ISO8601DateFormat();
LogLog::warn(((LogString)
LOG4CXX_STR("Could not instantiate SimpleDateFormat with pattern "))
+ dateFormatStr, e);
}
} else {
df = new StrftimeDateFormat(dateFormatStr);
}
}
if (options.size() >= 2) {
TimeZonePtr tz(TimeZone::getTimeZone(options[1]));
if (tz != NULL) {
df->setTimeZone(tz);
}
}
}
if (maximumCacheValidity > 0) {
df = new CachedDateFormat(df, maximumCacheValidity);
}
return df;
}