16#ifndef _RBT_GPCHROMOSOME_H
17#define _RBT_GPCHROMOSOME_H
19#include "rxdock/Commands.h"
20#include "rxdock/geneticprogram/Cell.h"
21#include "rxdock/geneticprogram/GPTypes.h"
25namespace geneticprogram {
29 static const std::string _CT;
42 std::ostream &Print(std::ostream &)
const;
43 friend std::ostream &operator<<(std::ostream &s,
const GPChromosome &p);
44 friend std::istream &operator>>(std::istream &s,
GPChromosome &p);
45 const int &operator[](
int idx)
const {
return chrom[idx]; }
46 int &operator[](
int idx) {
return chrom[idx]; }
48 int size()
const {
return chrom.size(); }
49 CellPtr Cells(
int idx)
const {
return (cells[idx]); }
50 void SetConstant(ReturnType,
int);
51 void ResetConstant(
int);
52 int GetStartingCell() {
return (chrom[chrom.size() - 1]); }
53 ReturnType GetRCte(
int ncell) {
return cells[ncell]->GetResult(); }
55 if (ncell < nProgramInputs)
56 throw Error(_WHERE_,
"This cell does not have a command");
57 Commands comm(chrom[(nFunctionsInputs + 1) * (ncell - nProgramInputs) +
61 int GetArgument(
int ncell,
int narg) {
62 if (ncell < nProgramInputs)
63 throw Error(_WHERE_,
"This cell does not have arguments");
64 return (chrom[(nFunctionsInputs + 1) * (ncell - nProgramInputs) + narg]);
66 bool IsProgramInput(
int ncell) {
return (ncell < nProgramInputs); }
72 std::vector<int> chrom;
74 int nProgramInputs, nFunctionsInputs, nProgramOutputs, nRows, nColumns;
80std::ostream &operator<<(std::ostream &s,
const GPChromosome &p);
81std::istream &operator>>(std::istream &s,
GPChromosome &p);
Definition SmartPointer.h:48
Definition GPChromosome.h:27