19#include "rxdock/ChromElement.h"
21#include <nlohmann/json.hpp>
23using json = nlohmann::json;
31 static const std::string _CT;
43 friend void to_json(json &j,
const Genome &genome);
44 friend void from_json(
const json &j,
Genome &genome);
54 void SetScore(
BaseSF *pSF);
56 double GetScore()
const {
return m_score; }
68 double SetRWFitness(
double sigmaOffset,
double partialSum);
72 void NormaliseRWFitness(
double total);
74 double GetRWFitness()
const {
return m_RWFitness; }
78 bool Equals(
const Genome &g,
double threshold)
const {
79 return m_chrom->Equals(*(g.m_chrom), threshold);
81 friend bool operator==(
const Genome &g1,
const Genome &g2) {
82 return g1.Equals(g2, ChromElement::_THRESHOLD);
85 void Print(std::ostream &)
const;
86 friend std::ostream &operator<<(std::ostream &s,
const Genome &g);
101void to_json(json &j,
const Genome &genome);
102void from_json(
const json &j,
Genome &genome);
106typedef std::vector<GenomePtr> GenomeList;
107typedef GenomeList::iterator GenomeListIter;
108typedef GenomeList::const_iterator GenomeListConstIter;
115 bool operator()(
const Genome *pG1,
const Genome *pG2)
const {
116 return (pG1->GetScore() > pG2->GetScore());
124class isGenome_eq :
public std::function<bool(Genome *, Genome *)> {
128 explicit isGenome_eq(
double threshold) : m_threshold(threshold) {}
129 bool operator()(
const Genome *pG1,
const Genome *pG2)
const {
130 return pG1->Equals(*pG2, m_threshold);
Definition ChromElement.h:36
Definition SmartPointer.h:48