C++ API

The C++ API documentation below is generated from the public headers with Doxygen and Breathe.

class AffineTransform : public FuncCraft::CoordinateTransform

Applies a seed-generated affine matrix around assigned_xopt.

The input, assigned_xopt, and internal target xopt all have the full transform dimension. This transform uses T(x) = target_xopt + matrix * (x - assigned_xopt), so assigned_xopt is the desired optimizer in generated/search coordinates.

Public Functions

AffineTransform(int dimension, std::vector<double> assigned_xopt, std::vector<double> target_xopt, std::uint64_t seed)
AffineTransform(int dimension, std::vector<double> assigned_xopt, std::vector<double> target_xopt, std::uint64_t seed, std::vector<std::vector<double>> matrix)
virtual void apply(const std::vector<double> &x, std::vector<double> &out) const override
virtual int input_dimension() const override
virtual int output_dimension() const override
virtual CoordinateTransformClass transform_class() const override
const std::vector<std::vector<double>> &matrix() const

Private Members

std::vector<std::vector<double>> matrix_
class BasicF
#include <basicf.h>

Canonical basic benchmark function.

A BasicF is a normalized primitive benchmark landscape. All built-in basic functions are exposed in primitive coordinates:

  • dimension is the requested problem dimension;

  • default_domain is the canonical plotting/evaluation box for the primitive;

  • x_opt stores the global optimum of the implemented primitive;

  • f_opt stores the primitive minimum value;

  • properties is a human-readable summary of the landscape.

For CEC-derived primitives, the implementation follows the unshifted CEC base formula, including any internal scale factor and any intrinsic optimum location implied by that formula.

BBOB-style “rotated” primitives are also exposed here. At this low level they are stored in canonical coordinates without any implicit random rotation; callers that want rotated variants should apply rotation explicitly, or use a higher-level wrapper such as MinionBenchmark with useRotation=true.

Public Functions

BasicF(BasicFunctionId id, int dimension)

Construct one primitive benchmark function.

std::vector<double> operator()(const std::vector<std::vector<double>> &X) const

Batch-evaluate the primitive at the supplied points.

double evaluate(const std::vector<double> &x) const

Evaluate the primitive at one input point.

double evaluate(const double *x) const

Evaluate the primitive at one already dimension-checked input point.

BasicFunctionId id() const

Return the primitive identifier.

Domain default_domain() const

Return the canonical domain recommended for plotting this primitive.

Public Members

std::string name
int dimension = 0
std::vector<double> x_opt
double f_opt = 0.0
std::string properties

Private Functions

void initialize_state()
double evaluate_impl(const double *x) const

Private Members

BasicFunctionId id_
std::vector<PeakData> peaks_
class BenchmarkFunction

Concrete benchmark function assembled from components and a composition rule.

Public Functions

explicit BenchmarkFunction(FunctionSpec spec)

Construct a benchmark function from a plain-data specification.

The constructor validates and materializes the runtime pieces from the supplied spec. The spec itself remains available through spec().

~BenchmarkFunction() = default
BenchmarkFunction(const BenchmarkFunction&) = default
BenchmarkFunction &operator=(const BenchmarkFunction&) = default
BenchmarkFunction(BenchmarkFunction&&) noexcept = default
BenchmarkFunction &operator=(BenchmarkFunction&&) noexcept = default
std::vector<double> operator()(const std::vector<std::vector<double>> &X) const

Evaluate a batch of input vectors.

const Domain &domain() const

Return the input domain of this benchmark function.

int dimension() const

Return the problem dimension.

double scale_factor() const

Return the runtime scale factor used to normalize composed values.

double get_fopt() const

Return the assigned optimum value applied after scaling.

const std::vector<double> &get_xopt() const

Return the assigned optimum location.

const std::string &component_types() const

Return a compact summary of immediate component source types.

Example: 2 basic, 2 level-1 nested.

const FunctionSpec &spec() const

Return the complete specification used to build this function.

The returned spec is the normalized source record, including the derived class label and any captured descriptive fields.

YAML::Node export_spec() const

Export the materialized function spec as a YAML node.

void export_spec(const std::string &path) const

Export the materialized function spec to a YAML file.

Private Members

FunctionSpec spec_
Domain domain_
double scale_factor_ = 1.0
double assigned_fopt_ = 0.0
std::string component_types_
ComposedFunction function_
class BenchmarkSuite
#include <suite.h>

Deterministic collection of generated benchmark functions.

Public Functions

BenchmarkSuite(SuiteSpec spec, int dimension)

Construct a benchmark suite from a declarative suite spec.

The constructor does not instantiate benchmark functions. It only normalizes the spec, validates the requested ambient dimension, and prepares the internal blueprints.

BenchmarkSuite(const std::string &spec_path, int dimension)

Construct a benchmark suite by loading its spec from a file.

int size() const

Return the number of generated functions.

int max_number_of_functions() const

Return the maximum number of lazily generatable functions.

This is the number of blueprints prepared by the constructor, so it is the upper bound on valid function indices for this suite.

std::uint64_t theoretical_max_number_of_functions() const

Return the theoretical upper bound implied by the suite spec.

This is a combinatorial bound computed from the available base functions, transform families, and composition families.

int dimension() const

Return the fixed ambient dimension of this suite.

const BenchmarkFunction &function(int index) const

Build one generated function lazily for the suite dimension.

std::vector<double> operator()(int index, const std::vector<std::vector<double>> &X) const

Batch-evaluate one generated function at multiple points.

const SuiteSpec &spec() const

Return the normalized suite specification used to build this suite.

YAML::Node export_manifest() const

Export the suite spec and every generated function spec as a YAML node.

void export_manifest(const std::string &path) const

Export the suite manifest to a YAML file.

YAML::Node export_spec() const

Alias for export_manifest().

void export_spec(const std::string &path) const

