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

Parsed metric expression that is compiled once and evaluated repeatedly. More...

#include <pineforge/hpo/objective.hpp>

Public Member Functions

 MetricExpression (std::string source)
 Parses and compiles source.
 
 ~MetricExpression ()
 
 MetricExpression (MetricExpression &&) noexcept
 
MetricExpressionoperator= (MetricExpression &&) noexcept
 
 MetricExpression (const MetricExpression &)=delete
 
MetricExpressionoperator= (const MetricExpression &)=delete
 
ExpressionEvaluation evaluate (const MetricMap &metrics, const EvaluationPolicy &policy={}) const noexcept
 Evaluates the compiled expression without throwing.
 
const std::string & source () const noexcept
 Returns the original expression text.
 
const std::vector< std::string > & identifiers () const noexcept
 Returns unique metric identifiers in first-appearance order.
 

Detailed Description

Parsed metric expression that is compiled once and evaluated repeatedly.

Supported syntax includes identifiers, finite numeric literals, +, -, *, /, unary signs, parentheses, min(a,b), max(a,b), abs(a), and comparisons. Comparisons yield 1.0 when true and 0.0 when false.

Definition at line 83 of file objective.hpp.

Constructor & Destructor Documentation

◆ MetricExpression() [1/3]

pineforge::hpo::MetricExpression::MetricExpression ( std::string  source)
explicit

Parses and compiles source.

Exceptions
ExpressionErrorwhen the source is empty or syntactically invalid.

◆ ~MetricExpression()

pineforge::hpo::MetricExpression::~MetricExpression ( )

◆ MetricExpression() [2/3]

pineforge::hpo::MetricExpression::MetricExpression ( MetricExpression &&  )
noexcept

◆ MetricExpression() [3/3]

pineforge::hpo::MetricExpression::MetricExpression ( const MetricExpression )
delete

Member Function Documentation

◆ evaluate()

ExpressionEvaluation pineforge::hpo::MetricExpression::evaluate ( const MetricMap metrics,
const EvaluationPolicy policy = {} 
) const
noexcept

Evaluates the compiled expression without throwing.

Missing metrics and arithmetic-policy failures are returned in the result envelope.

◆ identifiers()

const std::vector< std::string > & pineforge::hpo::MetricExpression::identifiers ( ) const
inlinenoexcept

Returns unique metric identifiers in first-appearance order.

Definition at line 103 of file objective.hpp.

◆ operator=() [1/2]

MetricExpression & pineforge::hpo::MetricExpression::operator= ( const MetricExpression )
delete

◆ operator=() [2/2]

MetricExpression & pineforge::hpo::MetricExpression::operator= ( MetricExpression &&  )
noexcept

◆ source()

const std::string & pineforge::hpo::MetricExpression::source ( ) const
inlinenoexcept

Returns the original expression text.

Definition at line 101 of file objective.hpp.


The documentation for this class was generated from the following file: