664 friend class gpr::tests::AtomicDimerTest;
665 friend class gpr::tests::MeasuredRefinementTerminalTest;
666 friend class gpr::tests::PolicyCacheTest;
722 secant_orientation_seed_ = enabled;
727 return secant_hessian_;
734 return secant_counts_;
740 ? std::make_shared<gpr::WallClockLimit>(seconds)
746 wall_clock_limit_ = std::move(limit);
747 if (gpr_model !=
nullptr)
748 gpr_model->setWallClockLimit(wall_clock_limit_);
754 std::shared_ptr<const gpr::policy::TrainingPolicy> policy);
757 return wall_clock_limit_ && wall_clock_limit_->reached();
776 force_stop_certificate_step_ = step;
783 vibrational_stencil_ = mode;
788 return vibrational_stencil_;
792 return force_stop_certificate_step_;
797 return force_stop_certified_;
803 return force_stop_certificate_calls_;
815 return isAtomsConfigurationCorrect();
831 return final_rotation_omega_;
841 return latest_mode_curvature_;
847 return middle_point_final;
867 return final_rotation_residual_;
881 const
gpr::Coord& orientation,
882 pot::PotentialWrapper& potential,
883 double surrogate_curvature);
900 "returns the gradient; use "
901 "getFinalGradientAtMidPoint()")]] [[nodiscard]] inline
Eigen::VectorXd
920 const
Eigen::VectorXd& kick,
921 const
gpr::Observation& measured_rows,
922 pot::PotentialWrapper& potential);
963 const
Eigen::MatrixXd& cartesian_hessian,
964 pot::PotentialWrapper& potential,
double resolution = 0.0);
970 const
Eigen::MatrixXd& cartesian_hessian,
971 pot::PotentialWrapper& potential,
gpr::Observation* raw_candidate,
972 double resolution = 0.0,
bool complete_stencil = false);
984 const
gpr::Observation& raw_center,
985 const
Eigen::MatrixXd& certified_cartesian_hessian,
986 const
Eigen::MatrixXd& certified_mass_weighted_basis,
987 bool first_order_certificate);
993 return curvature_requires_full_refit_ ||
994 !hasOptimizedCurrentObservedData();
1010 const Eigen::MatrixXd& cartesian_hessian);
1057 return transition_param.max_step_length;
1062 return stop_citeria_dimer.force;
1067 if (!(std::isfinite(force) && force > 0.0))
return;
1068 configured_force_criterion_ = force;
1069 stop_citeria_dimer.force = force;
1073 const Eigen::Ref<const Eigen::RowVectorXd>& positions,
1074 const Eigen::Ref<const Eigen::RowVectorXd>& gradient)
const
1076 return forceNormForConvergence(positions, gradient);
1113 return phase_history_;
1119 return relaxation_termination_reason_;
1127 if (relaxation_termination_reason_ !=
1130 return measured_index_zero_hessian_;
1138 if (relaxation_termination_reason_ !=
1141 return measured_index_zero_resolution_;
1160 return first_surrogate_action_;
1186 preserve_seed_kernel_ =
true;
1219 return (n_total > N_obs_init) ? (n_total - N_obs_init) : 0;
1245 return E_zero_level;
1272 const double stop_criteria);
1292 const double stop_criteria);
1337 bool complete_stencil_follows =
false);
1339 [[nodiscard]]
bool image1CarriesOracleGradient()
const;
1343 const Eigen::VectorXd& escape,
1344 double separation,
double step,
1349 std::vector<bool> hyperparameterRowPool();
1351 void updateVarianceSubsetFootprint(
const std::vector<bool>& pool,
1352 bool preserve_support =
false);
1357 bool retainFittedKernelForConsistentRows();
1360 double directionalCurvatureUncertainty(
const gpr::Coord& R,
1361 const Eigen::VectorXd& direction);
1363 void prepareIndexOneProjection(
const gpr::Coord& R);
1366 void applyIndexOneProjection(
const Eigen::VectorXd& direction,
1367 Eigen::VectorXd& action)
const;
1371 void resolveSurrogateNegativeModesBeforePhase(
1385 bool isAtomsConfigurationCorrect();
1390 void evaluateAccurateEnergyAndForceAtMidPoint(
1416 bool evaluateAccurateEnergyAndForce(
1418 bool apply_emd_dedup =
true);
1420 struct AccurateObservationResult {
1434 Eigen::Index batch_chunk, std::string& failure);
1440 AccurateObservationResult evaluateAccurateObservation(
1442 bool apply_emd_dedup =
true);
1444 enum class DimerOracleProbeRole { Midpoint, StructuralImage1 };
1453 bool maybeSkipAccurateViaVariance(
1455 DimerOracleProbeRole role = DimerOracleProbeRole::Midpoint);
1459 enum class SurrogateSpectrumRequest {
1464 std::pair<gpr::Coord, double> estimateLowestModeAndCurvatureFromGP(
1466 SurrogateSpectrumRequest request =
1467 SurrogateSpectrumRequest::ContourProjection);
1471 void optimizeGPRModel();
1472 void refitGPRModel(
bool reinitialize,
const gpr::Observation& witness,
1474 bool measured_trial_rejected =
false);
1477 void applyLikelihoodNoiseFloorAfterRefit();
1478 void refreshGPRModelFixedTheta();
1481 [[nodiscard]]
bool contradictionRefitWouldBeFutile(
1482 double evidence_nats)
const;
1485 void recordContradictionRefitOutcome(
const Eigen::VectorXd& theta_before,
1486 double noise_before);
1487 bool refreshGPRModelFixedThetaIfObjectiveStationary();
1488 void calculateApproximatePotential(gpr::Observation& obs);
1489 void calculateApproximateVariance(gpr::Observation& obs);
1490 void logPhaseTimingSummary(
double elapsed_seconds);
1501 bool limitTranslation(
const gpr::Coord& R, gpr::LBFGSInfo& trans_info,
1502 gpr::Coord& R_new,
bool* measured_boundary =
nullptr);
1504 bool limitTranslationGeometry(
const gpr::Coord& R,
1505 gpr::LBFGSInfo& trans_info,
1511 bool* measured_boundary =
nullptr);
1515 struct InterAtomicTrustDistance {
1516 double distance = std::numeric_limits<double>::infinity();
1517 double threshold = 0.0;
1520 [[nodiscard]]
double shortestKernelLengthScale() const noexcept;
1521 void recordPredictedMeasuredAgreement(const gpr::Observation& predicted,
1522 const gpr::Observation& measured);
1523 [[nodiscard]] InterAtomicTrustDistance evaluateInterAtomicTrustDistance(
1524 const gpr::Coord& R_new, const gpr::Coord& R_all) const;
1525 [[nodiscard]]
bool projectInterAtomicTrustBoundary(
1526 const gpr::Coord& R_current, const gpr::Coord& R_trial,
1527 const gpr::Coord& R_all, gpr::Coord& R_projected) const;
1536 bool isInterAtomicDistanceTooBig(const gpr::Coord& R_new,
1537 const gpr::Coord& R_all,
1538 gpr::Index_t& num_es1);
1543 gpr::Index_t getNumEvaluations();
1551 void checkIfMaxIterReachedAndPrintWarning(const gpr::Index_t iter_counter,
1552 const gpr::Index_t iter_limit,
1553 const std::
string& message);
1563 bool checkRotationalConvergence(const gpr::Coord& orient,
1564 const gpr::Coord& orient_old,
1565 const
double stop_criteria);
1566 [[nodiscard]]
bool isRotationCurvatureInformative(
1567 double curvature) const noexcept;
1568 [[nodiscard]]
double exactEmdDuplicateThreshold(
1569 const gpr::Coord& query) const noexcept;
1573 void defineStartPath(const gpr::Coord& R_latest_conv,
1574 const gpr::Coord& orient_latest_conv,
1575 const gpr::Coord& orient_init_gpr,
1576 const gpr::Index_t outer_iter_idx,
1577 gpr::Coord& R_previous, gpr::Coord& orient_previous,
1578 gpr::Observation& middle_point, gpr::Coord& orient);
1588 void performInitialRotations(gpr::Observation& middle_point,
1590 pot::PotentialWrapper& potential);
1600 std::pair<
double, gpr::Coord> performGPRIterations(
1601 gpr::Observation& middle_point, gpr::Coord& orient,
1602 pot::PotentialWrapper& potential);
1605 double performRotationAndTranslationWithGPR(
1606 const
double stop_dimer_gp, gpr::Observation& middle_point,
1607 gpr::Coord& orient, gpr::Coord& R_latest_conv, gpr::Coord& R_previous,
1608 gpr::Coord& orient_latest_conv, gpr::Coord& orient_previous,
1609 gpr::Coord& R_new, gpr::Index_t& num_esmax, gpr::Index_t& num_es1,
1610 const
size_t& outer_iter_idx,
bool& require_midpoint_oracle,
1611 DimerSurrogateActionCertificate* first_action =
nullptr,
1612 bool stop_after_first_action = false,
1613 const gpr::Observation* measured_reference =
nullptr);
1616 double performSurrogateRotation(gpr::Observation& middle_point,
1617 gpr::Observation& approx_obs,
1619 gpr::LBFGSInfo& rot_info);
1622 double performRotationAndTranslationPure(gpr::Observation& middle_point,
1623 gpr::Observation& approx_obs,
1626 gpr::LBFGSInfo& rot_info,
1627 gpr::LBFGSInfo& trans_info);
1629 inline
double calculateCurvature(
1630 const gpr::Coord& orient, const gpr::Observation& approx_obs,
1631 bool use_hssvd_analytic = false,
1632 double cached_hssvd_curvature =
1633 std::numeric_limits<
double>::quiet_NaN());
1635 inline
void assignFinalResults(
1636 const gpr::Observation& middle_point,
1637 const std::pair<
double, gpr::Coord>& eigen_data);
1639 void writeLatticeData(gpr::Observation& middle_point);
1642 void writeHDF5(
const gpr::Observation& middle_point,
1643 const std::string& addl_group,
const size_t& idx);
1646 void markObservedDataChanged() noexcept
1648 ++all_obs_revision_;
1649 optimized_all_obs_revision_ = kUnoptimizedObservationRevision;
1652 void synchronizeObservedData();
1654 void reseedAttachedModelIfWarmStartInfeasible();
1658 [[nodiscard]]
bool keepsAbsoluteEnergies() const noexcept;
1659 void markGPRModelOptimizedForObservedData() noexcept
1661 optimized_all_obs_revision_ = all_obs_revision_;
1662 refit_oracle_batch_.clear();
1664 [[nodiscard]]
bool hasOptimizedCurrentObservedData() const noexcept
1666 return optimized_all_obs_revision_ == all_obs_revision_;
1670 static constexpr std::uint64_t kUnoptimizedObservationRevision =
1671 std::numeric_limits<std::uint64_t>::max();
1686 gpr::Observation middle_point_init;
1691 gpr::Observation image1;
1696 gpr::Observation all_obs;
1698 gpr::Observation refit_oracle_batch_;
1701 bool curvature_requires_full_refit_ =
false;
1706 double pending_contradiction_evidence_nats_ =
1707 std::numeric_limits<double>::quiet_NaN();
1713 double futile_refit_evidence_nats_ =
1714 std::numeric_limits<double>::quiet_NaN();
1716 double futile_refit_noise_variance_ =
1717 std::numeric_limits<double>::quiet_NaN();
1720 std::size_t last_escape_descent_calls_ = 0;
1723 std::size_t last_certificate_probe_calls_ = 0;
1727 double configured_force_criterion_ =
1728 std::numeric_limits<double>::quiet_NaN();
1731 double last_certificate_force_target_ =
1732 std::numeric_limits<double>::infinity();
1733 std::uint64_t all_obs_revision_ = 0;
1734 std::uint64_t optimized_all_obs_revision_ = kUnoptimizedObservationRevision;
1737 gpr::neb::ObservationArchive* observation_archive_ =
nullptr;
1738 std::unique_ptr<readcon_db::Corpus> trace_corpus_;
1739 std::string trace_con_path_;
1744 gpr::Observation middle_point_final;
1745 double curvature_final;
1747 bool final_converged_ =
false;
1748 double latest_mode_curvature_ = 0.0;
1751 double latest_mode_curvature_resolution_ = 0.0;
1758 double final_rotation_omega_ = std::numeric_limits<double>::quiet_NaN();
1759 double final_rotation_residual_ = std::numeric_limits<double>::infinity();
1762 Eigen::Index measured_rotation_rounds_ = 0;
1766 gpr::Observation measured_rotation_reference_;
1767 double measured_rotation_separation_ = 0.0;
1768 Eigen::MatrixXd measured_rotation_physical_;
1769 Eigen::MatrixXd measured_rotation_basis_;
1770 Eigen::MatrixXd measured_rotation_actions_;
1773 bool measured_rotation_stationary_ =
false;
1777 double best_measured_rotation_residual_ =
1778 std::numeric_limits<double>::infinity();
1779 double best_measured_rotation_angle_ =
1780 std::numeric_limits<double>::quiet_NaN();
1781 double best_measured_rotation_curvature_ =
1782 std::numeric_limits<double>::quiet_NaN();
1784 gpr::Observation best_measured_image1_;
1807 std::unique_ptr<gpr::GaussianProcessRegression> owned_gpr_model_;
1808 gpr::GaussianProcessRegression* gpr_model =
nullptr;
1809 bool uses_external_gp_ =
false;
1810 bool preserve_seed_kernel_ =
false;
1812 gpr::StopCriteriaForDimer stop_citeria_dimer;
1813 gpr::StopCriteriaForDimer stop_citeria_gpr;
1815 bool project_rigid_modes_for_convergence_ =
false;
1816 double divisor_stop_criteria_gpr;
1827 gpr::IterationsLimits max_iter_init_rot;
1828 bool use_gpr_initial_rotations_ =
true;
1830 gpr::IterationsLimits max_iter_new_pairs;
1832 gpr::IterationsLimits max_iter_relax_rot;
1834 bool assume_many_iterations;
1835 bool evaluate_image1_each_phase_;
1842 double ratio_at_limit;
1869 uint8_t method_trans;
1874 struct early_stopping_t {
1893 bool _use_adaptive_threshold;
1915 double _adaptive_floor;
1917 double _adaptive_t_min;
1918 double _adaptive_delta_explore;
1919 int _adaptive_half_life;
1926 gpr::TransitionParameters transition_param;
1939 gpr::io::LogManager log_man;
1949 Eigen::Index oracle_batch_chunk_ = 0;
1951 bool profile_phase_timing_ =
false;
1952 bool use_hssvd_analytic_curvature_ =
false;
1955 bool inexact_curvature_logged_ =
false;
1961 bool want_second_negative_mode_ =
false;
1962 bool external_terminal_certificate_ =
false;
1965 bool higher_order_restart_ =
false;
1966 void retainMeasuredNegativeSubspace(
const Eigen::MatrixXd& hessian,
1971 bool escapeByOrderOneSaddleSession(
const gpr::Observation& midpoint,
1972 pot::PotentialWrapper& potential,
1973 gpr::Observation& recovery);
1974 static rgsaddle_status_t orderOneSurface(
1978 Eigen::MatrixXd escape_hessian_;
1980 double index_frequency_resolution_ = 0.0;
1981 Eigen::Index last_negative_mode_count_ = -1;
1984 std::vector<std::pair<double, Eigen::VectorXd>> index_one_clamped_modes_;
1989 struct SurrogateSpectrum {
1992 Eigen::VectorXd curvatures;
1993 Eigen::MatrixXd modes;
1994 Eigen::Index mode_index = -1;
1995 } surrogate_spectrum_;
2005 bool restartLocalTranslation(
const gpr::Coord& R,
2012 std::vector<std::pair<Eigen::VectorXd, double>>
2013 measured_negative_directions_;
2019 Eigen::VectorXd pending_flat_direction_;
2020 double pending_flat_curvature_ = std::numeric_limits<double>::quiet_NaN();
2024 bool last_step_descends_measured_negative_ =
false;
2029 void resolveFlatResidualDirection(
const gpr::Observation& midpoint,
2031 pot::PotentialWrapper& potential);
2034 Eigen::Index last_asserted_negative_modes_ = 0;
2035 Eigen::VectorXd additional_mode_;
2038 Eigen::MatrixXd index_search_directions_;
2039 double additional_gp_curvature_ = std::numeric_limits<double>::quiet_NaN();
2045 double trial_variance_calibration_ = 1.0;
2048 std::optional<gpr::ScaleFreeTrustRegion> measured_trial_trust_;
2049 gpr::TrustRadius measured_trial_region_;
2052 void setMeasuredTrialAnchor(
const gpr::Coord& measured);
2056 void shrinkMeasuredTrialTrust(
double displacement,
2059 int consecutive_oracle_failures_ = 0;
2062 void recordOracleTrialFailure(
const std::string& what);
2072 Eigen::MatrixXd measured_index_zero_hessian_;
2074 double measured_index_zero_resolution_ = 0.0;
2075 double last_trial_force_variance_ =
2076 std::numeric_limits<double>::quiet_NaN();
2077 double model_force_error_ = std::numeric_limits<double>::quiet_NaN();
2078 double model_force_scale_ = std::numeric_limits<double>::quiet_NaN();
2079 double model_energy_error_ = std::numeric_limits<double>::quiet_NaN();
2080 double model_energy_scale_ = std::numeric_limits<double>::quiet_NaN();
2085 bool uncertainty_aware_rotation_ =
false;
2086 double kappa_dimer_beta_ = 0.0;
2087 bool kappa_dimer_refining_ =
false;
2088 std::unique_ptr<gpr::neb::RgsaddleClient> kappa_dimer_client_;
2091 std::unique_ptr<gpr::optim::RgminStep> rgmin_trans_;
2094 double accurate_potential_seconds_ = 0.0;
2095 double gp_optimize_seconds_ = 0.0;
2096 double gp_predict_seconds_ = 0.0;
2097 double gp_predict_mean_seconds_ = 0.0;
2098 double gp_predict_variance_seconds_ = 0.0;
2100 double gp_mode_seconds_ = 0.0;
2101 double gp_fixed_theta_refresh_seconds_ = 0.0;
2178 variance_gate_ = cfg;
2183 return variance_gate_;
2191 variance_gate_.accept_tau = tau;
2194#ifdef USE_READCON_DB
2200 void setObservationArchive(gpr::neb::ObservationArchive* archive)
noexcept
2202 observation_archive_ = archive;
2207 void setTraceCorpus(
const std::string& db_path);
2210 return trace_corpus_.get();
2218 void writeTraceFrame(
const gpr::Observation& obs,
const std::string& phase,
2225#ifdef USE_READCON_DB
2226 if (!observation_archive_)
return;
2227 for (Eigen::Index row = 0; row < obs.R.rows(); ++row) {
2228 if (row >= obs.E.rows() || row >= obs.G.rows())
break;
2229 const Eigen::VectorXd positions = obs.R.row(row).transpose();
2230 const Eigen::VectorXd gradient = obs.G.row(row).transpose();
2231 (void)observation_archive_->append(positions, obs.E(row, 0),
2240 return variance_gate_.accept_tau;
2250 variance_gate_.accept_tau_relative = tau_relative;
2254 return variance_gate_.accept_tau_relative;
2258 return variance_skipped_accurate_calls_;
2262 return imspe_soft_skipped_calls_;
2266 return fixed_theta_refresh_calls_;
2270 return fixed_theta_refresh_calls_;
2275 return imspe_admitted_near_duplicate_observations_;
2283 return dedup_rejected_observations_;
2292 alignment_abort_tol_ = tol;
2303 abort_on_degenerate_probes_ = enabled;
2311 max_oracle_calls_ = calls;
2315 return max_oracle_calls_;
2324 index_frequency_resolution_ = wavenumber;
2328 return index_frequency_resolution_;
2333 want_second_negative_mode_ = enabled;
2337 return want_second_negative_mode_ &&
2338 (!external_terminal_certificate_ || higher_order_restart_);
2345 external_terminal_certificate_ = enabled;
2349 return last_negative_mode_count_;
2359 measured_energy_ceiling_ = ceiling;
2367 saddle_energy_floor_ = floor;
2373 return last_refinement_reached_index_one_;
2384 abort_on_interatomic_collapse_ = enabled;
2393 preserve_initial_alignment_reference_ = enabled;
2405 likelihood_noise_floor_sigma2_ = floor_sigma2;
2414 self_owned_model_profile_ = profile;
2421 self_owned_use_zbl_prior_mean_ = use;
2425 self_owned_use_ff_prior_mean_ = use;
2429 return alignment_abort_tol_;
2442 leash_relax_when_close_ = enabled;
2446 return leash_relax_when_close_;
2450 evaluate_image1_each_phase_ = enabled;
2454 return evaluate_image1_each_phase_;
2462 project_rigid_modes_for_convergence_ = enabled;
2470 oracle_batch_chunk_ = chunk < 0 ? 0 : chunk;
2474 return oracle_batch_chunk_;
2479 profile_phase_timing_ = enabled;
2483 return profile_phase_timing_;
2495 use_hssvd_analytic_curvature_ = enabled;
2499 return use_hssvd_analytic_curvature_;
2503 hssvd_mode_selection_policy_ = policy;
2508 return active_set_change_count_;
2512 return active_frozen_count_;
2516 hdf5_trace_path_ = path;
2523 uncertainty_aware_rotation_ = enabled;
2531 project_measured_rotations_ = enabled;
2539 return kappa_dimer_beta_;
2544 return hdf5_trace_path_;
2552 hdf5_trace_enabled_ = enabled;
2556 return hdf5_trace_enabled_;
2560 struct LocalPotentialReference {
2563 std::uint64_t factor_epoch = std::numeric_limits<std::uint64_t>::max();
2565 bool hdf5_trace_enabled_ =
false;
2566 bool project_measured_rotations_ =
true;
2567 std::string hdf5_trace_path_ =
"gpridge_out.h5";
2568 VarianceGateConfig variance_gate_{};
2569 const gpr::policy::TrainingPolicy* training_policy_ =
nullptr;
2570 std::shared_ptr<const gpr::policy::TrainingPolicy> training_policy_owner_;
2571 std::uint64_t policy_retained_all_obs_revision_ =
2572 kUnoptimizedObservationRevision;
2573 const gpr::policy::TrainingPolicy* policy_retained_owner_ =
nullptr;
2574 bool policy_admission_passthrough_ =
false;
2575 std::vector<DimerPhaseRecord> phase_history_;
2576 DimerSurrogateActionCertificate first_surrogate_action_;
2579 double likelihood_noise_floor_sigma2_ =
2580 std::numeric_limits<double>::quiet_NaN();
2583 bool self_owned_use_zbl_prior_mean_ =
false;
2584 bool self_owned_use_ff_prior_mean_ =
false;
2585 double alignment_abort_tol_ = 0.0;
2586 bool abort_on_degenerate_probes_ =
false;
2588 std::shared_ptr<const gpr::WallClockLimit> wall_clock_limit_;
2592 bool force_stop_certified_ =
false;
2593 int force_stop_certificate_calls_ = 0;
2594 gpr::Observation budget_stop_midpoint_;
2596 bool oracle_budget_unwinds_ =
false;
2597 bool abort_on_interatomic_collapse_ =
false;
2598 bool converged_above_energy_ceiling_ =
false;
2599 double seed_min_interatomic_ = std::numeric_limits<double>::quiet_NaN();
2607 void recordContactReferences(
const gpr::Observation& middle_point);
2610 [[nodiscard]] std::vector<int> contactDomainAtomicNumbers(
2611 Eigen::Index moving_count, Eigen::Index frozen_active_count)
const;
2612 double measured_energy_ceiling_ = std::numeric_limits<double>::quiet_NaN();
2613 double saddle_energy_floor_ = std::numeric_limits<double>::quiet_NaN();
2614 bool last_refinement_reached_index_one_ =
false;
2615 bool preserve_initial_alignment_reference_ =
false;
2616 bool leash_relax_when_close_ =
false;
2620 gpr::Index_t imspe_admitted_near_duplicate_observations_ = 0;
2627 Eigen::MatrixXd imspe_query_history_;
2628 int imspe_query_history_count_ = 0;
2629 int imspe_query_history_head_ = 0;
2634 [[nodiscard]]
bool maybeSoftSkipViaImspe(
const gpr::Coord& R_query);
2635 void recordImspeQueryHistory(
const gpr::Coord& R_query);
2636 [[nodiscard]]
bool computeImspeAdmissionScore(
const gpr::Coord& R_query,
2638 double& relative_gain,
2639 bool allow_hssvd_local);
2640 [[nodiscard]]
bool shouldSkipOracleByImspeAdmission(
2642 [[nodiscard]]
bool shouldSkipMidpointOracleByEmdNear(
2643 const gpr::Observation& obs);
2644 [[nodiscard]]
double forceNormForConvergence(
2645 const Eigen::Ref<const Eigen::RowVectorXd>& gradient)
const;
2646 [[nodiscard]]
double forceNormForConvergence(
2647 const Eigen::Ref<const Eigen::RowVectorXd>& positions,
2648 const Eigen::Ref<const Eigen::RowVectorXd>& gradient)
const;
2649 [[nodiscard]]
double forceNormForConvergence(
2650 const gpr::Observation& obs)
const;
2651 [[nodiscard]]
double surrogateForceTolerance(
2652 const gpr::Observation& oracle_middle_point)
const;
2653 [[nodiscard]]
double bestObservedForceNorm()
const;
2658 gpr::Observation variance_probe_scratch_;
2674 double emd_dedup_threshold_ = 0.0;
2681 [[nodiscard]]
double effectiveEmdDedupThreshold()
const;
2682 [[nodiscard]]
double initialRotationStopCriterion()
const;
2691 static constexpr gpr::Index_t kMaxConsecutiveDegenerateProbes = 3;
2700 Eigen::VectorXd last_nonterminal_certificate_r_;
2701 bool certificate_fixed_point_ =
false;
2719 static constexpr gpr::Index_t kMaxUninformativeRotations = 3;
2725 bool appendObservationIfInformative(
const gpr::Observation& obs);
2726 bool policySuppressesAccurateCall(
const gpr::Observation& obs,
2727 DimerOracleProbeRole role);
2728 bool policyRetainObservations();
2729 bool coalesceObservationIntoNearestEmdRepresentative(
2730 const gpr::Observation& obs);
2735 void appendConvergenceCertificateObservation(
const gpr::Observation& obs);
2737 [[nodiscard]]
bool shouldAbortDegenerateProbeBurst() const noexcept
2739 return (alignment_abort_tol_ > 0.0 || abort_on_degenerate_probes_) &&
2740 consecutive_degenerate_probes_ >=
2741 kMaxConsecutiveDegenerateProbes;
2743 [[nodiscard]]
bool searchStalledOnDegenerateProbes() const noexcept
2747 [[nodiscard]]
bool oracleBudgetSpent() noexcept
2749 return max_oracle_calls_ > 0 &&
2750 getNumEvaluations() >= max_oracle_calls_;
2756 bool requireOracleBudget(Eigen::Index rows);
2757 void requireWallClock()
const
2760 throw gpr::WallClockLimitReached{};
2764 void certifyExecuteForceStop(pot::PotentialWrapper& potential);
2765 [[nodiscard]]
bool shouldProbeImage1ForDegenerateMidpoint() const noexcept
2767 return !evaluate_image1_each_phase_ &&
2768 consecutive_degenerate_probes_ >=
2769 kMaxConsecutiveDegenerateProbes;
2774 gpr::EnergySurfaceOutputInfo debug_output_info;
2779 Eigen::MatrixXd last_certificate_hessian_;
2784 LocalPotentialReference* local_potential_reference_ =
nullptr;
2785 gpr::optim::SecantHessianConfig secant_config_;
2786 gpr::optim::SecantHessian secant_hessian_;
2787 std::vector<gpr::optim::SecantForceSample> secant_force_samples_;
2788 gpr::optim::SecantCurvatureCounts secant_counts_;
2789 std::size_t secant_pairs_checked_ = 0;
2790 bool secant_probe_in_progress_ =
false;
2791 bool secant_orientation_seed_ =
true;
2792 void syncSecantQuadraticPrior();
2795 void recordTrueForceSecant(
const gpr::Observation& observation,
2798 void rememberSecantForceSample(
const Eigen::VectorXd& position,
2799 const Eigen::VectorXd& gradient,
2801 [[nodiscard]] Eigen::VectorXd secantQuadraticHessianAction(
2802 const Eigen::VectorXd& direction)
const;
2803 void purchaseSecantConsistency(pot::PotentialWrapper& potential);
2804 void seedOrientationFromSecant(
gpr::Coord& orient)
const;