Alias for export_manifest(path).

Private Functions

BenchmarkFunction build_function(const FunctionBlueprint &blueprint) const
bool supports_dimension(int dimension) const

Private Members

SuiteSpec spec_
int dimension_ = 0
std::uint64_t theoretical_max_number_of_functions_ = 0
std::vector<FunctionBlueprint> blueprints_
std::vector<int> supported_dimensions_
mutable std::vector<std::optional<BenchmarkFunction>> function_cache_
class BlockRotationTransform : public FuncCraft::CoordinateTransform

Selects coordinates from the full vector and rotates only that block.

selected_indices uses 0-based indices into the full input vector. The transform maps a full D-dimensional input into an m-dimensional selected subspace, where m = selected_indices.size(). assigned_xopt, target_xopt, and matrix are all subspace-sized.

Public Functions

BlockRotationTransform(int dimension, std::vector<int> selected_indices, std::vector<double> assigned_xopt, std::vector<double> target_xopt, std::uint64_t seed)
BlockRotationTransform(int dimension, std::vector<int> selected_indices, std::vector<double> assigned_xopt, std::vector<double> target_xopt, std::uint64_t seed, std::vector<std::vector<double>> matrix)
virtual void apply(const std::vector<double> &x, std::vector<double> &out) const override
virtual int input_dimension() const override
virtual int output_dimension() const override
virtual CoordinateTransformClass transform_class() const override
const std::vector<int> &selected_indices() const
const std::vector<std::vector<double>> &matrix() const

Private Members

std::vector<int> selected_indices_
std::vector<std::vector<double>> matrix_
class CommonPointComposition : public FuncCraft::CompositionFunction
#include <composition.h>

Base for compositions that only depend on the component values.

Subclassed by FuncCraft::LevelWellComposition, FuncCraft::NoneComposition, FuncCraft::PowerMeanComposition, FuncCraft::WeightedSumComposition

Protected Functions

virtual double raw_apply(const std::vector<double> &x, const std::vector<double> &z) const final
virtual double common_raw_apply(const std::vector<double> &z) const = 0
struct ComponentSpec
#include <function_spec.h>

User-facing component request.

A component uses composed_function when it is set; otherwise it uses base_function as a primitive component. The component input dimension is inferred from the coordinate transform output dimension.

Public Members

std::optional<BasicFunctionId> base_function
std::shared_ptr<FunctionSpec> composed_function
CoordinateTransformSpec coordinate_transform
ValueTransformSpec value_transform
std::uint64_t seed = 0
class CompositionFunction
#include <composition.h>

Subclassed by FuncCraft::CommonPointComposition, FuncCraft::DeceptivePointComposition

Public Functions

virtual ~CompositionFunction() = default
double apply(const std::vector<double> &x, const std::vector<double> &z) const

Combine transformed component values into one scalar output.

virtual CompositionClass composition_class() const = 0

Return the composition family used by this strategy.

Protected Functions

virtual double raw_apply(const std::vector<double> &x, const std::vector<double> &z) const = 0
struct CompositionSpec
#include <function_spec.h>

User-facing composition request.

Supported families:

  • None: no composition for exactly one component.

  • CpmWeightedSum: common-point weighted-sum composition.

  • CpmPowerMean: common-point weighted power mean.

  • CpmLevelWell: common-point level-well composition.

  • DpmSoftmax: deceptive-point softmax composition.

  • DpmBgSoftmax: deceptive-point softmax with a smooth background term.

weights are intentionally not part of this public spec. Weight policy is owned by the composition implementation. If user-configurable weights become necessary, add an explicit high-level weight policy instead of exposing the runtime vector directly.

Parameter conventions:

  • CpmPowerMean: parameters[0] = p.

  • CpmLevelWell: parameters[0] = epsilon, parameters[1] = alpha.

  • DpmSoftmax: parameters[0] = sharpness.

  • DpmBgSoftmax: parameters[0] = sharpness, parameters[1] = background_strength, parameters[2] = background_sharpness.

biases are used only by DPM families for local-minimum traps. Empty means all DPM trap biases are zero. Non-DPM families do not accept biases.

DPM families use centers as full-dimensional softmax centers. Empty means the builder should resolve centers internally. This is separate from block-rotation component assigned_xopt, which may be subspace-dimensional.

Public Members

CompositionKind kind = CompositionKind::None
std::vector<double> parameters
std::vector<double> biases
std::vector<std::vector<double>> centers
class CoordinateTransform

Subclassed by FuncCraft::AffineTransform, FuncCraft::BlockRotationTransform, FuncCraft::IdentityTransform, FuncCraft::RotationTransform

Public Functions

virtual ~CoordinateTransform() = default
virtual void apply(const std::vector<double> &x, std::vector<double> &out) const = 0
virtual int input_dimension() const = 0
virtual int output_dimension() const = 0
virtual CoordinateTransformClass transform_class() const = 0
std::uint64_t seed() const
const std::vector<double> &assigned_xopt() const
const std::vector<double> &target_xopt() const

Protected Functions

CoordinateTransform(int input_dimension, int output_dimension, std::vector<double> assigned_xopt, std::vector<double> target_xopt, std::uint64_t seed)

Protected Attributes

int input_dimension_ = 0
int output_dimension_ = 0
std::vector<double> assigned_xopt_
std::vector<double> target_xopt_
std::uint64_t seed_ = 0
struct CoordinateTransformSpec
#include <function_spec.h>

Coordinate-transform request/materialization for one component.

input_dimension is the parent/search dimension. output_dimension is the dimension seen by the component function after the transform. assigned_xopt is output-dimensional: for full transforms this is the full generated/search coordinate, while for block rotation it is the selected subspace coordinate. The corresponding transform target is computed internally from the selected base function and benchmark domain.

selected_indices is only meaningful for block rotation. If it is empty, suite generation may choose the subspace. matrix is empty until the concrete linear transform is generated or loaded.

