42 using namespace bertini::tracking;
67 template<
typename Iterator,
typename Skipper>
74 namespace phx = boost::phoenix;
84 using boost::spirit::lexeme;
85 using boost::spirit::as_string;
86 using boost::spirit::ascii::no_case;
95 root_rule_.name(
"config::PrecisionType");
99 config_name_.name(
"precisiontype_");
100 config_name_ = *(char_ - (no_case[
"mptype"]>>
':')) >> (no_case[
"mptype"] >>
':') >> precisiontype_[_val = _1] >>
';';
102 no_setting_.name(
"no_setting_");
103 no_setting_ = *(char_ - no_case[
"mptype:"]);
105 no_decl_.name(
"no_decl_");
111 qi::on_error<qi::fail>(
113 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::PrecisionType"))
122 qi::rule<Iterator,
PrecisionType(), ascii::space_type > root_rule_, config_name_;
123 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_;
125 qi::symbols<char,PrecisionType> precisiontype_;
140 template<
typename Iterator,
typename Skipper>
147 namespace phx = boost::phoenix;
157 using boost::spirit::lexeme;
158 using boost::spirit::as_string;
159 using boost::spirit::ascii::no_case;
173 std::string setting_name =
"odepredictor";
176 root_rule_.name(
"Predictor");
178 root_rule_ = (config_name_[_val = _1] >> -no_setting_) | no_setting_[_val =
Predictor::RKF45];
180 config_name_.name(
"predictor_");
181 config_name_ = *(char_ - (no_case[setting_name] >>
':')) >> (no_case[setting_name] >>
':') >> predictor_[_val = _1] >>
';';
183 no_setting_.name(
"no_setting_");
184 no_setting_ = *(char_ - no_case[setting_name]);
186 no_decl_.name(
"no_decl_");
192 qi::on_error<qi::fail>(
203 qi::rule<Iterator,
Predictor(), ascii::space_type > root_rule_, config_name_;
204 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_;
206 qi::symbols<char,Predictor> predictor_;
219 template<
typename Iterator,
typename Skipper>
226 namespace phx = boost::phoenix;
236 using boost::spirit::lexeme;
237 using boost::spirit::as_string;
238 using boost::spirit::ascii::no_case;
251 std::string predictor_name =
"odepredictor";
252 std::string path_trunc_name =
"pathtruncationthreshold";
254 root_rule_.name(
"config::Tracker");
268 all_names_ = (no_case[predictor_name] >>
':') | (no_case[path_trunc_name] >>
':');
270 predictor_choice_.name(
"predictor_choice_");
271 predictor_choice_ = *(char_ - all_names_) >> (no_case[predictor_name] >>
':')
272 >> predictor_[_val = _1] >>
';';
274 path_trunc_threshold_.name(
"path_trunc_threshold_");
275 path_trunc_threshold_ = *(char_ - all_names_) >> (no_case[path_trunc_name] >>
':')
276 >> mpfr_rules.number_string_[phx::bind( [](
T & num, std::string str)
279 }, _val, _1 )] >>
';';
281 no_setting_.name(
"no_setting_");
282 no_setting_ = *(char_ - all_names_);
284 no_decl_.name(
"no_decl_");
287 qi::on_error<qi::fail>(
289 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::Tracker"))
294 qi::rule<Iterator,
TrackerConfig(), ascii::space_type > root_rule_;
295 qi::rule<Iterator,
Predictor(), ascii::space_type > predictor_choice_;
296 qi::rule<Iterator, T(), ascii::space_type > path_trunc_threshold_;
297 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_, all_names_;
298 rules::LongNum<Iterator> mpfr_rules;
300 qi::symbols<char,Predictor> predictor_;
324 template<
typename Iterator,
typename Skipper>
338 namespace phx = boost::phoenix;
348 using boost::spirit::lexeme;
349 using boost::spirit::as_string;
350 using boost::spirit::ascii::no_case;
354 std::string maxstep_name =
"maxstepsize";
355 std::string stepsuccess_name =
"stepsuccessfactor";
356 std::string stepfail_name =
"stepfailfactor";
357 std::string stepsincrease_name =
"stepsforincrease";
358 std::string maxnumsteps_name =
"maxnumbersteps";
361 root_rule_.name(
"SteppingConfig");
363 root_rule_ = ((max_step_size_[phx::bind( [](
SteppingConfig & S, T num)
388 all_names_ = (no_case[maxstep_name] >>
':') | (no_case[stepsuccess_name] >>
':')|
389 (no_case[stepfail_name] >>
':')| (no_case[stepsincrease_name] >>
':') | (no_case[maxnumsteps_name] >>
':');
391 max_step_size_.name(
"max_step_size_");
392 max_step_size_ = *(char_ - all_names_) >> (no_case[maxstep_name] >>
':')
393 >> mpfr_rules.rational[phx::bind( [](T & num, std::string
const& str)
396 }, _val, _1 )] >>
';';
398 stepsize_success_.name(
"stepsize_success_");
399 stepsize_success_ = *(char_ - all_names_) >> (no_case[stepsuccess_name] >>
':')
400 >> mpfr_rules.rational[phx::bind( [](R & num, std::string
const& str)
403 }, _val, _1 )] >>
';';
405 stepsize_fail_.name(
"stepsize_fail_");
406 stepsize_fail_ = *(char_ - all_names_) >> (no_case[stepfail_name] >>
':')
407 >> mpfr_rules.rational[phx::bind( [](R & num, std::string
const& str)
410 }, _val, _1 )] >>
';';
412 steps_increase_.name(
"steps_increase_");
413 steps_increase_ = *(char_ - all_names_) >> (no_case[stepsincrease_name] >>
':') >> qi::uint_[_val=_1] >>
';';
415 max_num_steps_.name(
"max_num_steps_");
416 max_num_steps_ = *(char_ - all_names_) >> (no_case[maxnumsteps_name] >>
':') >> qi::uint_[_val=_1] >>
';';
418 no_setting_.name(
"no_setting_");
419 no_setting_ = *(char_ - all_names_);
421 no_decl_.name(
"no_decl_");
428 qi::on_error<qi::fail>(
439 qi::rule<Iterator,
SteppingConfig(), ascii::space_type > root_rule_;
440 qi::rule<Iterator, T(), ascii::space_type > max_step_size_;
441 qi::rule<Iterator, R(), ascii::space_type > stepsize_success_, stepsize_fail_;
442 qi::rule<Iterator,
unsigned int(), ascii::space_type > steps_increase_, max_num_steps_;
443 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_, all_names_;
444 rules::LongNum<Iterator> mpfr_rules;
457 template<
typename Iterator,
typename Skipper>
464 namespace phx = boost::phoenix;
474 using boost::spirit::lexeme;
475 using boost::spirit::as_string;
476 using boost::spirit::ascii::no_case;
480 std::string maxits_name =
"maxnewtonits";
483 root_rule_.name(
"NewtonConfig");
485 root_rule_ = (max_its_[phx::bind( [](
NewtonConfig & S,
unsigned num)
495 all_names_ = eps >> (no_case[maxits_name] >>
':');
497 max_its_.name(
"max_its_");
498 max_its_ = *(char_ - no_case[maxits_name]) >> (no_case[maxits_name] >>
':') >> qi::uint_[_val=_1] >>
';';
500 no_setting_.name(
"no_setting_");
501 no_setting_ = *(char_ - all_names_);
503 no_decl_.name(
"no_decl_");
510 qi::on_error<qi::fail>(
522 qi::rule<Iterator,
unsigned int(), ascii::space_type > max_its_;
523 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_, all_names_;
533 template<
typename Iterator,
typename Skipper>
540 namespace phx = boost::phoenix;
550 using boost::spirit::lexeme;
551 using boost::spirit::as_string;
552 using boost::spirit::ascii::no_case;
556 root_rule_.name(
"config::FixedPrecision");
561 qi::on_error<qi::fail>(
563 phx::bind(&
ReportParseError, _1, _2, _3, _4, std::string(
"config::FixedPrecision"))
580 template<
typename Iterator,
typename Skipper>
589 namespace phx = boost::phoenix;
599 using boost::spirit::lexeme;
600 using boost::spirit::as_string;
601 using boost::spirit::ascii::no_case;
605 std::string coefficient_bound_name =
"coefficientbound";
606 std::string degree_bound_name =
"degreebound";
607 std::string lin_solve_error_bnd_name =
"epsilon";
608 std::string jac_eval_err_bnd_name =
"phi";
609 std::string func_eval_err_bnd_name =
"psi";
610 std::string safety_one_name =
"ampsafetydigits1";
611 std::string safety_two_name =
"ampsafetydigits2";
612 std::string max_prec_name =
"ampmaxprec";
613 std::string max_num_prec_decs_name =
"maxnumprecdecreases";
615 root_rule_.name(
"config::AMP");
654 >> -no_setting_) | no_setting_;
656 all_names_ = (no_case[coefficient_bound_name] >>
':') |
657 (no_case[degree_bound_name] >>
':') |
658 (no_case[lin_solve_error_bnd_name] >>
':') |
659 (no_case[jac_eval_err_bnd_name] >>
':') |
660 (no_case[func_eval_err_bnd_name] >>
':') |
661 (no_case[safety_one_name] >>
':') |
662 (no_case[safety_two_name] >>
':') |
663 (no_case[max_prec_name] >>
':') |
664 (no_case[max_num_prec_decs_name] >>
':')
668 auto str_to_T = [](T & num, std::string
const& str)
675 degree_bound_.name(
"degree_bound_");
676 degree_bound_ = *(char_ - all_names_) >> (no_case[degree_bound_name] >>
':')
677 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
679 coefficient_bound_.name(
"coefficient_bound_");
680 coefficient_bound_ = *(char_ - all_names_) >> (no_case[coefficient_bound_name] >>
':')
681 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
683 lin_solve_error_bnd_.name(
"lin_solve_error_bnd_");
684 lin_solve_error_bnd_ = *(char_ - all_names_) >> (no_case[lin_solve_error_bnd_name] >>
':')
685 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
687 jac_eval_err_bnd_.name(
"jac_eval_err_bnd_");
688 jac_eval_err_bnd_ = *(char_ - all_names_) >> (no_case[jac_eval_err_bnd_name] >>
':')
689 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
691 func_eval_err_bnd_.name(
"func_eval_err_bnd_");
692 func_eval_err_bnd_ = *(char_ - all_names_) >> (no_case[func_eval_err_bnd_name] >>
':')
693 >> mpfr_rules.number_string_[phx::bind( str_to_T, _val, _1 )] >>
';';
695 safety_one_.name(
"safety_one_");
696 safety_one_ = *(char_ - all_names_) >> (no_case[safety_one_name] >>
':') >> qi::int_[_val=_1] >>
';';
698 safety_two_.name(
"safety_two_");
699 safety_two_ = *(char_ - all_names_) >> (no_case[safety_two_name] >>
':') >> qi::int_[_val=_1] >>
';';
701 max_prec_.name(
"max_prec_");
702 max_prec_ = *(char_ - all_names_) >> (no_case[max_prec_name] >>
':') >> qi::uint_[_val=_1] >>
';';
704 max_num_prec_decs_.name(
"max_num_prec_decs_");
705 max_num_prec_decs_ = *(char_ - all_names_) >> (no_case[max_num_prec_decs_name] >>
':') >> qi::uint_[_val=_1] >>
';';
708 no_setting_.name(
"no_setting_");
709 no_setting_ = *(char_ - all_names_);
711 no_decl_.name(
"no_decl_");
717 qi::on_error<qi::fail>(
730 qi::rule<Iterator, double(), ascii::space_type > degree_bound_, coefficient_bound_, lin_solve_error_bnd_, jac_eval_err_bnd_, func_eval_err_bnd_;
731 qi::rule<Iterator, int(), ascii::space_type > safety_one_, safety_two_;
732 qi::rule<Iterator,
unsigned int(), ascii::space_type > max_prec_, max_num_prec_decs_;
734 qi::rule<Iterator, ascii::space_type, std::string()> no_decl_, no_setting_, all_names_;
735 rules::LongNum<Iterator> mpfr_rules;
Provides the base type for config settings parsers.
Definition classic_utilities.hpp:41
void ReportParseError(std::string::const_iterator begin, std::string::const_iterator end, std::string::const_iterator err_pos, boost::spirit::info const &what, std::string const &parser_name)
Report a parse error (via FormatParseError) to the log, for use in a Spirit on_error handler.
Definition qi_files.hpp:199
AdaptiveMultiplePrecisionConfig AdaptiveMultiplePrecisionConfig
Alias bringing the AMP config type into this scope for the parser specialization below.
Definition tracking.hpp:579
Definition classic_utilities.hpp:40
Predictor
The predictor (ODE integration) method used during path tracking.
Definition config.hpp:55
@ RKCashKarp45
Definition config.hpp:63
@ Euler
Definition config.hpp:57
@ RKNorsett34
Definition config.hpp:61
@ RKDormandPrince56
Definition config.hpp:64
@ RKVerner67
Definition config.hpp:65
@ RKF45
Definition config.hpp:62
@ Constant
Definition config.hpp:56
@ Heun
Definition config.hpp:58
@ RK4
Definition config.hpp:59
PrecisionType
The precision regime a tracker operates in: fixed double, fixed multiple, or adaptive.
Definition config.hpp:46
@ Adaptive
Definition config.hpp:49
@ Fixed
Definition config.hpp:47
@ FixedMultiple
Definition config.hpp:48
Definition algorithm_builder.hpp:36
double NumErrorT
The numeric type used to hold error/tolerance magnitudes throughout Bertini2 – tracking tolerances,...
Definition num_traits.hpp:48
boost::multiprecision::number< boost::multiprecision::backends::gmp_rational, boost::multiprecision::et_on > mpq_rational
The exact rational number type.
Definition mpfr_extensions.hpp:55
Numeric traits for a bertini number type: digit counts, conversions, and companion types.
Definition num_traits.hpp:57
ConfigSettingParser()
Definition tracking.hpp:585
ConfigSettingParser()
Definition tracking.hpp:538
ConfigSettingParser()
Definition tracking.hpp:462
ConfigSettingParser()
Definition tracking.hpp:72
ConfigSettingParser()
Definition tracking.hpp:145
ConfigSettingParser()
Definition tracking.hpp:335
NumErrorT T
The numeric type the thresholds are read at.
Definition tracking.hpp:222
ConfigSettingParser()
Definition tracking.hpp:224
Holds the program parameters with respect to Adaptive Multiple Precision.
Definition config.hpp:214
NumErrorT function_eval_error_bound
Bound on the error of evaluating the functions, divided by the unit roundoff error.
Definition config.hpp:240
NumErrorT coefficient_bound
User-defined bound on the sum of the abs vals of the coeffs for any polynomial in the system (for ada...
Definition config.hpp:215
unsigned int maximum_precision
User-chosed setting for the maximum allowable precision. Paths will die if their precision is request...
Definition config.hpp:244
int safety_digits_2
User-chosen setting for the number of safety digits used during Criterion C.
Definition config.hpp:243
int safety_digits_1
User-chosen setting for the number of safety digits used during Criteria A & B.
Definition config.hpp:242
NumErrorT jacobian_eval_error_bound
Bound on the error of evaluating the Jacobian, divided by the unit roundoff error .
Definition config.hpp:233
unsigned max_num_precision_decreases
The maximum number of times precision can be lowered during tracking of a segment of path.
Definition config.hpp:253
NumErrorT linear_solve_error_bound
Bound on the growth in error from a linear solve.
Definition config.hpp:222
NumErrorT degree_bound
User-set bound on degrees of polynomials in the system - tricky to compute for factored polys,...
Definition config.hpp:216
Settings for a fixed-precision tracker (carries the single working precision in effect).
Definition config.hpp:157
Settings governing the Newton corrector's iteration bounds.
Definition config.hpp:119
unsigned max_num_newton_iterations
The maximum number of Newton iterations per correction. MaxNewtonIts.
Definition config.hpp:120
Settings governing step-size adjustment during tracking.
Definition config.hpp:96
mpq_rational max_step_size
The largest allowed step size. MaxStepSize.
Definition config.hpp:101
unsigned max_num_steps
The maximum number of steps allowed during tracking, counting FAILED steps as well as successful ones...
Definition config.hpp:110
mpq_rational step_size_fail_factor
Factor by which to contract the time step when triggered. StepFailFactor.
Definition config.hpp:105
unsigned consecutive_successful_steps_before_stepsize_increase
What it says. If you can come up with a better name, please suggest it. StepsForIncrease.
Definition config.hpp:107
mpq_rational step_size_success_factor
Factor by which to dilate the time step when triggered. StepSuccessFactor.
Definition config.hpp:104
The thresholds a tracker judges a path against: close enough, and too big.
Definition config.hpp:142
NumErrorT path_truncation_threshold
The tracker abandons a path once the largest coordinate of its dehomogenized point exceeds this....
Definition config.hpp:145
Predictor predictor
The ODE method used to predict the next point along the path. RKF45 – order 4 with an embedded error ...
Definition config.hpp:143
Configs and settings for tracking.