This commit is contained in:
2014-10-02 17:52:56 +02:00
commit 8c1b406259
23 changed files with 525 additions and 0 deletions

61
tests/02.cpp Normal file
View File

@@ -0,0 +1,61 @@
#include "../src/Network"
#include "../src/Problem"
#include <iostream>
class X: public S::Problem
{
protected:
std::vector<bool> representation() const
{
return std::vector<bool>({1,1});
}
};
int main()
{
S::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";
S::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;
}