diff --git a/Chromosome.cpp b/Chromosome.cpp index 0fde499..dc6c3c1 100644 --- a/Chromosome.cpp +++ b/Chromosome.cpp @@ -136,6 +136,34 @@ namespace BitEvolver 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() { diff --git a/Chromosome.h b/Chromosome.h index a403b68..99ad214 100644 --- a/Chromosome.h +++ b/Chromosome.h @@ -48,6 +48,14 @@ namespace BitEvolver void AdjustFitness(double d); double GetFitness(); + /** + Error is just inverted fitness + */ + void ResetError(); + void SetError(double e); + void AdjustError(double e); + double GetError(); + // std::string ToString();