#include "ProblemDomain.h"
#include <limits>

const FloatType ProblemDomain::POSITIVE_INFINITY = std::numeric_limits<FloatType>::infinity();
const FloatType ProblemDomain::NEGATIVE_INFINITY = -std::numeric_limits<FloatType>::infinity();

ProblemDomain::TournamentReturn ProblemDomain::tournament ( AlleleType *individualLeft, AlleleType *individualRight ) const {
  FloatType fitnessLeft = getFitness( individualLeft );
  FloatType fitnessRight = getFitness( individualRight );
  if ( fitnessLeft < fitnessRight )
    return TournamentReturn( TournamentReturn::RIGHT, fitnessRight );
  else if ( fitnessLeft > fitnessRight )
    return TournamentReturn( TournamentReturn::LEFT, fitnessLeft );
  else
    return TournamentReturn( TournamentReturn::TIE, fitnessLeft );
}