Public Members

CoordinateTransformKind kind = CoordinateTransformKind::None
int input_dimension = 0
int output_dimension = 0
std::vector<double> assigned_xopt
std::vector<int> selected_indices
std::vector<double> parameters
std::vector<std::vector<double>> matrix
std::uint64_t seed = 0
class CosineZeroValueTransform : public FuncCraft::ValueTransform
#include <value_transforms.h>

Cosine-based transform that forces the value near zero at the origin.

This transform is origin-preserving for the supported parameter ranges.

Public Functions

explicit CosineZeroValueTransform(double alpha = 1.0)
virtual ValueTransformClass transform_class() const override

Return the transform family used by this object.

double alpha() const

Protected Functions

virtual double raw_apply(double u) const override

Private Members

double alpha_ = 1.0
class DeceptiveBgSoftmaxComposition : public FuncCraft::DeceptivePointComposition
#include <composition.h>

Background-aware softmax deceptive composition.

This variant keeps the same selective softmax core as DeceptiveSoftmaxComposition, but adds a smooth background weight that can blend components when the point is far from all designated centers.

Public Functions

DeceptiveBgSoftmaxComposition(std::vector<std::vector<double>> centers, double sharpness = 0.01, double background_strength = 1.0, double background_sharpness = 0.01, std::vector<double> biases = {})
virtual CompositionClass composition_class() const override

Return the composition family used by this strategy.

Private Functions

virtual double deceptive_raw_apply(const std::vector<double> &x, const std::vector<double> &z) const override

Private Members

std::vector<std::vector<double>> centers_
std::vector<double> biases_
double sharpness_ = 0.01
double background_strength_ = 1.0
double background_sharpness_ = 0.01
class DeceptivePointComposition : public FuncCraft::CompositionFunction
#include <composition.h>

Base for compositions that may depend on both the point and values.

Subclassed by FuncCraft::DeceptiveBgSoftmaxComposition, FuncCraft::DeceptiveSoftmaxComposition

Protected Functions

virtual double raw_apply(const std::vector<double> &x, const std::vector<double> &z) const final
virtual double deceptive_raw_apply(const std::vector<double> &x, const std::vector<double> &z) const = 0
class DeceptiveSoftmaxComposition : public FuncCraft::DeceptivePointComposition
#include <composition.h>

Softmax-based deceptive composition.

The output is computed by a smooth selective softmax blend based on distances to the component centers.

Public Functions

DeceptiveSoftmaxComposition(std::vector<std::vector<double>> centers, double sharpness = 0.01, std::vector<double> biases = {})
virtual CompositionClass composition_class() const override

Return the composition family used by this strategy.

Private Functions

virtual double deceptive_raw_apply(const std::vector<double> &x, const std::vector<double> &z) const override

Private Members

std::vector<std::vector<double>> centers_
std::vector<double> biases_
double sharpness_ = 0.01
struct Domain
#include <core.h>

Axis-aligned rectangular domain for benchmark inputs.

Public Functions

explicit Domain(int dimension = 0, double lower_bound = -100.0, double upper_bound = 100.0)
int dimension() const
bool contains(const std::vector<double> &x) const

Public Members

std::vector<double> lower
std::vector<double> upper
struct DomainSpec
#include <function_spec.h>

Axis-aligned search domain requested by the user.

Public Members

int dimension = 0
std::vector<double> lower_bound
std::vector<double> upper_bound
struct FunctionBlueprint

Public Members

bool composed = false
BasicFunctionId base_function = BasicFunctionId::Sphere
CoordinateTransformChoice coordinate_transform_choice
std::uint64_t seed = 0
class FunctionBuilder
#include <builder.h>

Low-level builder that stores runtime components.

Use this class when you want to assemble a callable from already materialized primitive objects. Public specs are owned by higher-level code.

Public Functions

explicit FunctionBuilder(int dimension)
FunctionBuilder &domain(Domain domain)

Set the benchmark domain.

FunctionBuilder &add_component(BasicFunctionId id, std::shared_ptr<CoordinateTransform> coordinate_transform, std::shared_ptr<ValueTransform> value_transform)

Add one primitive component to the composed function.

FunctionBuilder &add_component(ComponentEvaluator evaluator, Domain child_domain, std::vector<double> child_xopt, double child_fopt, std::shared_ptr<CoordinateTransform> coordinate_transform, std::shared_ptr<ValueTransform> value_transform)

Add one already-materialized function component.

FunctionBuilder &composition(std::shared_ptr<CompositionFunction> composition)

Set the composition rule for all accumulated components.

ComposedFunction build() const

Materialize the final composed runtime callable.

Private Members

Domain domain_
std::shared_ptr<CompositionFunction> composition_
std::vector<RuntimeComponent> runtime_components_
struct FunctionClass
#include <core.h>

Classification summary for a composed benchmark function.

Public Members

CompositionClass composition = CompositionClass::None
ValueTransformClass value_transform = ValueTransformClass::None
CoordinateTransformClass coordinate_transform = CoordinateTransformClass::None
std::vector<BasicFunctionId> base_functions
struct FunctionSpec
#include <function_spec.h>

Public high-level specification for one benchmark function.

This is the object a user should write by hand, construct from Python, or provide in a concise YAML file. User-authored specs may omit materialized details such as generated matrices, DPM centers, and scale factors; exported materialized specs include them.

assigned_xopt and assigned_fopt control the constructed optimum location and value. scale_factor = std::nullopt means the builder should determine a scale factor internally.

Public Members

int dimension = 0
DomainSpec domain
std::vector<ComponentSpec> components
CompositionSpec composition
std::vector<double> assigned_xopt
double assigned_fopt = 0.0
std::optional<double> scale_factor = std::nullopt
std::uint64_t seed = 0
std::string label
std::vector<std::string> metadata
class IdentityTransform : public FuncCraft::CoordinateTransform

