PineForge HPO 0.1.0
Native hyperparameter optimization for PineForge strategies
Loading...
Searching...
No Matches
pineforge::hpo Namespace Reference

Classes

struct  AccountEquityPoint
 One timestamped point on an account-level equity curve. More...
 
struct  Allocation
 Requested capital allocation to one strategy and market sleeve. More...
 
struct  BacktestConfiguration
 Immutable engine settings applied to every execution owned by a TrialExecutor. More...
 
class  BooleanDimension
 Named dimension whose legal values are exactly false and true. More...
 
struct  Candidate
 Complete parameter assignment proposed by a sampler. More...
 
class  CategoricalDimension
 Named dimension backed by an ordered, non-empty set of scalar choices. More...
 
struct  Constraint
 Named scalar feasibility constraint with an absolute non-negative tolerance. More...
 
class  Dataset
 Immutable in-memory OHLCV input shared by independent trial executions. More...
 
class  DlibGlobalSampler
 Adaptive derivative-free optimizer backed by dlib::global_function_search. More...
 
struct  EvaluationPolicy
 Policies controlling exceptional arithmetic during metric-expression evaluation. More...
 
class  ExpressionError
 Parse error raised while compiling a metric expression. More...
 
struct  ExpressionEvaluation
 Non-throwing result envelope returned by MetricExpression::evaluate(). More...
 
class  GridSampler
 Lazy exhaustive sampler over a finite SearchSpace in mixed-radix order. More...
 
class  IntegerDimension
 Named signed-integer dimension with inclusive bounds and a positive step. More...
 
class  MetricExpression
 Parsed metric expression that is compiled once and evaluated repeatedly. More...
 
struct  ObjectiveResult
 Objective values, constraints, and diagnostics produced for one observation. More...
 
struct  PortfolioObservation
 Account-level observation supplied to a custom portfolio objective. More...
 
class  RandomSampler
 Seeded independent sampler with replacement. More...
 
class  RealDimension
 Named binary64 dimension with inclusive bounds and an optional finite-grid step. More...
 
struct  ReportSnapshot
 Owning report snapshot detached from strategy and C-ABI report lifetimes. More...
 
class  Sampler
 Minimal pull-based interface shared by candidate samplers. More...
 
class  SearchSpace
 Ordered product of named dimensions with validation and finite-space codecs. More...
 
struct  SleeveSummary
 Compact start/end summary for one independently evaluated portfolio sleeve. More...
 
class  StrategyPlugin
 RAII wrapper around one compiled PineForge strategy plugin. More...
 
class  TpeSampler
 Independent, single-objective Tree-structured Parzen Estimator sampler. More...
 
struct  TpeSamplerConfig
 Tuning parameters for the native product-density TPE implementation. More...
 
struct  TrialContext
 Metadata supplied to a custom objective while evaluating one trial. More...
 
struct  TrialExecutionResult
 Result envelope returned by TrialExecutor::execute(). More...
 
class  TrialExecutor
 Deterministic one-shot adapter from serialized parameters to a detached report. More...
 
struct  ValidationIssue
 One candidate-validation failure tied to a parameter name. More...
 

Typedefs

using MetricMap = std::unordered_map< std::string, double >
 Metric values keyed by canonical objective path.
 
template<typename Observation >
using ObjectiveFn = std::function< ObjectiveResult(const Observation &, const TrialContext &)>
 Type-erased custom objective accepting an observation and immutable trial context.
 
using PortfolioObjectiveFn = ObjectiveFn< PortfolioObservation >
 Custom objective function specialized for PortfolioObservation.
 
using Dimension = std::variant< IntegerDimension, RealDimension, BooleanDimension, CategoricalDimension >
 Closed variant over every supported search-space dimension type.
 
using ParameterValues = std::map< std::string, std::string >
 Serialized Pine input or runtime-override values keyed by strategy parameter name.
 
using ParameterValue = std::variant< std::int64_t, double, bool, std::string >
 Scalar parameter value accepted by search spaces and the PineForge strategy ABI.
 

