|
OptiPy
|
Abstract base class for all optimization algorithms. More...
#include <Optimizer.h>
Public Member Functions | |
| Optimizer (std::shared_ptr< SolutionBuilder > solutionBuilder, std::shared_ptr< Problem > problem, int maxIterations) | |
| Constructs an Optimizer. | |
| virtual | ~Optimizer ()=default |
| Virtual destructor for safe polymorphic deletion. | |
| virtual std::vector< double > | optimize ()=0 |
| Runs the optimization algorithm. | |
Accessors | |
| double | getBestFitness () |
| std::vector< double > & | getBestSolution () |
| std::vector< double > & | getBestFitnesses () |
| std::vector< std::vector< double > > & | getSolutions () |
| int | getMaxIterations () |
| std::shared_ptr< Problem > | getProblem () |
| std::shared_ptr< SolutionBuilder > | getSolutionBuilder () |
Protected Attributes | |
| std::shared_ptr< Problem > | problem |
| Optimization problem definition. | |
| std::shared_ptr< SolutionBuilder > | solutionBuilder |
| Solution generation utility. | |
| int | maxIterations |
| Maximum number of iterations. | |
| std::vector< double > | bestSolution |
| Best solution found. | |
| std::vector< double > | bestFitnesses |
| Best fitness value so far per iteration. | |
| std::vector< std::vector< double > > | solutions |
| All generated solutions. | |
Abstract base class for all optimization algorithms.
The Optimizer class defines a common interface and shared state for optimization algorithms operating on benchmark problems. Derived classes must implement the optimize() method. Results for each run are stored in fields and accessed through getter methods
|
inline |
Constructs an Optimizer.
| solutionBuilder | Shared pointer to the solution generator. |
| problem | Shared pointer to the optimization problem. |
| maxIterations | Maximum number of iterations allowed. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
pure virtual |
Runs the optimization algorithm.
Implemented in Blind, LocalSearch, and ParticleSwarm.