C++ API
The C++ API documentation below is generated from the public headers with Doxygen and Breathe.
-
class AffineTransform : public FuncCraft::CoordinateTransform
- #include <coordinate_transforms.h>
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), soassigned_xoptis 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 int input_dimension() const override
-
virtual int output_dimension() const override
-
virtual CoordinateTransformClass transform_class() const override
-
AffineTransform(int dimension, std::vector<double> assigned_xopt, std::vector<double> target_xopt, std::uint64_t seed)
-
class BasicF
- #include <basicf.h>
Canonical basic benchmark function.
A
BasicFis a normalized primitive benchmark landscape. All built-in basic functions are exposed in primitive coordinates:dimensionis the requested problem dimension;default_domainis the canonical plotting/evaluation box for the primitive;x_optstores the global optimum of the implemented primitive;f_optstores the primitive minimum value;propertiesis 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
MinionBenchmarkwithuseRotation=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 double *x) const
Evaluate the primitive at one already dimension-checked input point.
-
BasicFunctionId id() const
Return the primitive identifier.
-
class BenchmarkFunction
- #include <benchmark_function.h>
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.
-
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::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.
Private Members
-
FunctionSpec spec_
-
double scale_factor_ = 1.0
-
double assigned_fopt_ = 0.0
-
ComposedFunction function_
-
explicit BenchmarkFunction(FunctionSpec spec)
-
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.
-
YAML::Node export_manifest() const
Export the suite spec and every generated function spec as a YAML node.
-
YAML::Node export_spec() const
Alias for export_manifest().
Private Functions
-
BenchmarkFunction build_function(const FunctionBlueprint &blueprint) const
-
bool supports_dimension(int dimension) const
-
BenchmarkSuite(SuiteSpec spec, int dimension)
-
class BlockRotationTransform : public FuncCraft::CoordinateTransform
- #include <coordinate_transforms.h>
Selects coordinates from the full vector and rotates only that block.
selected_indicesuses 0-based indices into the full input vector. The transform maps a fullD-dimensional input into anm-dimensional selected subspace, wherem = selected_indices.size().assigned_xopt,target_xopt, andmatrixare 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 int input_dimension() const override
-
virtual int output_dimension() const override
-
virtual CoordinateTransformClass transform_class() const override
-
BlockRotationTransform(int dimension, std::vector<int> selected_indices, std::vector<double> assigned_xopt, std::vector<double> target_xopt, std::uint64_t seed)
-
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
-
struct ComponentSpec
- #include <function_spec.h>
User-facing component request.
A component uses
composed_functionwhen it is set; otherwise it usesbase_functionas 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::optional<BasicFunctionId> base_function
-
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.
-
virtual ~CompositionFunction() = default
-
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.
weightsare 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.
biasesare 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
centersas full-dimensional softmax centers. Empty means the builder should resolve centers internally. This is separate from block-rotation componentassigned_xopt, which may be subspace-dimensional.
-
class CoordinateTransform
- #include <coordinate_transforms.h>
Subclassed by FuncCraft::AffineTransform, FuncCraft::BlockRotationTransform, FuncCraft::IdentityTransform, FuncCraft::RotationTransform
Public Functions
-
virtual ~CoordinateTransform() = default
-
virtual int input_dimension() const = 0
-
virtual int output_dimension() const = 0
-
virtual CoordinateTransformClass transform_class() const = 0
Protected Functions
-
virtual ~CoordinateTransform() = default
-
struct CoordinateTransformSpec
- #include <function_spec.h>
Coordinate-transform request/materialization for one component.
input_dimensionis the parent/search dimension.output_dimensionis the dimension seen by the component function after the transform.assigned_xoptis 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_indicesis only meaningful for block rotation. If it is empty, suite generation may choose the subspace.matrixis empty until the concrete linear transform is generated or loaded.
-
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
-
explicit CosineZeroValueTransform(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
-
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 = {})
-
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
-
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
-
DeceptiveSoftmaxComposition(std::vector<std::vector<double>> centers, double sharpness = 0.01, std::vector<double> biases = {})
-
struct DomainSpec
- #include <function_spec.h>
Axis-aligned search domain requested by the user.
-
struct FunctionBlueprint
Public Members
-
bool composed = false
-
BasicFunctionId base_function = BasicFunctionId::Sphere
-
CoordinateTransformChoice coordinate_transform_choice
-
bool composed = false
-
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.
Add one primitive component to the composed function.
Add one already-materialized function component.
Set the composition rule for all accumulated components.
-
ComposedFunction build() const
Materialize the final composed runtime callable.
Private Members
-
std::shared_ptr<CompositionFunction> composition_
-
std::vector<RuntimeComponent> runtime_components_
-
explicit FunctionBuilder(int dimension)
-
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
-
CompositionClass composition = CompositionClass::None
-
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_xoptandassigned_foptcontrol the constructed optimum location and value.scale_factor = std::nulloptmeans the builder should determine a scale factor internally.Public Members
-
int dimension = 0
-
DomainSpec domain
-
std::vector<ComponentSpec> components
-
CompositionSpec composition
-
double assigned_fopt = 0.0
-
int dimension = 0
-
class IdentityTransform : public FuncCraft::CoordinateTransform
- #include <coordinate_transforms.h>
No-op transform with the standard assigned/base xopt/seed signature.
-
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
-
virtual ValueTransformClass transform_class() const override
-
class LevelWellComposition : public FuncCraft::CommonPointComposition
- #include <composition.h>
Level-well composition with sinusoidal shaping.
Public Functions
-
virtual CompositionClass composition_class() const override
Return the composition family used by this strategy.
-
virtual CompositionClass composition_class() const override
-
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.
-
virtual CompositionClass composition_class() 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
-
OscillatoryValueTransform(double epsilon = 0.1, double alpha = 1.0)
-
struct PeakData
-
class PowerMeanComposition : public FuncCraft::CommonPointComposition
- #include <composition.h>
Power-mean composition across multiple components.
Public Functions
-
virtual CompositionClass composition_class() const override
Return the composition family used by this strategy.
-
virtual CompositionClass composition_class() const override
-
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
-
PowerValueTransform(double alpha = 1.0, double p = 1.0)
-
class RotationTransform : public FuncCraft::CoordinateTransform
- #include <coordinate_transforms.h>
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), soassigned_xoptis 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 int input_dimension() const override
-
virtual int output_dimension() const override
-
virtual CoordinateTransformClass transform_class() const override
-
RotationTransform(int dimension, std::vector<double> assigned_xopt, std::vector<double> target_xopt, std::uint64_t seed)
-
struct RuntimeComponent
-
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.
-
struct SuiteCollectionId
- #include <suite_collection.h>
Lightweight identifier for a built-in suite collection.
-
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 materializedFunctionSpecobjects.Public Members
-
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
-
double lower_bound = -100.0
-
double upper_bound = 100.0
-
double assigned_fopt = 100.0
-
double xopt_domain_shrink_factor = 0.8
-
std::vector<BasicFunctionId> base_functions = all_suite_base_functions()
-
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
-
virtual ~ValueTransform() = default
-
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.
-
template<typename Kind>
struct WeightedChoice - #include <suite_spec.h>
Weighted suite-generation choice.
Probabilities are fractions and each choice table must sum to one.
-
class WeightedSumComposition : public FuncCraft::CommonPointComposition
- #include <composition.h>
Weighted sum composition across multiple components.
Public Functions
-
virtual CompositionClass composition_class() const override
Return the composition family used by this strategy.
-
virtual CompositionClass composition_class() const override
-
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.
-
enumerator Sphere
-
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.
-
enumerator None
-
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.
-
enumerator None
-
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.
-
enumerator None
-
enum class CoordinateTransformKind
High-level coordinate-transform family.
Values:
-
enumerator None
-
enumerator Rotation
-
enumerator Affine
-
enumerator BlockRotation
-
enumerator None
-
enum class ValueTransformKind
High-level value-transform family.
Values:
-
enumerator None
-
enumerator Power
-
enumerator Oscillatory
-
enumerator CosineZero
-
enumerator None
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.
-
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)
-
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()
-
using ComposedFunction = std::function<std::vector<double>(const std::vector<std::vector<double>> &X)>
-
namespace FuncCraft
-
namespace FuncCraft
-
namespace FuncCraft
-
namespace FuncCraft
-
namespace FuncCraft
-
namespace FuncCraft
-
namespace FuncCraft
-
namespace FuncCraft
-
namespace detail
Functions
-
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 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 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.
-
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<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.
-
void require_dimension(const std::vector<double> &x, int dimension, const std::string &name)
-
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"
-
constexpr const char *None = "none"
-
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
FunctionSpectogether 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:
FuncCraft::to_string(BasicFunctionId)
Function specs:
Suite specs:
FuncCraft::make_choice(...)
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::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
SuiteSpecplus one fixed ambient dimension. The suite container consumes that spec, resolves its sampling rules deterministically, and stores blueprints only. ConcreteBenchmarkFunctionobjects 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 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>
- 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