SymbolicRegressionIntrepreter implements FitnessFunction, Stochastic { public void setProperties(Properties p) { this.range = new Range(p.getProperty(Constants.SR_RANGE), this.rng); this.x = new double[this.range.getDimensions()]; this.samples = this.range.getSamples(); this.calculateTarget(p.getProperty(Constants.SR_TARGET)); } SymbolicRegressionIntrepreter(); Range getRange(); void setRange(Range range); void calculateTarget(final String target); void setProperties(Properties p); RandomNumberGenerator getRNG(); void setRNG(RandomNumberGenerator m); void getFitness(final Individual ind); boolean canCache(); void setSamples(double[][] samples); void setX(double[] x);  }
@Test public void testSetProperties() { System.out.println("*SymbolicRegressionInterpreterTest: setProperties"); MersenneTwisterFast mft = new MersenneTwisterFast(0); MersenneTwisterFast mft2 = new MersenneTwisterFast(0); Properties p = new Properties(); instance = new SymbolicRegressionIntrepreter(); instance.setRNG(mft); p.setProperty("sr_range", "x0 eq [0:0.5:1]; x1 eq rnd(0,2,1)"); p.setProperty("sr_target", "+ x0 x1"); instance.setProperties(p); double s1 = mft2.nextDouble(); double s2 = mft2.nextDouble(); double[] expectedTargets = {(0+s1),(0.5+s2)}; double[][] expectedSamples = {{0,s1},{0.5,s2}}; JUnitHelper.checkMatrix(expectedSamples, instance.samples); JUnitHelper.checkArrays(expectedTargets, instance.calculated_target); }