|
|
|
|
|
|
|
|
#include <vector>
|
|
|
#include <vector>
|
|
|
#include "snf_saccades.hpp"
|
|
|
#include "snf_saccades.hpp"
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
bool doesOverlap(unsigned int workingStart, unsigned int testStart, unsigned int workingFinish) {
|
|
|
bool doesOverlap(unsigned int workingStart, unsigned int testStart, unsigned int workingFinish) {
|
|
|
return(
|
|
|
return(
|
|
|
testStart >= workingStart &&
|
|
|
testStart >= workingStart &&
|
|
|
testStart <= workingFinish
|
|
|
testStart <= workingFinish
|
|
|
);
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
vector<saccade> saccades_engine::recall() {
|
|
|
|
|
|
vector<saccade> recollection;
|
|
|
|
|
|
|
|
|
std::vector<saccade> saccades_engine::recall() {
|
|
|
|
|
|
std::vector<saccade> recollection;
|
|
|
int markersSize = markers.size();
|
|
|
int markersSize = markers.size();
|
|
|
if(0 < markersSize) {
|
|
|
if(0 < markersSize) {
|
|
|
set<saccade_marker>::iterator i;
|
|
|
|
|
|
|
|
|
std::set<saccade_marker>::iterator i;
|
|
|
recollection.reserve(markers.size());
|
|
|
recollection.reserve(markers.size());
|
|
|
bool isFirstPass = true;
|
|
|
bool isFirstPass = true;
|
|
|
unsigned int workingStart = 0;
|
|
|
unsigned int workingStart = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void saccades_engine::evoke(saccade s) {
|
|
|
void saccades_engine::evoke(saccade s) {
|
|
|
bool stillGrowing = (capacity > engrams.size());
|
|
|
bool stillGrowing = (capacity > engrams.size());
|
|
|
set<saccade_marker>::iterator i;
|
|
|
|
|
|
|
|
|
std::set<saccade_marker>::iterator i;
|
|
|
saccade_marker testMarker(s,0);
|
|
|
saccade_marker testMarker(s,0);
|
|
|
i = markers.find(testMarker);
|
|
|
i = markers.find(testMarker);
|
|
|
bool isRemembered = (i != markers.end());
|
|
|
bool isRemembered = (i != markers.end());
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
void saccades_engine::learn(vector<saccade>& experiences) {
|
|
|
|
|
|
|
|
|
void saccades_engine::learn(std::vector<saccade>& experiences) {
|
|
|
for(unsigned int i = 0; i < experiences.size(); i++) {
|
|
|
for(unsigned int i = 0; i < experiences.size(); i++) {
|
|
|
evoke(experiences[i]);
|
|
|
evoke(experiences[i]);
|
|
|
}
|
|
|
}
|