Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 38942439 authored by David Parsons's avatar David Parsons
Browse files

move fn defs to .cpp

parent 0c9fbdf3
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,29 @@ ...@@ -31,6 +31,29 @@
#include "Vector_Fuzzy.h" #include "Vector_Fuzzy.h"
#include "Discrete_Double_Fuzzy.h" #include "Discrete_Double_Fuzzy.h"
namespace aevol { namespace aevol {
FuzzyFactory_7::FuzzyFactory_7(FuzzyFlavor flavor, int pool_size, int sampling, int pop_size) {
flavor_ = flavor;
pool_size_ = pool_size;
if (flavor_ == FuzzyFlavor::DISCRETE_DOUBLE_TABLE) {
PHENOTYPE_VECTOR_SIZE=sampling;
D_PHENOTYPE_VECTOR_SIZE=((double)sampling);
}
init(pop_size);
}
FuzzyFactory_7::~FuzzyFactory_7() {
for (auto&& it_fuzzy : list_unused_fuzzy_) {
delete it_fuzzy;
}
for (int i = 0; i < nb_local_pool; i++)
for (auto && it_fuzzy : local_list_unused_fuzzy_[i]) {
delete it_fuzzy;
}
list_unused_fuzzy_.clear();
}
AbstractFuzzy_7* FuzzyFactory_7::createFuzzy() { AbstractFuzzy_7* FuzzyFactory_7::createFuzzy() {
AbstractFuzzy_7* fuzz = nullptr; AbstractFuzzy_7* fuzz = nullptr;
switch (flavor_) switch (flavor_)
...@@ -77,6 +100,13 @@ namespace aevol { ...@@ -77,6 +100,13 @@ namespace aevol {
} }
} }
void FuzzyFactory_7::stats() {
int total_length_ =
((flavor_ == FuzzyFlavor::DISCRETE_DOUBLE_TABLE) ? PHENOTYPE_VECTOR_SIZE : 1) * list_unused_fuzzy_.size();
printf("FUZZY_FACTORY_STATS -- Number of Fuzzys %ld - Combined size %d elements\n",list_unused_fuzzy_.size(),
total_length_);
}
AbstractFuzzy_7 *FuzzyFactory_7::get_fuzzy() { AbstractFuzzy_7 *FuzzyFactory_7::get_fuzzy() {
AbstractFuzzy_7 *pop = nullptr; AbstractFuzzy_7 *pop = nullptr;
......
...@@ -55,40 +55,16 @@ std::string to_string(const FuzzyFlavor& ff) { ...@@ -55,40 +55,16 @@ std::string to_string(const FuzzyFlavor& ff) {
class FuzzyFactory_7 { class FuzzyFactory_7 {
public: public:
FuzzyFactory_7(FuzzyFlavor flavor, int pool_size, int sampling, int pop_size = -1) { FuzzyFactory_7(FuzzyFlavor flavor, int pool_size, int sampling, int pop_size = -1);
flavor_ = flavor; ~FuzzyFactory_7();
// printf("FuzzyFactory %d\ n",flavor_);
pool_size_ = pool_size; void stats();
if (flavor_ == FuzzyFlavor::DISCRETE_DOUBLE_TABLE) {
PHENOTYPE_VECTOR_SIZE=sampling;
D_PHENOTYPE_VECTOR_SIZE=((double)sampling);
// printf("SAMPLING %d :: %d\n",sampling,PHENOTYPE_VECTOR_SIZE);
}
init(pop_size);
}
~FuzzyFactory_7() {
for (auto&& it_fuzzy : list_unused_fuzzy_) {
delete it_fuzzy;
}
for (int i = 0; i < nb_local_pool; i++)
for (auto && it_fuzzy : local_list_unused_fuzzy_[i]) {
delete it_fuzzy;
}
list_unused_fuzzy_.clear();
}
void init(int pop_size); void init(int pop_size);
void stats() {
int total_length_ =
((flavor_ == FuzzyFlavor::DISCRETE_DOUBLE_TABLE) ? PHENOTYPE_VECTOR_SIZE : 1) * list_unused_fuzzy_.size();
printf("FUZZY_FACTORY_STATS -- Number of Fuzzys %ld - Combined size %d elements\n",list_unused_fuzzy_.size(),
total_length_);
}
AbstractFuzzy_7 *get_fuzzy(); AbstractFuzzy_7 *get_fuzzy();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment