Loading...
Searching...
No Matches
optimizer.h
Go to the documentation of this file.
1#ifndef _BBM_OPTIMIZER_H_
2#define _BBM_OPTIMIZER_H_
3
5
6#include "bbm/config.h"
8
9/************************************************************************/
10/*! \file optimizer.h
11 \brief Connects a optimization_algorithm to a optimizers
12
13 This class provides a simple interface for connecting optimization
14 algorithms (without virtual functions) to a optimzier (with virtual
15 functions). Essentially, this class just passes the method calls to the
16 underlying optimzation algorithm implementation.
17*************************************************************************/
18
19namespace bbm {
20
21 /**********************************************************************/
22 /*! \brief OPTIMIZER implementation of a optimization algorithm
23
24 \tparam OPT = the optimization algorithm
25 ***********************************************************************/
26 template<typename OPT> requires concepts::optimization_algorithm<OPT>
27 class optimizer : virtual public optimizer_base< get_config<OPT> >, public OPT
28 {
29 public:
31
32 //! \brief Inherit all constructors
33 using OPT::OPT;
34
35 //! \brief Directly construct from a OPTimization algorithm
36 optimizer(const OPT& opt) : OPT(opt) {}
37
38 //! \brief Assignment operartor
39 using OPT::operator=;
40
41 /********************************************************************/
42 /*! \brief Virtual passthrough of the 'step' method
43
44 \returns the current loss
45 *********************************************************************/
46 virtual Value step(void) override final
47 {
48 return OPT::step();
49 }
50
51 /********************************************************************/
52 /*! \brief Virtual passthrough of the 'reset' method
53 ********************************************************************/
54 virtual void reset(void) override final
55 {
56 OPT::reset();
57 }
58
59 /********************************************************************/
60 /*! \brief Virtual passthrough of the 'is_converged' method
61 ********************************************************************/
62 virtual Mask is_converged(void) override final
63 {
64 return OPT::is_converged();
65 }
66 };
67
68} // end bbm namespace
69
70BBM_CHECK_CONCEPT( concepts::optimizer, optimizer<optimization_algorithm<>> );
71
72#endif /* _BBM_OPTIMIZER_H_ */
All BBM methods are defined to operate on a variety of value types and spectrum types....
OPTIMIZER implementation of a optimization algorithm.
Definition: optimizer.h:28
virtual Value step(void) override final
Virtual passthrough of the 'step' method.
Definition: optimizer.h:46
BBM_IMPORT_CONFIG(OPT)
virtual void reset(void) override final
Virtual passthrough of the 'reset' method.
Definition: optimizer.h:54
optimizer(const OPT &opt)
Directly construct from a OPTimization algorithm.
Definition: optimizer.h:36
virtual Mask is_converged(void) override final
Virtual passthrough of the 'is_converged' method.
Definition: optimizer.h:62
Optimizer contract: virtual interface wrapper around optimization_algorithms.
#define BBM_CHECK_CONCEPT(CONCEPTNAME, CLASSNAME,...)
Check a class for a concept with bbm::concepts::archetypes in the namespace.
Definition: macro.h:35
Definition: aggregatebsdf.h:29
Abstract optimizer base class.
Definition: optimizer_base.h:23