Vita
alps.cc
Go to the documentation of this file.
1
13#include <limits>
14
15#include "kernel/alps.h"
16#include "utility/contracts.h"
17
18namespace vita::alps
19{
20
27unsigned parameters::allowed_age(unsigned l, unsigned layers) const
28{
29 Expects(l < layers);
30
31 return l + 1 == layers ? std::numeric_limits<unsigned>::max()
32 : max_age(l);
33}
34
39unsigned parameters::max_age(unsigned l) const
40{
41 // A polynomial aging scheme.
42 switch (l)
43 {
44 case 0: return age_gap;
45 case 1: return age_gap + age_gap;
46 default: return l * l * age_gap;
47 }
48
49 // A linear aging scheme.
50 // return age_gap * (l + 1);
51
52 // An exponential aging scheme.
53 // switch (l)
54 // {
55 // case 0: return age_gap;
56 // case 1: return age_gap + age_gap;
57 // default:
58 // {
59 // auto k(4);
60 // for (unsigned i(2); i < layer; ++i)
61 // k *= 2;
62 // return k * age_gap;
63 // }
64
65 // Fibonacci aging scheme.
66 // auto num1(age_gap), num2(age_gap);
67 // while (num2 <= 2)
68 // {
69 // auto num3(num2);
70 // num2 += num1;
71 // num1 = num3;
72 // }
73 //
74 // if (l == 1)
75 // return num1 + num2 - 1;
76 //
77 // for (unsigned i(1); i <= l; ++i)
78 // {
79 // auto num3(num2);
80 // num2 += num1 -1;
81 // num1 = num3;
82 // }
83 // return num2;
84}
85
86} // namespace vita::alps
unsigned max_age(unsigned) const
Definition: alps.cc:39
unsigned age_gap
The maximum ages for age layers is monotonically increasing and different methods can be used for set...
Definition: alps.h:48
unsigned allowed_age(unsigned, unsigned) const
Definition: alps.cc:27