yeah
This commit is contained in:
60
tests/nn-02.cpp
Normal file
60
tests/nn-02.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
#include "../src/NeuronNetwork/Network"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class X: public Shin::NeuronNetwork::Problem
|
||||
{
|
||||
protected:
|
||||
std::vector<bool> representation() const
|
||||
{
|
||||
return std::vector<bool>({1,1});
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
Shin::NeuronNetwork::FeedForwardNetwork n(2,4,2);
|
||||
if(n[1]->size() != 4)
|
||||
{
|
||||
std::cout << "ACtual size:" << n[0]->size();
|
||||
return 1;
|
||||
}
|
||||
n[2]->operator[](0)->setPotential(25);
|
||||
std::cout << "Potential: " << n[2]->operator[](0)->getPotential() << "\n";
|
||||
Shin::NeuronNetwork::Solution s =n.solve(X());
|
||||
if(s.size()!=2)
|
||||
{
|
||||
std::cout << "1";
|
||||
return 1;
|
||||
}
|
||||
if(s[0]!=0)
|
||||
{
|
||||
std::cout << "2";
|
||||
return 1;
|
||||
}
|
||||
if(s[1]!=1)
|
||||
{
|
||||
std::cout << "3";
|
||||
return 1;
|
||||
}
|
||||
|
||||
n[2]->operator[](0)->setWeight(0,26.0);
|
||||
s =n.solve(X());
|
||||
if(s.size()!=2)
|
||||
{
|
||||
std::cout << "a1";
|
||||
return 1;
|
||||
}
|
||||
if(s[0]!=1)
|
||||
{
|
||||
std::cout << "a2";
|
||||
return 1;
|
||||
}
|
||||
if(s[1]!=1)
|
||||
{
|
||||
std::cout << "a3";
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user