No-op transform with the standard assigned/base xopt/seed signature.

Public Functions

IdentityTransform(int dimension, std::vector<double> assigned_xopt, std::vector<double> target_xopt, std::uint64_t seed)
virtual void apply(const std::vector<double> &x, std::vector<double> &out) const override
virtual int input_dimension() const override
virtual int output_dimension() const override
virtual CoordinateTransformClass transform_class() const override
class IdentityValueTransform : public FuncCraft::ValueTransform
#include <value_transforms.h>

Identity value transform that returns the input unchanged.

This is valid because f(0) == 0.

Public Functions

virtual ValueTransformClass transform_class() const override

Return the transform family used by this object.

Protected Functions

virtual double raw_apply(double u) const override
class LevelWellComposition : public FuncCraft::CommonPointComposition
#include <composition.h>

Level-well composition with sinusoidal shaping.

Public Functions

LevelWellComposition(std::vector<double> weights, double epsilon, double alpha)
LevelWellComposition(std::size_t components, double epsilon = 0.1, double alpha = 1.0)
virtual CompositionClass composition_class() const override

Return the composition family used by this strategy.

Private Functions

virtual double common_raw_apply(const std::vector<double> &z) const override

Private Members

std::vector<double> weights_
double epsilon_ = 0.1
double alpha_ = 1.0
class NoneComposition : public FuncCraft::CommonPointComposition
#include <composition.h>

Trivial composition that forwards the single component value.

Public Functions

virtual CompositionClass composition_class() const override

Return the composition family used by this strategy.

Protected Functions

virtual double common_raw_apply(const std::vector<double> &z) const override
class OscillatoryValueTransform : public FuncCraft::ValueTransform
#include <value_transforms.h>

Oscillatory scalar transform used to create rugged landscapes.

This transform is origin-preserving for the supported parameter ranges.

Public Functions

OscillatoryValueTransform(double epsilon = 0.1, double alpha = 1.0)
virtual ValueTransformClass transform_class() const override

Return the transform family used by this object.

double epsilon() const
double alpha() const

Protected Functions

virtual double raw_apply(double u) const override

Private Members

double epsilon_ = 0.1
double alpha_ = 1.0
struct PeakData

Public Members

std::vector<double> center
double weight = 1.0
class PowerMeanComposition : public FuncCraft::CommonPointComposition
#include <composition.h>

Power-mean composition across multiple components.

Public Functions

PowerMeanComposition(std::vector<double> weights, double p)
PowerMeanComposition(std::size_t components, double p = 2.0)
virtual CompositionClass composition_class() const override

Return the composition family used by this strategy.

Private Functions

virtual double common_raw_apply(const std::vector<double> &z) const override

Private Members

std::vector<double> weights_
double p_ = 1.0
class PowerValueTransform : public FuncCraft::ValueTransform
#include <value_transforms.h>

Power-law scalar transform.

This transform is origin-preserving for the supported parameter ranges.

Public Functions

PowerValueTransform(double alpha = 1.0, double p = 1.0)
virtual ValueTransformClass transform_class() const override

Return the transform family used by this object.

double alpha() const
double p() const

Protected Functions

virtual double raw_apply(double u) const override

Private Members

double alpha_ = 1.0
double p_ = 1.0
class RotationTransform : public FuncCraft::CoordinateTransform

Applies a seed-generated rotation matrix around assigned_xopt.

The input, assigned_xopt, and internal target xopt all have the full transform dimension. This transform uses T(x) = target_xopt + matrix * (x - assigned_xopt), so assigned_xopt is the desired optimizer in generated/search coordinates.

Public Functions

RotationTransform(int dimension, std::vector<double> assigned_xopt, std::vector<double> target_xopt, std::uint64_t seed)
RotationTransform(int dimension, std::vector<double> assigned_xopt, std::vector<double> target_xopt, std::uint64_t seed, std::vector<std::vector<double>> matrix)
virtual void apply(const std::vector<double> &x, std::vector<double> &out) const override
virtual int input_dimension() const override
virtual int output_dimension() const override
virtual CoordinateTransformClass transform_class() const override
const std::vector<std::vector<double>> &matrix() const

Private Members

std::vector<std::vector<double>> matrix_
struct RuntimeComponent

Public Members

ComponentEvaluator evaluate
std::shared_ptr<CoordinateTransform> coordinate_transform
std::shared_ptr<ValueTransform> value_transform
Domain domain
Domain child_domain
std::vector<double> target_xopt
std::vector<double> child_xopt
double child_fopt = 0.0
class SuiteCollection
#include <suite_collection.h>

Accessor for a built-in, versioned benchmark-suite collection.

Use this when you want a stable public benchmark family such as FuncCraft-2026-v1 without loading a YAML file path manually.

Public Functions

SuiteCollection(int year, int version)
int year() const
int version() const
const std::string &name() const
int number_of_functions() const
SuiteSpec spec() const
BenchmarkSuite benchmark_suite(int dimension) const

Private Members

int year_ = 0
int version_ = 0
std::string name_
struct SuiteCollectionId
#include <suite_collection.h>

Lightweight identifier for a built-in suite collection.

Public Members

int year = 0
int version = 0
std::string name
struct SuiteSpec
#include <suite_spec.h>

Top-level generation recipe for a benchmark suite.

This is deliberately higher level than FunctionSpec: it describes pools and probabilities. Generated functions are exported as fully materialized FunctionSpec objects.

Public Members

