Loading...
Searching...
No Matches
optimization_algorithm.h
Go to the documentation of this file.
1#ifndef _BBM_OPTIMIZATION_ALGORITHM_CONCEPT_H_
2#define _BBM_OPTIMIZATION_ALGORITHM_CONCEPT_H_
3
4#include "bbm/config.h"
5
6/************************************************************************/
7/*! \file optimization_algorithm.h
8 \brief Optimization algorithm interface contract
9*************************************************************************/
10
11namespace bbm {
12 namespace concepts {
13
14 /********************************************************************/
15 /*! \brief optimization_algorithm concept
16
17 Each optimization algorithm has the following:
18 + concepts::has_config
19 + Value step(void) : take one optimization step
20 + void reset(void) : reset the internal state of the algorithm
21 + Mask is_converged(void) const : true if the algorithm has converged
22
23 *******************************************************************/
24 template<typename OPT>
25 concept optimization_algorithm = requires(OPT& opt)
26 {
28
29 //! \brief step function
30 { opt.step() } -> std::same_as<Value_t<OPT>>;
31
32 //! \brief reset
33 { opt.reset() };
34
35 //! \brief is_converged
36 { std::as_const(opt).is_converged() } -> std::same_as<Mask_t<OPT>>;
37 };
38
39 /********************************************************************/
40 /*! \brief optimization_algorithm archetype for concept checking
41
42 \tparam CONF = config to check for. Default = archetype::config
43 *********************************************************************/
44 namespace archetype {
45 template<typename CONF=config>
47 {
48 using Config = CONF;
50 void reset(void);
51 Mask_t<Config> is_converged(void) const;
52 };
53 } // end archetype namespace
54
56
57 } // end concepts namespace
58} // end bbm namespace
59
60#endif /* _BBM_OPTIMIZER_CONCEPT_H_ */
All BBM methods are defined to operate on a variety of value types and spectrum types....
has_config
Definition: config.h:53
optimization_algorithm concept
Definition: optimization_algorithm.h:25
#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
typename get_config< T >::Value Value_t
Definition: config.h:67
Definition: optimization_algorithm.h:47
CONF Config
Definition: optimization_algorithm.h:48