RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
GPGenome.h
1/***********************************************************************
2 * The rDock program was developed from 1998 - 2006 by the software team
3 * at RiboTargets (subsequently Vernalis (R&D) Ltd).
4 * In 2006, the software was licensed to the University of York for
5 * maintenance and distribution.
6 * In 2012, Vernalis and the University of York agreed to release the
7 * program as Open Source software.
8 * This version is licensed under GNU-LGPL version 3.0 with support from
9 * the University of Barcelona.
10 * http://rdock.sourceforge.net/
11 ***********************************************************************/
12
13// GPGenome Class. GPGenome represents a genome in the CGP
14
15#ifndef _RBT_GPGENOME_H_
16#define _RBT_GPGENOME_H_
17
18#include "rxdock/Rand.h"
19#include "rxdock/geneticprogram/GPChromosome.h"
20#include "rxdock/geneticprogram/GPTypes.h"
21// #include <cmath>
22
23namespace rxdock {
24
25namespace geneticprogram {
26
27class GPGenome {
28public:
29 static const std::string _CT;
31 // Constructors
33 GPGenome();
34 GPGenome(const GPGenome &);
35 GPGenome(std::string);
36 GPGenome(std::istream &);
37
38 GPGenome &operator=(const GPGenome &);
39
41 // Destructor
43 virtual ~GPGenome();
44 static void SetStructure(int, int, int, int, int, int, int, int);
45 static int GetNIP() { return npi; }
46 static void SetNIP(int n) { npi = n; }
47 static int GetNIF() { return nfi; }
48 static int GetNN() { return nn; }
49 static int GetNO() { return no; }
50 static int GetNSFI() { return nsfi; }
51 static void SetNSFI(int n) { nsfi = n; }
52 GPChromosomePtr GetChrom() const { return (new GPChromosome(*chrom)); }
53 void Initialise();
54 void Mutate(double);
55 void SetFitness(double f) { fitness = f; }
56 double GetFitness() const { return fitness; }
57 void UniformCrossover(const GPGenome &, const GPGenome &);
58 void Crossover(GPGenome &);
59 friend std::ostream &operator<<(std::ostream &s, const GPGenome &p);
60 std::ostream &Print(std::ostream &) const;
61
62protected:
63private:
64 void MutateGene(int);
65
66 static int npi, nfi, nsfi, no, nn, nf, nr, nc, l;
67 // defines structures and constraints of each genome
68 Rand &m_rand;
69 double fitness; // scaled score. For now same than score
70 GPChromosomePtr chrom; // list of integers that represent a chrom
71};
72
73// Useful typedefs
74typedef SmartPtr<GPGenome> GPGenomePtr; // Smart pointer
75typedef std::vector<GPGenomePtr> GPGenomeList; // Vector of smart pointers
76typedef GPGenomeList::iterator GPGenomeListIter;
77typedef GPGenomeList::const_iterator GPGenomeListConstIter;
78
79std::ostream &operator<<(std::ostream &s, const GPGenome &p);
80
81} // namespace geneticprogram
82
83} // namespace rxdock
84
85#endif //_GPGenome_H_
Definition Rand.h:32
Definition GPChromosome.h:27
Definition GPGenome.h:27