std::string supported_dimensions = "any"
std::vector<BasicFunctionId> base_functions = all_suite_base_functions()
std::vector<BasicFunctionId> composition_base_functions = all_suite_base_functions()
std::vector<CoordinateTransformChoice> coordinate_transforms = all_coordinate_transform_choices()
std::vector<ValueTransformChoice> value_transforms = all_value_transform_choices()
std::vector<CompositionChoice> compositions = all_composition_choices()
int min_components = 2
int max_components = 4
int max_nested_composition_depth = 0
double nested_probability = 0.0
int requested_number_of_functions = 0
int max_number_of_functions = 0
std::uint64_t master_seed = 1
double lower_bound = -100.0
double upper_bound = 100.0
double assigned_fopt = 100.0
double xopt_domain_shrink_factor = 0.8
std::string suite_label
class ValueTransform
#include <value_transforms.h>

Subclassed by FuncCraft::CosineZeroValueTransform, FuncCraft::IdentityValueTransform, FuncCraft::OscillatoryValueTransform, FuncCraft::PowerValueTransform

Public Functions

virtual ~ValueTransform() = default
double apply(double u) const

Transform one scalar function value.

The base class rejects materially negative inputs and materially negative transformed outputs. Concrete transforms are parameterized so that raw_apply(0.0) == 0.0.

virtual ValueTransformClass transform_class() const = 0

Return the transform family used by this object.

Protected Functions

virtual double raw_apply(double u) const = 0
struct ValueTransformSpec
#include <function_spec.h>

User-facing value-transform request for one component.

Parameter conventions:

  • Power: parameters[0] = alpha, parameters[1] = p.

  • Oscillatory: parameters[0] = epsilon, parameters[1] = alpha.

  • CosineZero: parameters[0] = alpha.

Public Members

ValueTransformKind kind = ValueTransformKind::None
std::vector<double> parameters
template<typename Kind>
struct WeightedChoice
#include <suite_spec.h>

Weighted suite-generation choice.

Probabilities are fractions and each choice table must sum to one.

Public Members

Kind kind
double probability = 1.0
std::vector<double> parameters
class WeightedSumComposition : public FuncCraft::CommonPointComposition
#include <composition.h>

Weighted sum composition across multiple components.

Public Functions

explicit WeightedSumComposition(std::vector<double> weights)
explicit WeightedSumComposition(std::size_t components)
virtual CompositionClass composition_class() const override

Return the composition family used by this strategy.

Private Functions

virtual double common_raw_apply(const std::vector<double> &z) const override

Private Members

std::vector<double> weights_
namespace FuncCraft

Typedefs

using ComposedFunction = std::function<std::vector<double>(const std::vector<std::vector<double>> &X)>

Runtime callable for a composed benchmark function.

The callable consumes a batch of input vectors and returns one scalar value per input vector. It intentionally carries no metadata or helper methods.

using ComponentEvaluator = std::function<std::vector<double>(const std::vector<std::vector<double>> &X)>
using CoordinateTransformChoice = WeightedChoice<CoordinateTransformKind>
using ValueTransformChoice = WeightedChoice<ValueTransformKind>
using CompositionChoice = WeightedChoice<CompositionKind>

Enums

enum class BasicFunctionId

Values:

enumerator Sphere

Sphere function.

enumerator Ellipsoidal

Ellipsoidal function.

enumerator SumDifferentPowers

Sum of different powers.

enumerator BuecheRastrigin

Bueche-Rastrigin function.

enumerator LinearSlope

Linear slope function.

enumerator AttractiveSector

Attractive sector function.

enumerator StepEllipsoidal

Step ellipsoidal function.

enumerator StepRastrigin

Step Rastrigin function.

enumerator Rosenbrock

Rosenbrock function.

enumerator Ackley

Ackley function.

enumerator Rastrigin

Rastrigin function.

enumerator Griewank

Griewank function.

enumerator Schwefel

Schwefel function.

enumerator SharpRidge

Sharp ridge function.

enumerator Weierstrass

Weierstrass function.

enumerator SchafferF7

Schaffer F7 function.

enumerator SchafferF7Cond1000

Schaffer F7 conditioned on 1000.

enumerator GriewankRosenbrock

Griewank-Rosenbrock function.

enumerator Gallagher21

Gallagher 21 peaks function.

enumerator Katsuura

Katsuura function.

enumerator LunacekBiRastrigin

Lunacek bi-Rastrigin function.

enumerator Zakharov

Zakharov function.

enumerator Levy

Levy function.

enumerator Michalewicz

Michalewicz function.

enumerator DixonPrice

Dixon-Price function.

enumerator BentCigar

Bent cigar function.

enumerator HappyCat

HappyCat function.

enumerator HGBat

HGBat function.

enumerator HCF

HCF function.

enumerator SchafferF6

Schaffer F6 function.

enumerator Step

Step function.

enumerator Quartic

Quartic function.

enumerator Exponential

Exponential function.

enumerator StyblinskiTang

Styblinski-Tang function.

enum class CompositionClass

Values:

enumerator None

No composition, a single transformed component.

enumerator CommonPointWeightedSum

Weighted sum of components evaluated at a common point.

enumerator CommonPointPowerMean

Power mean aggregation of components evaluated at a common point.

enumerator CommonPointLevelWell

Level-well aggregation of components evaluated at a common point.

enumerator DeceptivePointSoftmax

Deceptive softmax selection over multiple component centers.

enumerator DeceptivePointBgSoftmax

Deceptive softmax with a smooth background weight.

enum class ValueTransformClass

Values:

enumerator None

No value transform.

enumerator CosineZero

Cosine-based zeroing transform.

enumerator Oscillatory

Oscillatory transform.

enumerator Power

Power-law transform.

enumerator Mixed

Mixed value transforms across components.

enum class CoordinateTransformClass

Values:

enumerator None

No coordinate transform.

enumerator Rotation

Rotation transform.

enumerator Affine

Affine transform.

enumerator BlockRotation

Block rotation transform on a selected subspace.

enumerator Mixed

Mixed coordinate transforms across components.

enum class CoordinateTransformKind

High-level coordinate-transform family.

Values:

