file renaming
This commit is contained in:
15
src/Genetics
15
src/Genetics
@@ -1,15 +0,0 @@
|
||||
#ifndef _GENETICS_H_
|
||||
#define _GENETICS_H_
|
||||
|
||||
namespace S
|
||||
{
|
||||
class Genetics
|
||||
{
|
||||
public:
|
||||
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
1
src/Genetics
Symbolic link
1
src/Genetics
Symbolic link
@@ -0,0 +1 @@
|
||||
././Genetics.h
|
||||
@@ -1,2 +1,9 @@
|
||||
#include "Genetics"
|
||||
|
||||
S::XXY S::Genetics::getSolution()
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
./Genetics
|
||||
33
src/Genetics.h
Normal file
33
src/Genetics.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef _GENETICS_H_
|
||||
#define _GENETICS_H_
|
||||
|
||||
namespace S
|
||||
{
|
||||
class XXY
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
class PossibleSolution
|
||||
{
|
||||
public:
|
||||
virtual void mutate()=0;
|
||||
virtual PossibleSolution& combine(const PossibleSolution &s)=0;
|
||||
virtual double getFitness()=0;
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
template <typename _T>
|
||||
class Genetics
|
||||
{
|
||||
public:
|
||||
XXY getSolution(_T);
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
61
src/Network
61
src/Network
@@ -1,61 +0,0 @@
|
||||
#ifndef _NN_H_
|
||||
#define _NN_H_
|
||||
|
||||
#include "Problem"
|
||||
#include "Solution"
|
||||
#include "Neuron"
|
||||
#include <cstdarg>
|
||||
#include <vector>
|
||||
|
||||
namespace S
|
||||
{
|
||||
class Network
|
||||
{
|
||||
public:
|
||||
virtual Solution solve(const S::Problem&)=0;
|
||||
virtual void learn(const S::Problem & p, const S::Solution &s)=0;
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
|
||||
class ACyclicNetwork : public Network
|
||||
{
|
||||
public:
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
|
||||
class Layer
|
||||
{
|
||||
public:
|
||||
Layer(int a);
|
||||
~Layer();
|
||||
Solution solve(const std::vector<bool> &input);
|
||||
Neuron* operator[](int neuron) const;
|
||||
int size() const {return neurons.size();};
|
||||
protected:
|
||||
std::vector<Neuron*> neurons;
|
||||
};
|
||||
|
||||
// template <typename _NT>
|
||||
class FeedForwardNetwork : public ACyclicNetwork
|
||||
{
|
||||
public:
|
||||
|
||||
template<typename... Args>inline FeedForwardNetwork(Args &&... args) {pass((addLayer(args),1)...);};
|
||||
//inline FeedForwardNetwork(std::vector<int> q);
|
||||
~FeedForwardNetwork();
|
||||
virtual Solution solve(const S::Problem& p) override;
|
||||
virtual void learn(const S::Problem & p, const S::Solution &s) override;
|
||||
const Layer* operator[](int layer);
|
||||
protected:
|
||||
template<typename... Args> inline void pass(Args&&...) {};
|
||||
void addLayer(int neurons);
|
||||
private:
|
||||
Layer* first;
|
||||
Layer* last ;
|
||||
std::vector<Layer*> layers;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
1
src/Network
Symbolic link
1
src/Network
Symbolic link
@@ -0,0 +1 @@
|
||||
././Network.h
|
||||
@@ -1 +0,0 @@
|
||||
./Network
|
||||
61
src/Network.h
Normal file
61
src/Network.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#ifndef _NN_H_
|
||||
#define _NN_H_
|
||||
|
||||
#include "Problem"
|
||||
#include "Solution"
|
||||
#include "Neuron"
|
||||
#include <cstdarg>
|
||||
#include <vector>
|
||||
|
||||
namespace S
|
||||
{
|
||||
class Network
|
||||
{
|
||||
public:
|
||||
virtual Solution solve(const S::Problem&)=0;
|
||||
virtual void learn(const S::Problem & p, const S::Solution &s)=0;
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
|
||||
class ACyclicNetwork : public Network
|
||||
{
|
||||
public:
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
|
||||
class Layer
|
||||
{
|
||||
public:
|
||||
Layer(int a);
|
||||
~Layer();
|
||||
Solution solve(const std::vector<bool> &input);
|
||||
Neuron* operator[](int neuron) const;
|
||||
int size() const {return neurons.size();};
|
||||
protected:
|
||||
std::vector<Neuron*> neurons;
|
||||
};
|
||||
|
||||
// template <typename _NT>
|
||||
class FeedForwardNetwork : public ACyclicNetwork
|
||||
{
|
||||
public:
|
||||
|
||||
template<typename... Args>inline FeedForwardNetwork(Args &&... args) {pass((addLayer(args),1)...);};
|
||||
//inline FeedForwardNetwork(std::vector<int> q);
|
||||
~FeedForwardNetwork();
|
||||
virtual Solution solve(const S::Problem& p) override;
|
||||
virtual void learn(const S::Problem & p, const S::Solution &s) override;
|
||||
const Layer* operator[](int layer);
|
||||
protected:
|
||||
template<typename... Args> inline void pass(Args&&...) {};
|
||||
void addLayer(int neurons);
|
||||
private:
|
||||
Layer* first;
|
||||
Layer* last ;
|
||||
std::vector<Layer*> layers;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
25
src/Neuron
25
src/Neuron
@@ -1,25 +0,0 @@
|
||||
#ifndef _NEURON_H_
|
||||
#define _NEURON_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace S{
|
||||
class Neuron
|
||||
{
|
||||
public:
|
||||
Neuron();
|
||||
double getPotential() const;
|
||||
void setPotential(double p);
|
||||
double getWeight(unsigned int) const;
|
||||
void setWeight(unsigned int i,double p);
|
||||
bool activates(const std::vector<bool>);
|
||||
protected:
|
||||
double potential;
|
||||
private:
|
||||
std::vector<double> weights;
|
||||
};
|
||||
class SimpleNeuron: public Neuron
|
||||
{
|
||||
};
|
||||
}
|
||||
#endif
|
||||
1
src/Neuron
Symbolic link
1
src/Neuron
Symbolic link
@@ -0,0 +1 @@
|
||||
././Neuron.h
|
||||
@@ -1 +0,0 @@
|
||||
./Neuron
|
||||
25
src/Neuron.h
Normal file
25
src/Neuron.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef _NEURON_H_
|
||||
#define _NEURON_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace S{
|
||||
class Neuron
|
||||
{
|
||||
public:
|
||||
Neuron();
|
||||
double getPotential() const;
|
||||
void setPotential(double p);
|
||||
double getWeight(unsigned int) const;
|
||||
void setWeight(unsigned int i,double p);
|
||||
bool activates(const std::vector<bool>);
|
||||
protected:
|
||||
double potential;
|
||||
private:
|
||||
std::vector<double> weights;
|
||||
};
|
||||
class SimpleNeuron: public Neuron
|
||||
{
|
||||
};
|
||||
}
|
||||
#endif
|
||||
19
src/Problem
19
src/Problem
@@ -1,19 +0,0 @@
|
||||
#ifndef _P_H_
|
||||
#define _P_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace S
|
||||
{
|
||||
class Problem
|
||||
{
|
||||
public:
|
||||
Problem();
|
||||
operator std::vector<bool>() const;
|
||||
protected:
|
||||
virtual std::vector<bool> representation() const =0;
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
1
src/Problem
Symbolic link
1
src/Problem
Symbolic link
@@ -0,0 +1 @@
|
||||
././Problem.h
|
||||
@@ -1 +0,0 @@
|
||||
./Problem
|
||||
19
src/Problem.h
Normal file
19
src/Problem.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef _P_H_
|
||||
#define _P_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace S
|
||||
{
|
||||
class Problem
|
||||
{
|
||||
public:
|
||||
Problem();
|
||||
operator std::vector<bool>() const;
|
||||
protected:
|
||||
virtual std::vector<bool> representation() const =0;
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
21
src/Solution
21
src/Solution
@@ -1,21 +0,0 @@
|
||||
#ifndef _SOL_H_
|
||||
#define _SOL_H_
|
||||
|
||||
#include <vector>
|
||||
#include "Problem"
|
||||
|
||||
namespace S
|
||||
{
|
||||
class Solution
|
||||
{
|
||||
public:
|
||||
Solution(std::vector<bool> solution);
|
||||
int size();
|
||||
bool operator[] (int pos);
|
||||
operator std::vector<bool>();
|
||||
protected:
|
||||
std::vector<bool> solution;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
1
src/Solution
Symbolic link
1
src/Solution
Symbolic link
@@ -0,0 +1 @@
|
||||
././Solution.h
|
||||
@@ -1 +0,0 @@
|
||||
./Solution
|
||||
21
src/Solution.h
Normal file
21
src/Solution.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _SOL_H_
|
||||
#define _SOL_H_
|
||||
|
||||
#include <vector>
|
||||
#include "Problem"
|
||||
|
||||
namespace S
|
||||
{
|
||||
class Solution
|
||||
{
|
||||
public:
|
||||
Solution(std::vector<bool> solution);
|
||||
int size();
|
||||
bool operator[] (int pos);
|
||||
operator std::vector<bool>();
|
||||
protected:
|
||||
std::vector<bool> solution;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user