.. index:: pair: namespace; gpr::policy .. _doxid-namespacegpr_1_1policy: namespace gpr::policy ===================== .. toctree:: :hidden: enum_gpr_policy_OracleRole.rst enum_gpr_policy_SearchKind.rst struct_gpr_policy_CandidatePoint.rst struct_gpr_policy_PolicyContext.rst struct_gpr_policy_SearchState.rst class_gpr_policy_DefaultTrainingPolicy.rst class_gpr_policy_DistanceDedupPolicy.rst class_gpr_policy_FreezeHyperparametersPolicy.rst class_gpr_policy_SizeCapPolicy.rst class_gpr_policy_TrainingPolicy.rst class_gpr_policy_VarianceThresholdPolicy.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block namespace policy { // enums enum :ref:`OracleRole`; enum :ref:`SearchKind`; // structs struct :ref:`CandidatePoint`; struct :ref:`PolicyContext`; struct :ref:`SearchState`; // classes class :ref:`DefaultTrainingPolicy`; class :ref:`DistanceDedupPolicy`; class :ref:`FreezeHyperparametersPolicy`; class :ref:`SizeCapPolicy`; class :ref:`TrainingPolicy`; class :ref:`VarianceThresholdPolicy`; // global functions void :target:`publishPolicyProgress`(:ref:`PolicyContext`* context, int iteration, int oracle_calls, int refits, int training_size); bool :ref:`consensusShouldCallOracle`(const :ref:`TrainingPolicy`& policy, const :ref:`SearchState`& state); std::vector :target:`consensusSelectTrainingPoints`(const :ref:`TrainingPolicy`& policy, const std::vector<:ref:`CandidatePoint`>& candidates, const std::vector& current_set); bool :target:`consensusShouldRetrainHyperparameters`(const :ref:`TrainingPolicy`& policy, const :ref:`SearchState`& state); bool :target:`consensusShouldRebuildFactor`(const :ref:`TrainingPolicy`& policy, const :ref:`SearchState`& state); std::vector :target:`consensusRetainTrainingRows`(const :ref:`TrainingPolicy`& policy, const std::vector& rows); bool :target:`admitsFirstCandidate`(const std::vector& indices); bool :target:`indexListIsIdentity`(const std::vector& indices, int n); std::vector :ref:`canonicalizeRetainedIndices`(const std::vector& keep, int n); double :target:`squaredDistance`(const Eigen::VectorXd& a, const Eigen::VectorXd& b); std::vector :ref:`farthestPointIndices`(const std::vector& rows, int max_size); } // namespace policy .. _details-namespacegpr_1_1policy: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Global Functions ---------------- .. index:: pair: function; consensusShouldCallOracle .. _doxid-namespacegpr_1_1policy_1ab231b335237fb48362dac83598cf724e: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool consensusShouldCallOracle(const :ref:`TrainingPolicy`& policy, const :ref:`SearchState`& state) Rank-consistent policy dispatch: rank 0 evaluates the policy hook and broadcasts the decision across MPI_COMM_WORLD when MPI is active with multiple ranks, keeping all ranks synchronized before collective GP/oracle operations. Single-rank and non-MPI builds invoke the policy directly. .. index:: pair: function; canonicalizeRetainedIndices .. _doxid-namespacegpr_1_1policy_1a431fd734ad32e562388cf9363382769f: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector canonicalizeRetainedIndices(const std::vector& keep, int n) Filter out-of-bounds indices and deterministically drop later duplicates, preserving the order of first appearance in ``keep``. .. index:: pair: function; farthestPointIndices .. _doxid-namespacegpr_1_1policy_1ad5ad5e585d8ac117e66d4fe070903ba5: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector farthestPointIndices(const std::vector& rows, int max_size) Keep at most ``max_size`` rows. Row 0 stays. Each later row is the one whose Euclidean distance to the nearest kept row is largest. Ties take the lowest index. The returned indices are sorted, so the kept rows stay in their original order.