Enumerations

enum class  DivisionByZeroPolicy { Reject , Ieee754 }
 Behavior when an objective expression divides by zero. More...
 
enum class  NonFinitePolicy { Reject , Allow }
 Behavior when a metric or expression result is not finite. More...
 
enum class  EvaluationError {
  None , MissingMetric , NonFiniteMetric , DivisionByZero ,
  NonFiniteResult
}
 Stable reason code for an invalid ExpressionEvaluation. More...
 
enum class  ConstraintRelation { LessEqual , GreaterEqual , Equal }
 Comparison relation applied by Constraint. More...
 
enum class  ObjectiveDirection { Maximize , Minimize }
 Direction used to rank a scalar objective. More...
 
enum class  CandidatePolicy { SamplerDefault , WithoutReplacement , Exhaustive }
 Uniqueness and coverage contract applied to sampler proposals. More...
 
enum class  DimensionKind { Integer , Real , Boolean , Categorical }
 Concrete dimension category stored by Dimension. More...
 
enum class  TrialExecutionStatus : std::uint8_t { kSucceeded = 0 , kEngineError = 1 }
 Terminal status of one native strategy execution. More...
 
enum class  ParameterType { Integer , Real , Boolean , String }
 Runtime discriminator for a ParameterValue alternative. More...
 

Functions

const char * candidate_policy_name (CandidatePolicy policy) noexcept
 Returns the stable StudySpec spelling of policy.
 
DimensionKind dimension_kind (const Dimension &dimension) noexcept
 Returns the concrete category stored in dimension.
 
std::string_view dimension_name (const Dimension &dimension) noexcept
 Returns the name of the concrete dimension.
 
bool dimension_contains (const Dimension &dimension, const ParameterValue &value) noexcept
 Dispatches a type-aware membership test to the concrete dimension.
 
ParameterType parameter_type (const ParameterValue &value) noexcept
 Returns the discriminator of value.
 
const char * parameter_type_name (ParameterType type) noexcept
 Returns a stable lowercase name for type.
 
std::string serialize_parameter_value (const ParameterValue &value)
 Produces the exact text passed to strategy_set_input or strategy_set_override.
 

Typedef Documentation

◆ Dimension

Closed variant over every supported search-space dimension type.

Definition at line 135 of file search_space.hpp.

◆ MetricMap

using pineforge::hpo::MetricMap = typedef std::unordered_map<std::string, double>

Metric values keyed by canonical objective path.

Definition at line 16 of file objective.hpp.

◆ ObjectiveFn

template<typename Observation >
using pineforge::hpo::ObjectiveFn = typedef std::function<ObjectiveResult(const Observation&, const TrialContext&)>

Type-erased custom objective accepting an observation and immutable trial context.

Definition at line 160 of file objective.hpp.

◆ ParameterValue

using pineforge::hpo::ParameterValue = typedef std::variant<std::int64_t, double, bool, std::string>

Scalar parameter value accepted by search spaces and the PineForge strategy ABI.

Definition at line 11 of file types.hpp.

◆ ParameterValues

using pineforge::hpo::ParameterValues = typedef std::map<std::string, std::string>

Serialized Pine input or runtime-override values keyed by strategy parameter name.

Definition at line 20 of file trial_executor.hpp.

◆ PortfolioObjectiveFn

Custom objective function specialized for PortfolioObservation.

Definition at line 67 of file portfolio.hpp.

Enumeration Type Documentation

◆ CandidatePolicy

Uniqueness and coverage contract applied to sampler proposals.

Finite policies require a positive step on every varying real dimension. Candidates are reserved before ask() returns, so pending, completed, and abandoned points all remain seen.

Enumerator
SamplerDefault 

Preserve native sampler behavior, including possible duplicates.

WithoutReplacement 

Issue at most the requested number of unique finite candidates.

Exhaustive 

Require a budget equal to cardinality and cover every candidate.

Definition at line 83 of file sampler.hpp.

