GALib-Parallel
Header-only C++ library for parallel evolutionary algorithms
Loading...
Searching...
No Matches
Public Member Functions | List of all members
galib::benchmark::HeavyTrigFunction< GeneType > Class Template Reference

A computationally intensive trigonometric benchmark function. More...

#include <HeavyTrigFunction.h>

Inheritance diagram for galib::benchmark::HeavyTrigFunction< GeneType >:
[legend]

Public Member Functions

 HeavyTrigFunction (std::size_t dimensions, GeneType lower_bound, GeneType upper_bound, std::size_t repeat_count=64)
 Constructs the benchmark.
 
double evaluate (const std::vector< GeneType > &phenotype) const override
 Evaluates the heavy trigonometric sum.
 
std::size_t size () const override
 Returns the dimensionality of the optimization problem.
 
std::string name () const override
 Short identifier used to select a GPU evaluation kernel.
 
GeneType getLowerBound (std::size_t) const override
 Gets the lower bound for a specific dimension.
 
GeneType getUpperBound (std::size_t) const override
 Gets the upper bound for a specific dimension.
 
- Public Member Functions inherited from galib::FitnessFunction< GeneType >
virtual ~FitnessFunction ()=default
 
GeneType getLowerBound () const
 Convenience method to get the lower bound of the first dimension.
 
GeneType getUpperBound () const
 Convenience method to get the upper bound of the first dimension.
 

Detailed Description

template<typename GeneType = double>
class galib::benchmark::HeavyTrigFunction< GeneType >

A computationally intensive trigonometric benchmark function.

Designed to test the library's parallel scaling capabilities by introducing a heavy workload in the fitness evaluation via repeated sine/cosine iterations.

Template Parameters
GeneTypeThe numeric type of the genes.

Definition at line 25 of file HeavyTrigFunction.h.

Constructor & Destructor Documentation

◆ HeavyTrigFunction()

template<typename GeneType = double>
galib::benchmark::HeavyTrigFunction< GeneType >::HeavyTrigFunction ( std::size_t  dimensions,
GeneType  lower_bound,
GeneType  upper_bound,
std::size_t  repeat_count = 64 
)
inlineexplicit

Constructs the benchmark.

Parameters
dimensionsNumber of dimensions.
lower_boundUniform lower bound.
upper_boundUniform upper bound.
repeat_countNumber of internal iterations per dimension (default: 64).

Definition at line 40 of file HeavyTrigFunction.h.

Member Function Documentation

◆ evaluate()

template<typename GeneType = double>
double galib::benchmark::HeavyTrigFunction< GeneType >::evaluate ( const std::vector< GeneType > &  phenotype) const
inlineoverridevirtual

Evaluates the heavy trigonometric sum.

Parameters
phenotypeInput vector.
Returns
Fitness value.

Implements galib::FitnessFunction< GeneType >.

Definition at line 54 of file HeavyTrigFunction.h.

◆ getLowerBound()

template<typename GeneType = double>
GeneType galib::benchmark::HeavyTrigFunction< GeneType >::getLowerBound ( std::size_t  dimension) const
inlineoverridevirtual

Gets the lower bound for a specific dimension.

Parameters
dimensionIndex of the dimension.
Returns
Lower bound value.

Implements galib::FitnessFunction< GeneType >.

Definition at line 82 of file HeavyTrigFunction.h.

◆ getUpperBound()

template<typename GeneType = double>
GeneType galib::benchmark::HeavyTrigFunction< GeneType >::getUpperBound ( std::size_t  dimension) const
inlineoverridevirtual

Gets the upper bound for a specific dimension.

Parameters
dimensionIndex of the dimension.
Returns
Upper bound value.

Implements galib::FitnessFunction< GeneType >.

Definition at line 86 of file HeavyTrigFunction.h.

◆ name()

template<typename GeneType = double>
std::string galib::benchmark::HeavyTrigFunction< GeneType >::name ( ) const
inlineoverridevirtual

Short identifier used to select a GPU evaluation kernel.

Override in benchmark subclasses to enable GPU-side evaluation ("Sphere", "Rastrigin", "HeavyTrig"). Return empty string (default) to use the CPU callback path.

Returns
Problem name string, or "" for custom functions.

Reimplemented from galib::FitnessFunction< GeneType >.

Definition at line 80 of file HeavyTrigFunction.h.

◆ size()

template<typename GeneType = double>
std::size_t galib::benchmark::HeavyTrigFunction< GeneType >::size ( ) const
inlineoverridevirtual

Returns the dimensionality of the optimization problem.

Returns
Number of dimensions.

Implements galib::FitnessFunction< GeneType >.

Definition at line 79 of file HeavyTrigFunction.h.


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