|
Monte Carlo Integration Library 1.0
High-performance Monte Carlo methods for numerical integration and optimization
|
Abstract base class for all optimization algorithms. More...
#include <optimizer.hpp>
Public Types | |
| using | StepCallback = std::function< void(const Solution ¤t_best, size_t iteration)> |
| Callback invoked after each step/generation. | |
Public Member Functions | |
| virtual | ~Optimizer ()=default |
| virtual void | setObjectiveFunction (ObjectiveFunction func)=0 |
| Set the function to optimize (the "black box"). | |
| virtual void | setBounds (const Coordinates &lower_bounds, const Coordinates &upper_bounds)=0 |
| Define the search space boundaries (hyper-rectangle). | |
| virtual void | setMode (OptimizationMode mode)=0 |
| Set the optimization goal. | |
| virtual void | setCallback (StepCallback cb)=0 |
| virtual Solution | optimize ()=0 |
| Run the optimization loop until the stopping criterion is met. | |
| virtual void | step ()=0 |
| Perform a single iteration/generation of the algorithm. | |
| virtual Solution | getBestSolution () const =0 |
| Get the best solution found so far. | |
Abstract base class for all optimization algorithms.
Enforces a common interface for GA, PSO, etc.
Definition at line 17 of file optimizer.hpp.
| using mc::optim::Optimizer::StepCallback = std::function<void(const Solution& current_best, size_t iteration)> |
Callback invoked after each step/generation.
| current_best | The best solution so far. |
| iteration | Zero-based iteration/generation index. |
Definition at line 25 of file optimizer.hpp.
|
virtualdefault |
|
pure virtual |
Get the best solution found so far.
Implemented in mc::optim::GA, and mc::optim::PSO.
|
pure virtual |
Run the optimization loop until the stopping criterion is met.
Implemented in mc::optim::GA, and mc::optim::PSO.
|
pure virtual |
Define the search space boundaries (hyper-rectangle).
| lower_bounds | Minimum coordinate per dimension. |
| upper_bounds | Maximum coordinate per dimension. |
Implemented in mc::optim::GA, and mc::optim::PSO.
|
pure virtual |
Implemented in mc::optim::GA, and mc::optim::PSO.
|
pure virtual |
Set the optimization goal.
Implemented in mc::optim::GA, and mc::optim::PSO.
|
pure virtual |
Set the function to optimize (the "black box").
| func | Objective mapping coordinates to scalar value. |
Implemented in mc::optim::GA, and mc::optim::PSO.
|
pure virtual |
Perform a single iteration/generation of the algorithm.
Useful for debugging, plotting, or GUI integration.
Implemented in mc::optim::GA, and mc::optim::PSO.