enumerator None
enumerator Rotation
enumerator Affine
enumerator BlockRotation
enum class ValueTransformKind

High-level value-transform family.

Values:

enumerator None
enumerator Power
enumerator Oscillatory
enumerator CosineZero
enum class CompositionMode

High-level composition mode.

None is used for the one-component case. CPM and DPM are the two multi-component composition modes.

Values:

enumerator None
enumerator CPM
enumerator DPM
enum class CompositionKind

Concrete composition family.

There is no “single component” family. A function with one component uses no composition.

Values:

enumerator None
enumerator CpmWeightedSum
enumerator CpmPowerMean
enumerator CpmLevelWell
enumerator DpmSoftmax
enumerator DpmBgSoftmax

Functions

std::string to_string(BasicFunctionId id)

Convert a basic-function identifier to a human-readable name.

bool is_multimodal(BasicFunctionId id)

Return true if the primitive is multimodal.

bool is_unimodal(BasicFunctionId id)

Return true if the primitive is unimodal.

std::vector<BasicFunctionId> list_basic_functions()

Return the ordered list of supported base functions.

std::vector<BasicFunctionId> unimodalF_list()

Return the subset of supported unimodal base functions.

std::vector<BasicFunctionId> multimodalF_list()

Return the subset of supported multimodal base functions.

std::shared_ptr<BasicF> make_basicf_ptr(BasicFunctionId id, int dimension)

Create a heap-allocated primitive benchmark function.

FunctionSpec load_function_spec(const std::string &path)

Load a benchmark-function specification from a file.

BenchmarkFunction make_benchmark_function(const std::string &path)

Build a benchmark function directly from a specification file.

BasicFunctionId parse_basic_function_id(const std::string &name)

Parse a basic-function name into a runtime identifier.

std::shared_ptr<BasicF> make_basic_function(const std::string &name, int dimension)

Create a runtime basic function from a plain name and dimension.

The returned object owns the selected primitive function instance.

std::shared_ptr<CompositionFunction> make_weighted_sum(std::size_t components)

Create a weighted-sum composition with uniform weights.

std::string to_string(CompositionClass cls)

Render a composition class as a short label.

std::string to_string(ValueTransformClass cls)

Render a value transform class as a short label.

std::string to_string(CoordinateTransformClass cls)

Render a coordinate transform class as a short label.

std::string class_label(const FunctionClass &cls)

Build a compact label describing a complete function class.

BenchmarkSuite make_benchmark_suite(SuiteSpec spec, int dimension)

Build a suite directly from a declarative suite spec.

SuiteSpec load_suite_spec(const std::string &path)

Load a suite specification from a file.

BenchmarkSuite make_benchmark_suite(const std::string &path, int dimension)

Build a suite directly from a specification file and an ambient dimension.

std::vector<SuiteCollectionId> list_suite_collections()
SuiteCollection suite_collection(int year, int version)
SuiteSpec suite_collection_spec(int year, int version)
int suite_collection_number_of_functions(int year, int version)
BenchmarkSuite suite_collection_benchmark_suite(int year, int version, int dimension)
template<typename Kind>
inline WeightedChoice<Kind> make_choice(Kind kind, double probability = 1.0, std::vector<double> parameters = {})
template<typename Kind>
inline WeightedChoice<Kind> make_choice(Kind kind, double probability, double parameter)
template<typename Kind>
inline WeightedChoice<Kind> make_choice(Kind kind, double probability, double parameter0, double parameter1)
template<typename Kind>
inline WeightedChoice<Kind> make_choice(Kind kind, double probability, double parameter0, double parameter1, double parameter2)
inline std::vector<BasicFunctionId> all_suite_base_functions()
inline std::vector<CoordinateTransformChoice> all_coordinate_transform_choices()
inline std::vector<ValueTransformChoice> all_value_transform_choices()
inline std::vector<CompositionChoice> all_composition_choices()
namespace FuncCraft
namespace FuncCraft
namespace FuncCraft
namespace FuncCraft
namespace FuncCraft
namespace FuncCraft
namespace FuncCraft
namespace FuncCraft
namespace detail

Functions

void require(bool condition, const std::string &message)

Throw if the condition is false.

void require_dimension(const std::vector<double> &x, int dimension, const std::string &name)

Validate that a point has the expected dimension.

void map_point_between_domains(const std::vector<double> &point, const Domain &source_domain, const Domain &target_domain, std::vector<double> &out)

Map one point from one axis-aligned domain into another.

std::vector<double> map_point_between_domains(const std::vector<double> &point, const Domain &source_domain, const Domain &target_domain)

Map one point from one axis-aligned domain into another.

double squared_distance(const std::vector<double> &a, const std::vector<double> &b)

Compute squared Euclidean distance.

double weighted_sum(const std::vector<double> &weights, const std::vector<double> &z)

Compute a weighted sum of values.

std::string join_base_ids(const std::vector<BasicFunctionId> &ids)

Join base-function identifiers into a compact metadata string.

std::uint64_t mix_seed(std::uint64_t x)

Mix one 64-bit seed into a new deterministic seed.

std::uint64_t indexed_seed(std::uint64_t seed, std::uint64_t role, std::uint64_t index0, std::uint64_t index1)

Generate a deterministic child seed from a base seed, role, and two indices.

double uniform01(std::mt19937_64 &rng)

Draw one uniform random number from [0, 1).

double stable_numeric_value(double value)

Quantize a computed floating-point value for cross-platform robustness.

std::string normalize_spec_name(const std::string &value)

Normalize spec identifiers for matching.

The normalization rule is intentionally simple: lower case and remove underscores, hyphens, and whitespace.

