<commit_before>#ifndef CHROMOSOME_H
#define CHROMOSOME_H

#include <bitset>
#include <cstdint>
#include <cmath>
#include <numeric>

namespace GeneticAlgorithms {
  
  /**
   * A class which represents a complete chromosome for genetic algorithms
   *
   * A Chromosome is represented by a rank (given by a particular
   * objective function) and its gens combination (a bits vector).
   */
  template<std::size_t N>
  class Chromosome {
  public:
    typedef std::pair<Chromosome<N>, Chromosome<N> > Couple;
    
    Chromosome(std::bitset<N> gens,
               float rank=-std::numeric_limits<float>::infinity()) :
      _gens(gens), _rank(rank) {
    }

    Chromosome() : _rank(0.0f) {
    }
    
    bool operator[](const size_t i) const {
      return _gens[i];
    }

    size_t size() const {
      return _gens.size();
    }
  
    const float &rank() const {
      return _rank;
    }

    bool operator<(const Chromosome &other) const {<commit_msg>Minor performance improvement<commit_after>#ifndef CHROMOSOME_H
#define CHROMOSOME_H

#include <bitset>
#include <cstdint>
#include <cmath>
#include <numeric>

namespace GeneticAlgorithms {
  
  /**
   * A class which represents a complete chromosome for genetic algorithms
   *
   * A Chromosome is represented by a rank (given by a particular
   * objective function) and its gens combination (a bits vector).
   */
  template<std::size_t N>
  class Chromosome {
  public:
    typedef std::pair<Chromosome<N>, Chromosome<N> > Couple;
    
    Chromosome(const std::bitset<N> &gens,
               float rank=-std::numeric_limits<float>::infinity()) :
      _gens(gens), _rank(rank) {
    }

    Chromosome() : _rank(0.0f) {
    }
    
    bool operator[](const size_t i) const {
      return _gens[i];
    }

    size_t size() const {
      return _gens.size();
    }
  
    const float &rank() const {
      return _rank;
    }

    bool operator<(const Chromosome &other) const {
{'fraction_non_alphanumeric': 0.11271230056613485, 'fraction_numerical': 0.002058672156459084, 'mean_word_length': 2.9836065573770494, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6231761', 'n_tokens_mistral': 667, 'n_tokens_neox': 624, 'n_words': 171}