Extreme cleanup, see src/obsolete for details

This commit is contained in:
mac 2000-08-10 14:18:34 +00:00
commit 6d8e3a6504
141 changed files with 3937 additions and 1815 deletions

View file

@ -1,175 +1,91 @@
//-----------------------------------------------------------------------------
// t-eofitness.cpp
// (c) GeNeura Team 1998
//-----------------------------------------------------------------------------
#include <time.h> // time
#include <stdlib.h> // srand, rand
#include <iostream> // cout
#include <eo> // eoFitness
#include <eoScalarFitness.h>
using namespace std;
//-----------------------------------------------------------------------------
class eoFloat: public eoFitness
template <class Fitness>
int test_fitness(Fitness a, Fitness b)
{
// srand(time(0));
public:
eoFloat(const float x) { fitness = x; }
eoFloat(const int x) { fitness = static_cast<float>(x); }
bool operator<(const eoFitness& other) const
{
const eoFloat& x = (const eoFloat&) other;
return fitness < x.fitness;
}
operator float() const
{
return fitness;
}
void printOn(ostream& os) const
{
os << fitness;
}
void readFrom(istream& is)
{
is >> fitness;
}
private:
float fitness;
};
//-----------------------------------------------------------------------------
int main()
{
srand(time(0));
eoFloat a = static_cast<float>(rand()) / RAND_MAX,
b = static_cast<float>(rand()) / RAND_MAX;
// Fitness a = aval; //static_cast<double>(rand()) / RAND_MAX;
// Fitness b = bval; //static_cast<double>(rand()) / RAND_MAX;
cout.precision(2);
unsigned repeat = 2;
while (repeat--)
{
cout << "------------------------------------------------------" << endl;
cout << "testing < ";
if (a < b)
cout << a << " < " << b << " is true" << endl;
else
cout << a << " < " << b << " is false" <<endl;
cout << "testing > ";
if (a > b)
cout << a << " > " << b << " is true" << endl;
else
cout << a << " > " << b << " is false" <<endl;
cout << "testing == ";
if (a == b)
cout << a << " == " << b << " is true" << endl;
else
cout << a << " == " << b << " is false" <<endl;
cout << "testing != ";
if (a != b)
cout << a << " != " << b << " is true" << endl;
else
cout << a << " != " << b << " is false" <<endl;
a = b;
}
return 1;
}
int main()
{
cout << "Testing minimizing fitness with 1 and 2" << endl;
cout << "------------------------------------------------------" << endl;
eoMinimizingFitness a = 1;
eoMinimizingFitness b = 2;
test_fitness(a, b);
cout << "Testing minimizing fitness with 2 and 1" << endl;
cout << "------------------------------------------------------" << endl;
test_fitness(b, a);
cout << "Testing maximizing fitness with 1 and 2" << endl;
cout << "------------------------------------------------------" << endl;
eoMaximizingFitness a1 = 1;
eoMaximizingFitness b1 = 2;
test_fitness(a1,b1);
cout << "Testing maximizing fitness with 2 and 1" << endl;
cout << "------------------------------------------------------" << endl;
test_fitness(b1,a1);
return 1;
}
//-----------------------------------------------------------------------------