Skip to content

Commit bbd4a52

Browse files
committed
why am I still working. At least it works
1 parent 6c36480 commit bbd4a52

23 files changed

Lines changed: 851 additions & 677 deletions

include/c_maes.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ struct ModularCMAES
1212

1313
void recombine() const;
1414

15+
void select() const;
16+
17+
void adapt() const;
18+
19+
void mutate(FunctionType &objective) const;
20+
1521
bool step(FunctionType& objective) const;
1622

1723
void operator()(FunctionType& objective) const;

include/common.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <Eigen/Eigenvalues>
2323
#include <Eigen/QR>
2424

25-
using Float = long double;
25+
using Float = double;
2626
using Matrix = Eigen::Matrix<Float, -1, -1>;
2727
using Vector = Eigen::Matrix<Float, -1, 1>;
2828
using Array = Eigen::Array<Float, -1, 1>;
@@ -35,9 +35,9 @@ using FunctionType = std::function<Float(const Vector &)>;
3535

3636
namespace constants
3737
{
38-
extern Float tolup_sigma;
38+
extern Float max_dsigma;
39+
extern Float min_dsigma;
3940
extern Float tol_condition_cov;
40-
extern Float tol_min_sigma;
4141
extern Float stagnation_quantile;
4242
extern Float sigma_threshold;
4343
extern size_t cache_max_doubles;

include/parameters.hpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#include "mutation.hpp"
55
#include "population.hpp"
66
#include "matrix_adaptation.hpp"
7-
#include "restart.hpp"
7+
#include "restart_strategy.hpp"
8+
#include "restart_criteria.hpp"
89
#include "sampling.hpp"
910
#include "stats.hpp"
1011
#include "selection.hpp"
@@ -16,6 +17,8 @@ namespace parameters
1617
{
1718
struct Parameters
1819
{
20+
bool successfull_adaptation;
21+
1922
size_t lambda;
2023
size_t mu;
2124

@@ -26,23 +29,26 @@ namespace parameters
2629
Population pop;
2730
Population old_pop;
2831

32+
restart::Criteria criteria;
2933
std::shared_ptr<sampling::Sampler> sampler;
3034
std::shared_ptr<matrix_adaptation::Adaptation> adaptation;
3135
std::shared_ptr<mutation::Strategy> mutation;
3236
std::shared_ptr<selection::Strategy> selection;
33-
std::shared_ptr<restart::Strategy> restart;
37+
std::shared_ptr<restart::Strategy> restart_strategy;
3438
std::shared_ptr<bounds::BoundCorrection> bounds;
3539
std::shared_ptr<repelling::Repelling> repelling;
3640
std::shared_ptr<center::Placement> center_placement;
3741

3842
Parameters(const size_t dim);
43+
3944
Parameters(const Settings &settings);
4045

41-
void adapt(FunctionType& objective);
46+
47+
void start(FunctionType& objective);
4248

43-
void perform_restart(FunctionType& objective, const std::optional<Float> &sigma = std::nullopt);
49+
void adapt();
4450

45-
bool invalid_state() const;
51+
void perform_restart(FunctionType& objective, const std::optional<Float> &sigma = std::nullopt);
4652
};
4753

4854
}

include/restart.hpp

Lines changed: 0 additions & 174 deletions
This file was deleted.

0 commit comments

Comments
 (0)