openModeller  Version 1.4.0
test_rules_defs.hh
Go to the documentation of this file.
00001 
00032 template <class T>
00033 class ExtendedDummyRule : public T
00034 {
00035 public:
00036   ExtendedDummyRule(int numGenes = 0) : T (numGenes) { _prediction = 0.0; };
00037   ExtendedDummyRule(Scalar pred, int numGenes, 
00038         Sample& ch1, Sample& ch2, double * perf) :
00039     T(pred, numGenes, ch1, ch2, perf) {};
00040 
00041   GarpRule * objFactory() const  { return new ExtendedDummyRule(); }
00042   double * getPerformanceArray() { return _performance; }
00043   void setPrediction(Scalar newPrediction) { _prediction = newPrediction; }
00044 
00045   void setGenes(Scalar * genes, int numGenes)
00046   { 
00047     //printf("Setting %3d genes:\n", numGenes);
00048     //printf(" Genes   | chrom1   | chrom2\n", numGenes);
00049     _numGenes = numGenes; 
00050     if (genes) 
00051       { 
00052   Scalar values1[_numGenes]; 
00053   Scalar values2[_numGenes]; 
00054   for (int i = 0; i < _numGenes; i++) 
00055     { 
00056       values1[i] = genes[i * 2]; 
00057       values2[i] = genes[i * 2 + 1]; 
00058 
00059       //printf(" %-7.3f |  %-7.3f |        \n", genes[i * 2], values1[i]);
00060       //printf(" %-7.3f |          | %-7.3f \n", genes[i * 2 + 1], values2[i]);
00061     } 
00062   _chrom1 = Sample(_numGenes, values1); 
00063   _chrom2 = Sample(_numGenes, values2); 
00064       } 
00065     //printf("=====\n");
00066   }
00067 };