CoordinateTransformKind parse_coordinate_transform_kind(const std::string &kind)
ValueTransformKind parse_value_transform_kind(const std::string &kind)
CompositionKind parse_composition_kind(const std::string &kind)
CompositionMode composition_mode(CompositionKind kind)
std::string to_spec_name(CoordinateTransformKind kind)
std::string to_spec_name(ValueTransformKind kind)
std::string to_spec_name(CompositionKind kind)
std::string canonical_coordinate_transform_kind(const std::string &kind)

Return the canonical coordinate-transform spec kind.

std::string canonical_value_transform_kind(const std::string &kind)

Return the canonical value-transform spec kind.

std::string canonical_composition_kind(const std::string &kind)

Return the canonical composition spec kind.

int uniform_int(std::mt19937_64 &rng, int lo, int hi)

Draw one integer uniformly from [lo, hi].

double normal01(std::mt19937_64 &rng)

Draw one standard normal random variate.

Domain centered_scaled_domain(const Domain &domain, double factor)

Return a centered copy of a domain scaled by factor.

std::vector<std::vector<double>> prefix_stable_latin_hypercube_points_in_domain(std::uint64_t seed, std::uint64_t role, const Domain &domain, int count)

Generate Latin-hypercube points whose coordinate prefixes are stable across dimensions.

std::vector<std::vector<double>> prefix_stable_latin_hypercube_centers(std::uint64_t seed, std::uint64_t role, const Domain &domain, int count, double shrink_factor)

Generate centered Latin-hypercube points whose coordinate prefixes are stable across dimensions.

std::vector<double> complete_prefix_stable_point(std::uint64_t seed, std::uint64_t role, const std::vector<double> &prefix, const Domain &domain, double shrink_factor)

Complete a user-supplied coordinate prefix to the domain dimension deterministically.

std::vector<std::vector<double>> random_rotation_matrix(std::mt19937_64 &rng, int dimension)

Generate a random orthogonal rotation matrix.

std::vector<std::vector<double>> random_affine_matrix(std::mt19937_64 &rng, int dimension)

Generate a random affine transform matrix.

std::vector<double> yaml_double_vector(const YAML::Node &node, const std::string &field)
std::vector<int> yaml_int_vector(const YAML::Node &node, const std::string &field)
std::vector<std::string> yaml_string_vector(const YAML::Node &node, const std::string &field)
std::vector<std::vector<double>> yaml_double_matrix(const YAML::Node &node, const std::string &field)
BasicFunctionId yaml_basic_function_id(const YAML::Node &node)
CoordinateTransformSpec coordinate_transform_spec_from_yaml(const YAML::Node &node)
ValueTransformSpec value_transform_spec_from_yaml(const YAML::Node &node)
CompositionSpec composition_spec_from_yaml(const YAML::Node &node)
ComponentSpec component_spec_from_yaml(const YAML::Node &node)
YAML::Node function_spec_to_yaml(const FunctionSpec &spec)

Convert a generated function spec to a YAML node.

FunctionSpec function_spec_from_yaml(const YAML::Node &node)

Load a function spec from a YAML node.

YAML::Node suite_spec_to_yaml(const SuiteSpec &spec)

Convert a suite spec to a YAML node.

void write_yaml_file(const std::string &path, const YAML::Node &node)

Write a YAML node to disk.

template<typename T>
void stable_shuffle(std::vector<T> &values, std::mt19937_64 &rng)

Variables

constexpr double kTwoPi = 6.2831853071795864769252867665590057683943387987502
constexpr std::uint64_t kAssignedXoptSeedRole = 0xA5516EED0D7ULL
constexpr std::uint64_t kDpmCenterSeedRole = 0xD9CE17E25ULL
namespace detail
namespace spec_name

Canonical public names used when serializing specs.

Parsers should be permissive by lowercasing and removing spaces, hyphens, and underscores before matching. Exporters should write these canonical names.

Variables

constexpr const char *None = "none"
constexpr const char *CoordinateRotation = "rotation"
constexpr const char *CoordinateAffine = "affine"
constexpr const char *CoordinateBlockRotation = "block-rotation"
constexpr const char *ValuePower = "power"
constexpr const char *ValueOscillatory = "oscillatory"
constexpr const char *ValueCosineZero = "cosine-zero"
constexpr const char *CpmWeightedSum = "cpm-wsum"
constexpr const char *CpmPowerMean = "cpm-power-mean"
constexpr const char *CpmLevelWell = "cpm-level-well"
constexpr const char *DpmSoftmax = "dpm-softmax"
constexpr const char *DpmBgSoftmax = "dpm-bgsoftmax"
namespace std

STL namespace.

file basicf.h
#include <cstddef>
#include <memory>
#include <string>
#include <utility>
#include <vector>

Primitive benchmark functions and their identifiers.

This header defines the canonical base benchmark landscapes used by the higher-level composition layer.

file benchmark_function.h
#include “builder.h
#include “function_spec.h
#include “core.h
#include <string>
#include <yaml-cpp/yaml.h>

High-level wrapper around a built benchmark function.

This class owns a plain-data FunctionSpec together with the derived runtime callable and domain. It is the user-facing object you should pass around after construction. The stored spec is the normalized, serializable record that can be written back to disk.

file builder.h
#include “basicf.h
#include “composition.h
#include “coordinate_transforms.h
#include “core.h
#include “value_transforms.h
#include <functional>
#include <memory>
#include <string>
#include <vector>

Low-level helpers for assembling benchmark functions.

This header exposes the runtime ingredients used to build benchmark functions as well as the low-level callable type returned by the builder.

file composition.h
#include “core.h
#include <memory>
#include <vector>

Composition strategies and composed benchmark function wrappers.

This header defines how primitive functions are combined into higher-level benchmark functions through composition, coordinate transforms, and value transforms.

file coordinate_transforms.h
#include “core.h
#include <cstdint>
#include <vector>

Coordinate transforms used to remap benchmark input vectors.

file core.h
#include “basicf.h
#include <string>
#include <vector>

Core benchmark types and shared enumerations.

