~swaits/differential-evolution

898adda122c394e891b6fec91e6a0e8b688af47d — swaits 17 years ago eedade5
added another activation function, plus minor cleanup
1 files changed, 4 insertions(+), 2 deletions(-)

M polyapprox.cpp
M polyapprox.cpp => polyapprox.cpp +4 -2
@@ 15,7 15,8 @@ double TargetFunction(double x)
	//return exp(-x*x);                               // gaussian
	//return tanh(x);                                 // tanh
	//return (2.0/(1.0+exp(-x))-1.0);                 // tanh approximation
	return (x<0.0 ? -1.0 : 1.0) * sqrt(abs(x));     // signed root
	//return (x<0.0 ? -1.0 : 1.0) * sqrt(abs(x));     // signed root
	return sin(x);                                  // sin
}




@@ 51,7 52,8 @@ class PolySearch: public DE::Engine<NUM_COEFFICIENTS>
				double actual = TargetFunction(i);

				// accumulate error^2
				error += (test-actual)*(test-actual);
				double e = test - actual;
				error += e * e;

				// inc test count (divisor to get from SE to MSE)
				test_count++;