Commit 15552c28 authored by Vedran Miletić's avatar Vedran Miletić

Use standard C++ types and remove RbtTypes.h

parent 8df97a59
......@@ -13,7 +13,7 @@
CPPUNIT_TEST_SUITE_REGISTRATION(OccupancyTest);
RbtDouble OccupancyTest::TINY = 1E-4;
double OccupancyTest::TINY = 1E-4;
void OccupancyTest::setUp() {
try {
......@@ -99,13 +99,13 @@ void OccupancyTest::testVdwSFSolventModes() {
}
void OccupancyTest::testFlexAtomFactoryReceptor() {
RbtInt expected[2][3] = {{2034, 10, 0}, {2044, 0, 0}};
int expected[2][3] = {{2034, 10, 0}, {2044, 0, 0}};
RbtModelPtr spReceptor = m_workSpace->GetReceptor();
RbtBool isTestOK = true;
bool isTestOK = true;
// Test two modes:
// mode 0 is as read from PRM file (flex OH/NH3+)
// mode 1 is fixed receptor
for (RbtInt mode = 0; mode < 2; ++mode) {
for (int mode = 0; mode < 2; ++mode) {
if (mode == 1) {
spReceptor->SetFlexData(NULL);
}
......@@ -113,9 +113,9 @@ void OccupancyTest::testFlexAtomFactoryReceptor() {
RbtAtomRList fixedAtomList = flexAtomFactory.GetFixedAtomList();
RbtAtomRList tetheredAtomList = flexAtomFactory.GetTetheredAtomList();
RbtAtomRList freeAtomList = flexAtomFactory.GetFreeAtomList();
RbtInt nFixed = fixedAtomList.size();
RbtInt nTethered = tetheredAtomList.size();
RbtInt nFree = freeAtomList.size();
int nFixed = fixedAtomList.size();
int nTethered = tetheredAtomList.size();
int nFree = freeAtomList.size();
// cout << "Receptor: #fixed = " << nFixed << "; #tethered = " << nTethered
// << "; #free = " << nFree << endl; for (RbtAtomRListConstIter iter =
// tetheredAtomList.begin(); iter != tetheredAtomList.end(); ++iter) {
......@@ -133,10 +133,9 @@ void OccupancyTest::testFlexAtomFactoryReceptor() {
void OccupancyTest::testFlexAtomFactorySolvent() {
// Expected sizes for fixed, tethered and free atom lists
// for each value of model flexibility mode
RbtInt expected[9][3] = {{3, 0, 0}, {0, 3, 0}, {0, 3, 0},
{0, 3, 0}, {0, 3, 0}, {0, 3, 0},
{0, 0, 3}, {0, 0, 3}, {0, 0, 3}};
RbtBool isTestOK = false;
int expected[9][3] = {{3, 0, 0}, {0, 3, 0}, {0, 3, 0}, {0, 3, 0}, {0, 3, 0},
{0, 3, 0}, {0, 0, 3}, {0, 0, 3}, {0, 0, 3}};
bool isTestOK = false;
RbtModelList solventList = m_workSpace->GetSolvent();
if (!solventList.empty()) {
RbtModelPtr solvent = solventList.front();
......@@ -148,10 +147,10 @@ void OccupancyTest::testFlexAtomFactorySolvent() {
void OccupancyTest::testFlexAtomFactoryLigand() {
// Expected sizes for fixed, tethered and free atom lists
// for each value of model flexibility mode
RbtInt expected[9][3] = {{0, 0, 44}, {0, 0, 44}, {0, 0, 44},
{0, 0, 44}, {0, 0, 44}, {0, 0, 44},
{0, 0, 44}, {0, 0, 44}, {0, 0, 44}};
RbtBool isTestOK = false;
int expected[9][3] = {{0, 0, 44}, {0, 0, 44}, {0, 0, 44},
{0, 0, 44}, {0, 0, 44}, {0, 0, 44},
{0, 0, 44}, {0, 0, 44}, {0, 0, 44}};
bool isTestOK = false;
RbtModelPtr spLigand = m_workSpace->GetLigand();
if (!spLigand.Null()) {
isTestOK = testFlexAtomFactory(spLigand, expected);
......@@ -159,39 +158,38 @@ void OccupancyTest::testFlexAtomFactoryLigand() {
CPPUNIT_ASSERT(isTestOK);
}
RbtDouble OccupancyTest::CompareScoresForDisabledAndNoSolvent() {
RbtDouble retVal = 0.0;
double OccupancyTest::CompareScoresForDisabledAndNoSolvent() {
double retVal = 0.0;
RbtBaseSF *pSF = m_workSpace->GetSF();
if (pSF) {
// A) No solvent present
m_workSpace->RemoveSolvent();
RbtDouble scoreNoSolvent = pSF->Score();
double scoreNoSolvent = pSF->Score();
// B) With disabled solvent present
for (RbtModelListIter iter = m_solventList.begin();
iter != m_solventList.end(); ++iter) {
(*iter)->SetOccupancy(0.0, 0.5);
}
m_workSpace->SetSolvent(m_solventList);
RbtDouble scoreDisabledSolvent = pSF->Score();
double scoreDisabledSolvent = pSF->Score();
// C) With enabled solvent present (not used at present)
for (RbtModelListIter iter = m_solventList.begin();
iter != m_solventList.end(); ++iter) {
(*iter)->SetOccupancy(1.0, 0.5);
}
m_workSpace->SetSolvent(m_solventList);
RbtDouble scoreEnabledSolvent = pSF->Score();
double scoreEnabledSolvent = pSF->Score();
retVal = fabs(scoreNoSolvent - scoreDisabledSolvent);
}
return retVal;
}
RbtBool OccupancyTest::testFlexAtomFactory(RbtModel *pModel,
RbtInt expected[9][3]) {
RbtBool retVal = true;
bool OccupancyTest::testFlexAtomFactory(RbtModel *pModel, int expected[9][3]) {
bool retVal = true;
if (pModel) {
RbtFlexData *pFlexData = pModel->GetFlexData();
RbtFlexAtomFactory flexAtomFactory;
for (RbtInt mode = 0; mode < 9; ++mode) {
for (int mode = 0; mode < 9; ++mode) {
RbtChromElement::eMode eTransMode = (RbtChromElement::eMode)(mode / 3);
RbtChromElement::eMode eRotMode = (RbtChromElement::eMode)(mode % 3);
std::string strTransMode = RbtChromElement::ModeToStr(eTransMode);
......@@ -203,9 +201,9 @@ RbtBool OccupancyTest::testFlexAtomFactory(RbtModel *pModel,
RbtAtomRList fixedAtomList = flexAtomFactory.GetFixedAtomList();
RbtAtomRList tetheredAtomList = flexAtomFactory.GetTetheredAtomList();
RbtAtomRList freeAtomList = flexAtomFactory.GetFreeAtomList();
RbtInt nFixed = fixedAtomList.size();
RbtInt nTethered = tetheredAtomList.size();
RbtInt nFree = freeAtomList.size();
int nFixed = fixedAtomList.size();
int nTethered = tetheredAtomList.size();
int nFree = freeAtomList.size();
// cout << endl << "Trans = " << strTransMode << ", Rot = " << strRotMode
// << endl; for (RbtAtomRListConstIter iter = fixedAtomList.begin(); iter
// != fixedAtomList.end(); ++iter) {
......@@ -226,13 +224,13 @@ RbtBool OccupancyTest::testFlexAtomFactory(RbtModel *pModel,
return retVal;
}
RbtDouble OccupancyTest::CompareScoresForSolventModes() {
RbtDouble retVal = 0.0;
RbtDouble lastScore = 0.0;
double OccupancyTest::CompareScoresForSolventModes() {
double retVal = 0.0;
double lastScore = 0.0;
RbtBaseSF *pSF = m_workSpace->GetSF();
if (pSF) {
RbtModelList solventList = m_workSpace->GetSolvent();
for (RbtInt mode = 0; mode < 9; ++mode) {
for (int mode = 0; mode < 9; ++mode) {
RbtChromElement::eMode eTransMode = (RbtChromElement::eMode)(mode / 3);
RbtChromElement::eMode eRotMode = (RbtChromElement::eMode)(mode % 3);
std::string strTransMode = RbtChromElement::ModeToStr(eTransMode);
......@@ -248,10 +246,10 @@ RbtDouble OccupancyTest::CompareScoresForSolventModes() {
}
m_workSpace->RemoveSolvent();
m_workSpace->SetSolvent(solventList);
RbtDouble score = pSF->Score();
double score = pSF->Score();
// cout << "mode = " << mode << "; score = " << score << endl;
if (mode > 0) {
RbtDouble diff = fabs(score - lastScore);
double diff = fabs(score - lastScore);
retVal = std::max(diff, retVal);
}
lastScore = score;
......
......@@ -31,7 +31,7 @@ class OccupancyTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE_END();
public:
static RbtDouble TINY;
static double TINY;
// TextFixture methods
void setUp();
void tearDown();
......@@ -55,9 +55,9 @@ public:
private:
// Helper functions
RbtDouble CompareScoresForDisabledAndNoSolvent();
RbtDouble CompareScoresForSolventModes();
RbtBool testFlexAtomFactory(RbtModel *pModel, RbtInt expected[9][3]);
double CompareScoresForDisabledAndNoSolvent();
double CompareScoresForSolventModes();
bool testFlexAtomFactory(RbtModel *pModel, int expected[9][3]);
RbtBiMolWorkSpacePtr m_workSpace;
RbtModelList m_solventList;
};
......
This diff is collapsed.
......@@ -69,7 +69,7 @@ class RbtChromTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE_END();
public:
static RbtDouble TINY;
static double TINY;
// TextFixture methods
void setUp();
void tearDown();
......@@ -79,18 +79,17 @@ public:
// rdock helper methods
// RMSD calculation between two coordinate lists
RbtDouble rmsd(const RbtCoordList &rc, const RbtCoordList &c);
double rmsd(const RbtCoordList &rc, const RbtCoordList &c);
// Measures the variation in chromosome vector values for repeated
// mutations or randomisations
void measureRandOrMutateDiff(RbtChromElement *chrom, RbtInt nTrials,
RbtBool bMutate, // true=mutate; false=randomise
RbtDouble &meanDiff, RbtDouble &minDiff,
RbtDouble &maxDiff);
void measureRandOrMutateDiff(RbtChromElement *chrom, int nTrials,
bool bMutate, // true=mutate; false=randomise
double &meanDiff, double &minDiff,
double &maxDiff);
// Measures the variation in chromosome vector values for repeated
// crossovers
void measureCrossoverDiff(RbtChromElement *chrom, RbtInt nTrials,
RbtDouble &meanDiff, RbtDouble &minDiff,
RbtDouble &maxDiff);
void measureCrossoverDiff(RbtChromElement *chrom, int nTrials,
double &meanDiff, double &minDiff, double &maxDiff);
// The unit tests
// 1) Does RbtChromFactory create a valid chromosome?
......
......@@ -34,8 +34,8 @@ void SearchTest::setUp() {
m_workSpace->SetLigand(prmFactory.CreateLigand(spMdlFileSource));
m_workSpace->SetSolvent(prmFactory.CreateSolvent());
// Combine the atom lists of receptor, ligand and solvent
RbtInt nModels = m_workSpace->GetNumModels();
for (RbtInt i = 0; i < nModels; i++) {
int nModels = m_workSpace->GetNumModels();
for (int i = 0; i < nModels; i++) {
RbtAtomList atomList = m_workSpace->GetModel(i)->GetAtomList();
std::copy(atomList.begin(), atomList.end(),
std::back_inserter(m_atomList));
......@@ -61,13 +61,13 @@ void SearchTest::tearDown() {
}
// RMSD calculation between two coordinate lists
RbtDouble SearchTest::rmsd(const RbtCoordList &rc, const RbtCoordList &c) {
RbtDouble retVal(0.0);
RbtInt nCoords = rc.size();
double SearchTest::rmsd(const RbtCoordList &rc, const RbtCoordList &c) {
double retVal(0.0);
int nCoords = rc.size();
if (c.size() != nCoords) {
retVal = 999.9;
} else {
for (RbtInt i = 0; i < nCoords; i++) {
for (int i = 0; i < nCoords; i++) {
retVal += Rbt::Length2(rc[i], c[i]);
}
retVal = sqrt(retVal / float(nCoords));
......@@ -98,7 +98,7 @@ void SearchTest::testGA() {
spTransformAgg->Add(pRandPop);
spTransformAgg->Add(pGA);
m_workSpace->SetTransform(spTransformAgg);
RbtBool isOK(true);
bool isOK(true);
try {
m_workSpace->Run();
} catch (RbtError &e) {
......@@ -120,7 +120,7 @@ void SearchTest::testSimplex() {
// spTransformAgg->Add(pRandPop);
spTransformAgg->Add(pSimplex);
m_workSpace->SetTransform(spTransformAgg);
RbtBool isOK(true);
bool isOK(true);
try {
m_workSpace->Run();
} catch (RbtError &e) {
......@@ -141,7 +141,7 @@ void SearchTest::testSimAnn() {
pSimAnn->SetParameter(RbtSimAnnTransform::_PARTITION_DIST, 0.0);
pSimAnn->SetParameter(RbtSimAnnTransform::_PARTITION_FREQ, 0);
m_workSpace->SetTransform(pSimAnn);
RbtBool isOK(true);
bool isOK(true);
try {
m_workSpace->Run();
} catch (RbtError &e) {
......@@ -161,9 +161,9 @@ void SearchTest::testRestart() {
pSimplex->SetParameter(RbtSimplexTransform::_STEP_SIZE, 1.0);
spTransformAgg->Add(pSimplex);
m_workSpace->SetTransform(spTransformAgg);
RbtBool isOK(true);
RbtDouble finalScore(0.0);
RbtDouble restartScore(0.0);
bool isOK(true);
double finalScore(0.0);
double restartScore(0.0);
try {
// create an output sink for the minimised ligand/solvent
RbtMolecularFileSinkPtr spMdlFileSink(
......
......@@ -39,7 +39,7 @@ public:
// rdock helper methods
// RMSD calculation between two coordinate lists
RbtDouble rmsd(const RbtCoordList &rc, const RbtCoordList &c);
double rmsd(const RbtCoordList &rc, const RbtCoordList &c);
// 1 Check that receptor, ligand and solvent models are loaded into workspace
// Should be 6 models in total (4 solvent)
......
......@@ -39,9 +39,9 @@ public:
//////////////////
virtual ~RbtCell() {}
RbtBool Evaluated() const { return evaluated; }
RbtBool Named() const { return (name != ""); }
RbtBool Constant() const { return constant; }
bool Evaluated() const { return evaluated; }
bool Named() const { return (name != ""); }
bool Constant() const { return constant; }
void Clear() {
if (!constant) {
evaluated = false;
......@@ -71,7 +71,7 @@ public:
}
private:
RbtBool evaluated, constant;
bool evaluated, constant;
std::string name;
RbtReturnType result;
// friend ostream& operator<<(ostream& s, const RbtCell &p);
......
......@@ -32,17 +32,17 @@ public:
// Destructor
//////////////////
virtual ~RbtCommand() {}
static RbtInt ntabs;
static RbtBool inside;
static int ntabs;
static bool inside;
protected:
///////////////////
// Constructors
///////////////////
RbtCommand() {} // Default constructor disabled
std::string tabs(RbtInt n) {
std::string tabs(int n) {
std::string st = "";
for (RbtInt i = 0; i < n; i++)
for (int i = 0; i < n; i++)
st += " ";
return st;
}
......
......@@ -26,7 +26,7 @@ public:
///////////////////
// Constructors
///////////////////
RbtGPChromosome(RbtInt, RbtInt, RbtInt, RbtInt, RbtInt, RbtInt);
RbtGPChromosome(int, int, int, int, int, int);
RbtGPChromosome(const RbtGPChromosome &);
///////////////////
......@@ -41,25 +41,25 @@ public:
const int &operator[](int idx) const { return chrom[idx]; }
int &operator[](int idx) { return chrom[idx]; }
RbtGPChromosome &operator=(const RbtGPChromosome &c);
RbtInt size() const { return chrom.size(); }
RbtCellPtr Cells(RbtInt idx) const { return (cells[idx]); }
void SetConstant(RbtReturnType, RbtInt);
void ResetConstant(RbtInt);
RbtInt GetStartingCell() { return (chrom[chrom.size() - 1]); }
RbtReturnType GetRCte(RbtInt ncell) { return cells[ncell]->GetResult(); }
RbtCommands GetCommand(RbtInt ncell) {
int size() const { return chrom.size(); }
RbtCellPtr Cells(int idx) const { return (cells[idx]); }
void SetConstant(RbtReturnType, int);
void ResetConstant(int);
int GetStartingCell() { return (chrom[chrom.size() - 1]); }
RbtReturnType GetRCte(int ncell) { return cells[ncell]->GetResult(); }
RbtCommands GetCommand(int ncell) {
if (ncell < nProgramInputs)
throw RbtError(_WHERE_, "This cell does not have a command");
RbtCommands comm(chrom[(nFunctionsInputs + 1) * (ncell - nProgramInputs) +
nFunctionsInputs]);
return comm;
}
RbtInt GetArgument(RbtInt ncell, RbtInt narg) {
int GetArgument(int ncell, int narg) {
if (ncell < nProgramInputs)
throw RbtError(_WHERE_, "This cell does not have arguments");
return (chrom[(nFunctionsInputs + 1) * (ncell - nProgramInputs) + narg]);
}
RbtBool IsProgramInput(RbtInt ncell) { return (ncell < nProgramInputs); }
bool IsProgramInput(int ncell) { return (ncell < nProgramInputs); }
private:
/////////////////////
......@@ -67,7 +67,7 @@ private:
/////////////////////
RbtIntList chrom;
RbtCellList cells;
RbtInt nProgramInputs, nFunctionsInputs, nProgramOutputs, nRows, nColumns;
int nProgramInputs, nFunctionsInputs, nProgramOutputs, nRows, nColumns;
};
// Useful typedefs
......
......@@ -30,13 +30,13 @@ public:
virtual ~RbtGPFFCHK1() { _RBTOBJECTCOUNTER_DESTR_(_CT); }
void ReadTables(istream &, RbtReturnTypeArray &, RbtReturnTypeArray &);
RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtDouble, RbtBool);
RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtBool);
double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, double, bool);
double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, bool);
private:
void CreateRandomCtes(RbtInt);
void CreateRandomCtes(int);
RbtDoubleList ctes;
RbtCellContextPtr contextp;
RbtGPFFCHK1(); // default constructor disabled
......
......@@ -27,13 +27,13 @@ public:
static std::string _CT;
void ReadTables(istream &, RbtReturnTypeArray &, RbtReturnTypeArray &);
RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtDouble, RbtBool);
RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtBool);
double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, double, bool);
double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, bool);
private:
void CreateRandomCtes(RbtInt);
void CreateRandomCtes(int);
RbtDoubleList ctes;
};
......
......@@ -27,10 +27,10 @@ public:
static std::string _CT;
void ReadTables(istream &);
RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtDouble, RbtBool);
RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtBool);
double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, double, bool);
double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, bool);
};
// Useful typedefs
......
......@@ -31,13 +31,13 @@ public:
virtual ~RbtGPFFHSP90() { _RBTOBJECTCOUNTER_DESTR_(_CT); }
void ReadTables(istream &, RbtReturnTypeArray &, RbtReturnTypeArray &);
RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtDouble, RbtBool);
RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtBool);
double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, double, bool);
double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, bool);
private:
void CreateRandomCtes(RbtInt);
void CreateRandomCtes(int);
RbtDoubleList ctes;
RbtCellContextPtr contextp;
RbtGPFFHSP90(); // default constructor disabled
......
......@@ -32,13 +32,13 @@ public:
virtual ~RbtGPFFSpike() { _RBTOBJECTCOUNTER_DESTR_(_CT); }
void ReadTables(istream &, RbtReturnTypeArray &, RbtReturnTypeArray &);
RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtDouble, RbtBool);
RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtBool);
double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, double, bool);
double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, bool);
private:
void CreateRandomCtes(RbtInt);
void CreateRandomCtes(int);
RbtDoubleList ctes;
RbtCellContextPtr contextp;
RbtGPFFSpike(); // default constructor disabled
......
......@@ -39,19 +39,18 @@ public:
virtual ~RbtGPFitnessFunction();
virtual void ReadTables(istream &, RbtReturnTypeArray &,
RbtReturnTypeArray &) = 0;
RbtDouble GetObjective() const;
RbtDouble GetFitness() const;
void SetFitness(RbtDouble);
virtual RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtDouble,
RbtBool) = 0;
virtual RbtDouble CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, RbtBool) = 0;
double GetObjective() const;
double GetFitness() const;
void SetFitness(double);
virtual double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, double, bool) = 0;
virtual double CalculateFitness(RbtGPGenomePtr, RbtReturnTypeArray &,
RbtReturnTypeArray &, bool) = 0;
protected:
RbtRand &m_rand;
RbtDouble objective; // raw score
RbtDouble fitness; // scaled score
double objective; // raw score
double fitness; // scaled score
RbtReturnTypeArray inputTable, SFTable;
private:
......
......@@ -37,20 +37,19 @@ public:
// Destructor
//////////////////
virtual ~RbtGPGenome();
static void SetStructure(RbtInt, RbtInt, RbtInt, RbtInt, RbtInt, RbtInt,
RbtInt, RbtInt);
static RbtInt GetNIP() { return npi; }
static void SetNIP(RbtInt n) { npi = n; }
static RbtInt GetNIF() { return nfi; }
static RbtInt GetNN() { return nn; }
static RbtInt GetNO() { return no; }
static RbtInt GetNSFI() { return nsfi; }
static void SetNSFI(RbtInt n) { nsfi = n; }
static void SetStructure(int, int, int, int, int, int, int, int);
static int GetNIP() { return npi; }
static void SetNIP(int n) { npi = n; }
static int GetNIF() { return nfi; }
static int GetNN() { return nn; }
static int GetNO() { return no; }
static int GetNSFI() { return nsfi; }
static void SetNSFI(int n) { nsfi = n; }
RbtGPChromosomePtr GetChrom() const { return (new RbtGPChromosome(*chrom)); }
void Initialise();
void Mutate(RbtDouble);
void SetFitness(RbtDouble f) { fitness = f; }
RbtDouble GetFitness() const { return fitness; }
void Mutate(double);
void SetFitness(double f) { fitness = f; }
double GetFitness() const { return fitness; }
void UniformCrossover(const RbtGPGenome &, const RbtGPGenome &);
void Crossover(RbtGPGenome &);
friend ostream &operator<<(ostream &s, const RbtGPGenome &p);
......@@ -58,12 +57,12 @@ public:
protected:
private:
void MutateGene(RbtInt);
void MutateGene(int);
static RbtInt npi, nfi, nsfi, no, nn, nf, nr, nc, l;
static int npi, nfi, nsfi, no, nn, nf, nr, nc, l;
// defines structures and constraints of each genome
RbtRand &m_rand;
RbtDouble fitness; // scaled score. For now same than score
double fitness; // scaled score. For now same than score
RbtGPChromosomePtr chrom; // list of integers that represent a chrom
};
......
......@@ -20,7 +20,6 @@
#include "RbtContainers.h"
#include "RbtGPChromosome.h"
#include "RbtGPTypes.h"
#include "RbtTypes.h"
class RbtGPParser {
public:
......@@ -28,7 +27,7 @@ public:
///////////////////
// Constructors
///////////////////
RbtGPParser(RbtInt, RbtInt, RbtInt, RbtInt);
RbtGPParser(int, int, int, int);
RbtGPParser(const RbtGPParser &);
///////////////////
......@@ -40,23 +39,23 @@ public:
ostream &Print(ostream &) const;
friend ostream &operator<<(ostream &s, const RbtGPParser &p);
RbtReturnTypeList Parse(RbtGPChromosomePtr, RbtReturnTypeList &);
std::string PrintParse(istream &, RbtGPChromosomePtr, RbtBool, RbtBool);
RbtBool IsConstantInt(RbtInt i)