|
|
|
//
|
|
|
|
// $filename
|
|
|
|
// $projectname
|
|
|
|
//
|
|
|
|
// Created by Joshua moerman on $TODAY.
|
|
|
|
// Copyright 2010 Joshua Moerman. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "Logistic.hpp"
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
Logistic::Logistic():
|
|
|
|
KernelBasicParameter(3),
|
|
|
|
KernelBasicVector(3) {
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Logistic::Logistic(const unsigned int dimension):
|
|
|
|
KernelBasicParameter(dimension),
|
|
|
|
KernelBasicVector(dimension) {
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Logistic::init() {
|
|
|
|
|
|
|
|
// setting some starting values
|
|
|
|
for ( unsigned int i = 0; i < myDimension; i++ ) {
|
|
|
|
vectorNew[i] = vectorOld[i] = 0.5;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Logistic::operator()() {
|
|
|
|
|
|
|
|
std::swap(vectorNew, vectorOld);
|
|
|
|
|
|
|
|
for ( unsigned int i = 0; i < myDimension; i++ ) {
|
|
|
|
vectorNew[i] = parameters[i]*vectorOld[i]*(1.0 - vectorOld[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|