openModeller  Version 1.5.0
test_rules_defs.hh
Go to the documentation of this file.
1 
32 template <class T>
33 class ExtendedDummyRule : public T
34 {
35 public:
36  ExtendedDummyRule(int numGenes = 0) : T (numGenes) { _prediction = 0.0; };
37  ExtendedDummyRule(Scalar pred, int numGenes,
38  Sample& ch1, Sample& ch2, double * perf) :
39  T(pred, numGenes, ch1, ch2, perf) {};
40 
41  GarpRule * objFactory() const { return new ExtendedDummyRule(); }
42  double * getPerformanceArray() { return _performance; }
43  void setPrediction(Scalar newPrediction) { _prediction = newPrediction; }
44 
45  void setGenes(Scalar * genes, int numGenes)
46  {
47  //printf("Setting %3d genes:\n", numGenes);
48  //printf(" Genes | chrom1 | chrom2\n", numGenes);
49  _numGenes = numGenes;
50  if (genes)
51  {
52  Scalar values1[_numGenes];
53  Scalar values2[_numGenes];
54  for (int i = 0; i < _numGenes; i++)
55  {
56  values1[i] = genes[i * 2];
57  values2[i] = genes[i * 2 + 1];
58 
59  //printf(" %-7.3f | %-7.3f | \n", genes[i * 2], values1[i]);
60  //printf(" %-7.3f | | %-7.3f \n", genes[i * 2 + 1], values2[i]);
61  }
62  _chrom1 = Sample(_numGenes, values1);
63  _chrom2 = Sample(_numGenes, values2);
64  }
65  //printf("=====\n");
66  }
67 };
void setPrediction(Scalar newPrediction)
double Scalar
Type of map values.
Definition: om_defs.hh:39
ExtendedDummyRule(Scalar pred, int numGenes, Sample &ch1, Sample &ch2, double *perf)
double * getPerformanceArray()
GarpRule * objFactory() const
void setGenes(Scalar *genes, int numGenes)
Definition: Rule.h:116
ExtendedDummyRule(int numGenes=0)
Definition: Sample.hh:25