|
|
|
#ifndef LOGISTIC_HPP
|
|
|
|
#define LOGISTIC_HPP
|
|
|
|
|
|
|
|
#include "../AttractorKernel.hpp"
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
|
|
class Logistic : public AttractorKernel {
|
|
|
|
private:
|
|
|
|
void init() {
|
|
|
|
// setting some starting values
|
|
|
|
std::fill_n(vectorOld, dimension, 0.5);
|
|
|
|
std::fill_n(vectorNew, dimension, 0.5);
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
Logistic():
|
|
|
|
AttractorKernel(3, 3) {
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
Logistic(const unsigned int dimension):
|
|
|
|
AttractorKernel(dimension, dimension) {
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void generate_random_parameters() {
|
|
|
|
for(unsigned int i = 0; i < numberOfParameters; ++i) {
|
|
|
|
parameters[i] = rand() / double(RAND_MAX) + 3.0;
|
|
|
|
}
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void operator()() {
|
|
|
|
std::swap(vectorNew, vectorOld);
|
|
|
|
|
|
|
|
for(unsigned int i = 0; i < dimension; i++) {
|
|
|
|
vectorNew[i] = parameters[i]*vectorOld[i]*(1.0 - vectorOld[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LOGISTIC_HPP
|
|
|
|
|