Loading...
Searching...
No Matches
AcquisitionPolicy.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3// See LICENSE for details.
4
26
27#ifndef GPR_NEB_OIE_ACQUISITIONPOLICY_H_
28#define GPR_NEB_OIE_ACQUISITIONPOLICY_H_
29
30#include <Eigen/Dense>
31#include <cstdint>
32#include <vector>
33
34namespace gpr {
35namespace neb {
36namespace oie {
37
42
43[[nodiscard]] const char* tpeObjectiveName(TpeObjective objective) noexcept;
44
45[[nodiscard]] const char* tpeObjectiveLogName(bool evaluated,
46 TpeObjective objective) noexcept;
47
49 bool ci_active, bool candidate_confident,
50 bool chain_certificate_met) noexcept;
51
56 // Full-band image index (1 .. n_images-2) selected for the oracle, or -1
57 // when there is no eligible interior image.
58 int image_index = -1;
59 // True in force-accuracy mode when the confidence gate passed AND an
60 // interior energy maximum sits strictly above both endpoints, so the pick
61 // is the true interior maximum rather than a TPE density pick.
62 bool from_ci_saddle = false;
63 // True when the band is globally confident at this outer iteration.
64 bool confident = false;
65 // True when an interior maximum strictly exceeds both endpoint energies.
66 bool saddle_exists = false;
67 // The standardized per-interior-image utility (size n_images-2), exposed
68 // for tracing / tests.
69 std::vector<double> interior_utility;
70};
71
82public:
83 explicit AcquisitionPolicy(
84 std::vector<char> eligible_images = {},
86
88 const std::vector<double>& energies,
89 const std::vector<double>& posterior_energy_variance,
90 const std::vector<double>& force_norm,
91 const std::vector<double>& force_variance, int outer_iter) const;
92
93private:
94 [[nodiscard]] bool eligible(int image_index, int n_images) const;
95
96 std::vector<char> eligible_images_;
98};
99
108Eigen::VectorXd drawPosteriorObservationSample(
109 const Eigen::VectorXd& posterior_mean,
110 const Eigen::MatrixXd& posterior_covariance, std::uint64_t seed = 0);
111
119double ucbBeta(int outer_iter, int n_candidates);
120
125double gaussianExceedanceProbability(double reference_mean,
126 double reference_variance,
127 double challenger_mean,
128 double challenger_variance);
129
136bool saddleExists(const std::vector<double>& energies);
137
154bool confidenceMet(const std::vector<double>& energies,
155 const std::vector<double>& posterior_energy_variance,
156 int outer_iter);
157
171std::vector<double> oieUtility(
172 const std::vector<double>& energies,
173 const std::vector<double>& posterior_energy_variance,
174 const std::vector<double>& force_norm,
175 const std::vector<double>& force_variance, int outer_iter, bool confident);
176
186std::vector<double> saddleIdentityUtility(
187 const std::vector<double>& energies,
188 const std::vector<double>& posterior_energy_variance);
189
199int tpePick(const std::vector<double>& interior_utility);
200
214 const std::vector<double>& energies,
215 const std::vector<double>& posterior_energy_variance,
216 const std::vector<double>& force_norm,
217 const std::vector<double>& force_variance, int outer_iter);
218
219} // namespace oie
220} // namespace neb
221} // namespace gpr
222
223#endif // GPR_NEB_OIE_ACQUISITIONPOLICY_H_
AcquisitionPolicy(std::vector< char > eligible_images={}, TpeObjective objective=TpeObjective::ForceAccuracy)
TpePickResult selectTpeOracleTarget(const std::vector< double > &energies, const std::vector< double > &posterior_energy_variance, const std::vector< double > &force_norm, const std::vector< double > &force_variance, int outer_iter) const
std::vector< double > saddleIdentityUtility(const std::vector< double > &energies, const std::vector< double > &posterior_energy_variance)
Per-image value of information for resolving the interior argmax.
double gaussianExceedanceProbability(double reference_mean, double reference_variance, double challenger_mean, double challenger_variance)
Probability that a Gaussian challenger equals or exceeds a Gaussian reference under the independent-m...
const char * tpeObjectiveName(TpeObjective objective) noexcept
const char * tpeObjectiveLogName(bool evaluated, TpeObjective objective) noexcept
TpeObjective tpeObjectiveForSaddleState(bool ci_active, bool candidate_confident, bool chain_certificate_met) noexcept
TpePickResult selectTpeOracleTarget(const std::vector< double > &energies, const std::vector< double > &posterior_energy_variance, const std::vector< double > &force_norm, const std::vector< double > &force_variance, int outer_iter)
Full OIE target decision with the strict-saddle CI constraint and every interior image eligible.
double ucbBeta(int outer_iter, int n_candidates)
GP-UCB exploration schedule sqrt(beta_t), Srinivas et al. 2010.
std::vector< double > oieUtility(const std::vector< double > &energies, const std::vector< double > &posterior_energy_variance, const std::vector< double > &force_norm, const std::vector< double > &force_variance, int outer_iter, bool confident)
Per-interior-image standardized OIE utility (the TPE objective).
Eigen::VectorXd drawPosteriorObservationSample(const Eigen::VectorXd &posterior_mean, const Eigen::MatrixXd &posterior_covariance, std::uint64_t seed)
Draw one joint posterior realization for action-level PS-BAX.
bool confidenceMet(const std::vector< double > &energies, const std::vector< double > &posterior_energy_variance, int outer_iter)
Global-confidence gate without a magic threshold.
bool saddleExists(const std::vector< double > &energies)
Strict interior maximum above BOTH endpoints (no single-hump assumption: any interior image above max...
int tpePick(const std::vector< double > &interior_utility)
TPE acquisition over the DISCRETE interior-image index axis.
The nudged elastic band: path, GP-NEB driver, configuration and result, acquisition,...
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition Macros.h:16
Result of a TPE acquisition pick over the interior band.
std::vector< double > interior_utility