Add Error functions to mirror/inverse fitness logic

This commit is contained in:
Mike 2018-04-14 00:33:36 -07:00
parent 1d901ccc01
commit 5f0b8a4c13
2 changed files with 36 additions and 0 deletions

View File

@ -136,6 +136,34 @@ namespace BitEvolver
return this->fitness; return this->fitness;
} }
//
void Chromosome::ResetError()
{
//
this->ResetFitness();
}
//
void Chromosome::SetError(double e)
{
//
this->SetFitness(-e);
}
//
void Chromosome::AdjustError(double e)
{
//
this->AdjustFitness(-e);
}
//
double Chromosome::GetError()
{
//
return -this->GetFitness();
}
// //
string Chromosome::ToString() string Chromosome::ToString()
{ {

View File

@ -48,6 +48,14 @@ namespace BitEvolver
void AdjustFitness(double d); void AdjustFitness(double d);
double GetFitness(); double GetFitness();
/**
Error is just inverted fitness
*/
void ResetError();
void SetError(double e);
void AdjustError(double e);
double GetError();
// //
std::string ToString(); std::string ToString();