◆ ConstraintRelation

Comparison relation applied by Constraint.

Enumerator
LessEqual 

Require lhs <= rhs + tolerance.

GreaterEqual 

Require lhs >= rhs - tolerance.

Equal 

Require abs(lhs - rhs) <= tolerance.

Definition at line 112 of file objective.hpp.

◆ DimensionKind

enum class pineforge::hpo::DimensionKind
strong

Concrete dimension category stored by Dimension.

Enumerator
Integer 

Discrete signed-integer lattice.

Real 

Continuous or stepped binary64 interval.

Boolean 

The two values false and true.

Categorical 

Explicit ordered set of scalar choices.

Definition at line 16 of file search_space.hpp.

◆ DivisionByZeroPolicy

Behavior when an objective expression divides by zero.

Enumerator
Reject 

Return an invalid ExpressionEvaluation.

Ieee754 

Permit IEEE-754 infinity or NaN, subject to the result policy.

Definition at line 19 of file objective.hpp.

◆ EvaluationError

Stable reason code for an invalid ExpressionEvaluation.

Enumerator
None 

Evaluation succeeded.

MissingMetric 

A referenced identifier was absent from the metric map.

NonFiniteMetric 

A referenced metric violated the non-finite metric policy.

DivisionByZero 

Division by zero was rejected.

NonFiniteResult 

Evaluation failed or produced a disallowed non-finite result.

Definition at line 41 of file objective.hpp.

◆ NonFinitePolicy

Behavior when a metric or expression result is not finite.

Enumerator
Reject 

Reject the non-finite value.

Allow 

Preserve the non-finite value for the caller.

Definition at line 25 of file objective.hpp.

◆ ObjectiveDirection

Direction used to rank a scalar objective.

Enumerator
Maximize 

Larger finite values are better.

Minimize 

Smaller finite values are better.

Definition at line 74 of file sampler.hpp.

◆ ParameterType

enum class pineforge::hpo::ParameterType
strong

Runtime discriminator for a ParameterValue alternative.

Enumerator
Integer 

Signed 64-bit integer.

Real 

IEEE-754 binary64 real.

Boolean 

Boolean value.

String 

UTF-8 string value.

Definition at line 14 of file types.hpp.

◆ TrialExecutionStatus

enum class pineforge::hpo::TrialExecutionStatus : std::uint8_t
strong

Terminal status of one native strategy execution.

Enumerator
kSucceeded 

Backtest completed and a detached snapshot is available.

kEngineError 

Strategy reported an error; no comparable snapshot is available.

Definition at line 96 of file trial_executor.hpp.

Function Documentation

◆ candidate_policy_name()

const char * pineforge::hpo::candidate_policy_name ( CandidatePolicy  policy)
noexcept

Returns the stable StudySpec spelling of policy.

◆ dimension_contains()

bool pineforge::hpo::dimension_contains ( const Dimension dimension,
const ParameterValue value 
)
noexcept

Dispatches a type-aware membership test to the concrete dimension.

◆ dimension_kind()

DimensionKind pineforge::hpo::dimension_kind ( const Dimension dimension)
noexcept

Returns the concrete category stored in dimension.

◆ dimension_name()

std::string_view pineforge::hpo::dimension_name ( const Dimension dimension)
noexcept

Returns the name of the concrete dimension.

◆ parameter_type()

ParameterType pineforge::hpo::parameter_type ( const ParameterValue value)
noexcept

Returns the discriminator of value.

◆ parameter_type_name()

const char * pineforge::hpo::parameter_type_name ( ParameterType  type)
noexcept

Returns a stable lowercase name for type.

◆ serialize_parameter_value()

std::string pineforge::hpo::serialize_parameter_value ( const ParameterValue value)

Produces the exact text passed to strategy_set_input or strategy_set_override.

Real values use enough digits for a binary64 round trip. Non-finite real values are rejected because the engine input grammar has no portable representation for them.

Exceptions
std::invalid_argumentif value is a non-finite real.