This header defines the basic domain container, the classification enums used to describe generated benchmark functions, and the compact class label helper used by the builder.

file funccraft.h
#include “basicf.h
#include “benchmark_function.h
#include “function_spec.h
#include “suite.h
#include “suite_collection.h
#include “suite_spec.h

Public umbrella header for the high-level FuncCraft C++ API.

Include this header when you want to construct benchmark functions, generate benchmark suites, load specs from files, and export materialized specs. Low-level runtime builders and transform implementations remain available through their own headers, but are intentionally not included here.

Public API map:

Primitive functions:

Function specs:

Suite specs:

Runtime objects:

Loading and construction:

  • FuncCraft::load_function_spec(path)

  • FuncCraft::make_benchmark_function(path)

  • FuncCraft::load_suite_spec(path)

  • FuncCraft::make_benchmark_suite(spec, dimension)

  • FuncCraft::make_benchmark_suite(path, dimension)

  • FuncCraft::list_suite_collections()

  • FuncCraft::suite_collection(year, version)

  • FuncCraft::suite_collection_spec(year, version)

  • FuncCraft::suite_collection_number_of_functions(year, version)

Export:

  • BenchmarkFunction::export_spec(path)

  • BenchmarkSuite::export_manifest(path)

  • BenchmarkSuite::export_spec(path)

Evaluation is batched:

  • BenchmarkFunction::operator()(std::vector<std::vector<double>>)

  • BenchmarkSuite::operator()(index, std::vector<std::vector<double>>)

Minimal example:

#include "funccraft.h"

int main() {
    const int dimension = 10;
    const int function_index = 0;
    const int year = 2026;
    const int version = 1;
    FuncCraft::SuiteCollection collection =
        FuncCraft::suite_collection(year, version);

    FuncCraft::BenchmarkSuite suite =
        collection.benchmark_suite(dimension);
    const FuncCraft::BenchmarkFunction& f =
        suite.function(function_index);
    std::vector<double> values =
        f({std::vector<double>(dimension, 0.0)});

    f.export_spec("function.yaml");
    suite.export_manifest("suite_manifest.yaml");
}
file function_spec.h
#include “core.h
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <vector>

Specification types for FuncCraft benchmark functions.

Specs describe both what the user wants to build and what was actually materialized at runtime:

  • which primitive components are used;

  • where component minima are assigned in the generated/search coordinates;

  • which coordinate/value transforms and composition family are requested;

  • which optimum location/value should be controlled by construction.

  • concrete transform matrices when known.

file suite.h
#include “benchmark_function.h
#include “suite_spec.h
#include <cstdint>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include <yaml-cpp/yaml.h>

Declarative benchmark-suite specification and container API.

A suite is now described by a plain-data SuiteSpec plus one fixed ambient dimension. The suite container consumes that spec, resolves its sampling rules deterministically, and stores blueprints only. Concrete BenchmarkFunction objects are created lazily when the caller requests a specific function index.

file suite_collection.h
#include “suite.h
#include “suite_spec.h
#include <cstdint>
#include <string>
#include <vector>

Public registry for named FuncCraft benchmark-suite collections.

file suite_spec.h
#include “core.h
#include <cstdint>
#include <utility>
#include <vector>
#include <string>

High-level typed specification for benchmark suite generation.

file value_transforms.h
#include “core.h

Scalar transforms applied to primitive function values.

These transforms reshape the output of a base function before composition. Every value transform must preserve the origin: f(0) == 0. The runtime checks are tolerance-based so tiny floating-point roundoff near zero does not fail a valid benchmark evaluation.

file basicf.cpp
#include “basicf.h
#include “core.h
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <limits>
#include <random>
#include <stdexcept>
#include <utility>
file benchmark_function.cpp
#include “benchmark_function.h
#include “support.h
#include <cstddef>
#include <cstdint>
#include <algorithm>
#include <cmath>
#include <limits>
#include <map>
#include <memory>
#include <random>
#include <sstream>
#include <utility>
file builder.cpp
#include “builder.h
#include “basicf.h
#include “support.h
#include <cmath>
#include <limits>
#include <stdexcept>
#include <utility>
file composition.cpp
#include “composition.h
#include “support.h
#include <algorithm>
#include <cmath>
#include <limits>
#include <stdexcept>
#include <utility>
file coordinate_transforms.cpp
#include “coordinate_transforms.h
#include “support.h
#include <cmath>
#include <random>
#include <utility>
file core.cpp
#include “core.h
#include “support.h
#include <cmath>
#include <sstream>
file suite.cpp
#include “suite.h
#include “basicf.h
#include “support.h
#include <algorithm>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <functional>
#include <iostream>
#include <limits>
#include <memory>
#include <random>
#include <set>
#include <sstream>
#include <stdexcept>
#include <utility>
#include <yaml-cpp/yaml.h>
file suite_collection.cpp
#include “suite_collection.h
#include “support.h
#include <algorithm>
#include <cstdlib>
#include <filesystem>
#include <regex>
#include <stdexcept>
#include <string>
#include <utility>

Variables

SuiteCollectionId id
fs::path path
file support.cpp
#include “benchmark_function.h
#include “suite.h
#include “support.h
#include <algorithm>
#include <cctype>
#include <cmath>
#include <fstream>
#include <limits>
#include <memory>
#include <random>
#include <sstream>
#include <stdexcept>
#include <utility>
file support.h
#include “core.h
#include <cstdint>
#include <random>
#include <string>
#include <utility>
#include <vector>
#include <yaml-cpp/yaml.h>

Internal helper routines shared by the benchmark implementation.

This header contains validation helpers, numeric utilities, and random matrix generators used by the implementation files.

file value_transforms.cpp
#include “value_transforms.h
#include “support.h
#include <algorithm>
#include <cmath>
#include <cstdio>
dir include
dir src