Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
config.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//nag_algorithms/config.hpp is free software: you can redistribute it and/or modify
4//it under the terms of the GNU General Public License as published by
5//the Free Software Foundation, either version 3 of the License, or
6//(at your option) any later version.
7//
8//nag_algorithms/config.hpp is distributed in the hope that it will be useful,
9//but WITHOUT ANY WARRANTY; without even the implied warranty of
10//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11//GNU General Public License for more details.
12//
13//You should have received a copy of the GNU General Public License
14//along with nag_algorithms/config.hpp. If not, see <http://www.gnu.org/licenses/>.
15//
16// Copyright(C) Bertini2 Development Team
17//
18// See <http://www.gnu.org/licenses/> for a copy of the license,
19// as well as COPYING. Bertini2 is provided with permitted
20// additional terms in the b2/licenses/ directory.
21
22#pragma once
23
25
26#include <type_traits>
27
28namespace bertini{
29 namespace algorithm{
30
31template<typename T>
32using SolnCont = std::vector<T>;
33
64
65
66
69{
70 using T = NumErrorT;
71
72 T newton_before_endgame = T(1)/T(100000);
73 T newton_during_endgame = T(1)/T(1000000);
74
75};
76
77
80{
81 using T = NumErrorT;
82
83 T same_point_tolerance = T(1)/T(100000);
84};
85
86
87
95
96
97
100{
101 using T = NumErrorT;
102
103 unsigned sharpendigits = 0;
104
105 // std::function<Vec<T>> sharpen_method_; ///< function taking a vector, and sharpening it.
106
107 T function_residual_tolerance = Eigen::NumTraits<T>::dummy_precision();
108
109 T ratio_tolerance = T(99)/T(100);
110};
111
112
113
116{
117 using T = NumErrorT;
118
120
122 unsigned start_level = 0;
123 // These are the SLICE-moving tracking tolerances (Bertini 1's SliceTol* family) -- the tolerances
124 // for moving the linear slices during regeneration, kept separate from the main tracking
125 // tolerances in TolerancesConfig. The slice_ prefix makes every config field name unique across
126 // structs, which is what lets a field be set on an owner without naming its struct
127 // (owner.update(field=...) routes by field).
128 // Defaulted to the same values as the main tracking tolerances they shadow (TolerancesConfig),
129 // which is where Bertini 1 takes its SliceTol* defaults from. They were uninitialized, so a
130 // default-constructed config read indeterminate memory and had no default to document (b2#406).
131 // Regeneration is scaffolding today, so nothing computes differently for this.
134 T slice_final_tolerance = T(1)/T(100000000000);
135};
136
137
138
151
161template<typename ComplexT>
163{
164 if constexpr (std::is_same<ComplexT, complex_dbl>::value)
165 return DoublePrecision();
166 else
167 return DefaultPrecision();
168}
169
187
200
201// Not templated on the complex type: the three times are stored as exact, precision-free
202// mpq_rational (real) and converted to the tracking complex type at the current working precision at
203// use -- the same pattern SteppingConfig uses for its step sizes. This keeps the config precision-
204// agnostic (one struct, not a DoublePrec/Multiprec pair), and is in fact more correct under adaptive
205// precision: a value like the endgame boundary 1/10 is materialized at full working precision rather
206// than frozen at whatever precision the config happened to be constructed at.
207//
208// The times are real because a zero-dim solve tracks along the real t-axis (1 -> 0). Complex
209// homotopy times remain available at the endgame level (set directly), just not through this config.
212{
213 // Per-complex-type default; the ZeroDim algorithm overwrites this in DefaultSettingsSetup with
214 // DefaultInitialAmbientPrecision<BaseComplexT>() (it knows its tracking type, this struct does not).
217
222 unsigned num_threads = 0;
223
233
242
246
247 std::string path_variable_name = "ZERO_DIM_PATH_VARIABLE";
248};
249
255
264{
265 unsigned long random_seed = 0;
266};
267
268
269// a forward declare
270template <typename T>
272
273
274} } // namespaces
Definition config.hpp:34
AlgoChoice
Definition config.hpp:49
@ IsosingularStab
Definition config.hpp:60
@ NewtonIteration
Definition config.hpp:52
@ MembershipTest
Definition config.hpp:57
@ ZeroDim
Definition config.hpp:54
@ WitnessSetProjection
Definition config.hpp:59
@ NewtonIterationCondNum
Definition config.hpp:53
@ SampleComponent
Definition config.hpp:56
@ EvalFunctions
Definition config.hpp:50
@ ExtractWitnessSet
Definition config.hpp:58
@ EvalFunctionJacobian
Definition config.hpp:51
EndgameChoice
Definition config.hpp:37
@ PowerSeries
Definition config.hpp:38
Definition algorithm_base.hpp:34
std::vector< T > SolnCont
Definition config.hpp:32
RecallPolicy
Which recorded outcomes count as already answered when an identical ask is solved again.
Definition config.hpp:182
@ Completed
The default. Reuse completed paths; re-track abandoned ones – except one cut off by a wall-clock limi...
Definition config.hpp:184
@ Everything
Reuse every recorded outcome as recorded, abandonments included; nothing is re-tracked.
Definition config.hpp:185
@ Nothing
Track every path fresh, even when recorded (observers, benchmarking, re-verification)....
Definition config.hpp:183
unsigned DefaultInitialAmbientPrecision()
The default ambient precision for a ZeroDimConfig, by complex type.
Definition config.hpp:162
Definition algorithm_builder.hpp:36
constexpr unsigned DoublePrecision()
The number of digits considered "double precision" (16).
Definition num_traits.hpp:152
double NumErrorT
The numeric type used to hold error/tolerance magnitudes throughout Bertini2 – tracking tolerances,...
Definition num_traits.hpp:48
auto DefaultPrecision()
Get the global default precision (digits) for multiprecision numbers.
Definition mpfr_complex.hpp:135
boost::multiprecision::number< boost::multiprecision::backends::gmp_rational, boost::multiprecision::et_on > mpq_rational
The exact rational number type.
Definition mpfr_extensions.hpp:55
Aggregate include for the various start systems in Bertini2.
Definition config.hpp:271
Configuration for auto-retracking paths flagged as crossed.
Definition config.hpp:90
T midpath_decrease_tolerance_factor
Factor by which tracking tolerances are tightened when re-tracking a crossed path.
Definition config.hpp:93
NumErrorT T
The numeric (error) type.
Definition config.hpp:91
Top-level meta configuration: which algorithm to run.
Definition config.hpp:252
classic::AlgoChoice tracktype
Which algorithm (track type) to run.
Definition config.hpp:253
Configuration for the midpath (path-crossing) check.
Definition config.hpp:80
NumErrorT T
The numeric (error) type.
Definition config.hpp:81
T same_point_tolerance
Two boundary points are "the same" if within this tolerance.
Definition config.hpp:83
Configuration for post-processing solutions (reality/finiteness/singularity classification).
Definition config.hpp:140
T endpoint_finite_threshold
Bertini 1's EndpointFiniteThreshold. An endpoint is considered to be at infinity if the infinity norm...
Definition config.hpp:145
T real_threshold
Bertini 1's ImagThreshold. Threshold on the imaginary part of a (dehomogenized) solution coordinate b...
Definition config.hpp:143
T condition_number_threshold
Bertini 1's CondNumThreshold. An endpoint is considered singular if it is the endpoint of multiple pa...
Definition config.hpp:149
T same_point_tolerance_multiplier
Bertini 1's EndpointSameThreshold. A multiplier (>= 1) on final_tolerance: two endpoints are consider...
Definition config.hpp:147
NumErrorT T
The numeric (error) type.
Definition config.hpp:141
The RNG seed a classic Bertini input file asks for, via randomseed: N;.
Definition config.hpp:264
unsigned long random_seed
The classic input's seed; 0 means draw one from entropy and report it.
Definition config.hpp:265
How a recording algorithm uses the records it finds: not what to compute, but what already-recorded w...
Definition config.hpp:197
RecallPolicy recall
Which recorded outcomes of an identical ask are reused in place of tracking (see RecallPolicy)....
Definition config.hpp:198
Configuration for the regeneration cascade.
Definition config.hpp:116
unsigned start_level
The regeneration level to start from.
Definition config.hpp:122
bool remove_infinite_endpoints
Bool indicating whether endpoints during the regeneration start point buildup step which are infinite...
Definition config.hpp:119
T slice_newton_before_endgame
Slice-moving tracking tolerance before the endgame. SliceTolBeforeEG.
Definition config.hpp:132
T slice_newton_during_endgame
Slice-moving tracking tolerance during the endgame. SliceTolDuringEG.
Definition config.hpp:133
NumErrorT T
The numeric (error) type.
Definition config.hpp:117
T slice_final_tolerance
Final tolerance to track the slice move to, using the endgame. SliceFinalTol.
Definition config.hpp:134
bool higher_dimension_check
RegenHigherDimTest.
Definition config.hpp:121
Configuration for sharpening computed solutions.
Definition config.hpp:100
unsigned sharpendigits
how many digits should be correct after sharpening. 0 = do not sharpen, which is Bertini 1's default....
Definition config.hpp:103
T function_residual_tolerance
A polynomial (or any function, really) evaluated at a point is considered to be 0 if the magnitude is...
Definition config.hpp:107
T ratio_tolerance
A computed value is considered to be zero if the ratio of two different approximations is smaller tha...
Definition config.hpp:109
NumErrorT T
The numeric (error) type.
Definition config.hpp:101
Newton and path-tracking tolerances.
Definition config.hpp:69
T newton_before_endgame
Newton tolerance before the endgame (E.4.1).
Definition config.hpp:72
T newton_during_endgame
Newton tolerance during the endgame (E.4.2).
Definition config.hpp:73
NumErrorT T
The numeric (error) type.
Definition config.hpp:70
Top-level configuration for a zero-dimensional solve (times, precision, threading).
Definition config.hpp:212
unsigned num_threads
Number of worker threads tracking paths, in a standalone solve and on each MPI rank.
Definition config.hpp:222
mpq_rational start_time
Homotopy start time (t=1).
Definition config.hpp:243
std::string path_variable_name
Name given to the homotopy's path variable.
Definition config.hpp:247
double max_path_wall_clock_duration
Wall-clock budget for each path, in seconds; 0 (the default) means none.
Definition config.hpp:232
mpq_rational target_time
Homotopy target time (t=0).
Definition config.hpp:245
unsigned initial_ambient_precision
Initial ambient (working) precision for the solve.
Definition config.hpp:215
double max_solve_wall_clock_duration
Wall-clock budget for the whole solve, in seconds; 0 (the default) means none.
Definition config.hpp:241
unsigned max_num_crossed_path_resolve_attempts
The maximum number of times to attempt to re-solve crossed paths at the endgame boundary.
Definition config.hpp:216
mpq_rational endgame_boundary
Time at which tracking hands off to the endgame (t=1/10).
Definition config.hpp:244
Selects which endgame to use (classic input).
Definition config.hpp:44
EndgameChoice endgame
The chosen endgame. Power series is Bertini 1's documented default (EndgameNum 1); see ADR-0058.
Definition config.hpp:45