From: dissertation of Townsend, Eq. 5.15, modified version of Eq. 5.14 http://pi.math.cornell.edu/~ajt/papers/thesis.pdf pp. 105
Global Minimum: -3.398166873463248
The function has 9,318 different local minima according to Townsend
Note: In the runs below, you should be able to yield the exact global minimum, but in general, because a stochastic optimization method is being used, you will usually get close to, but not exactly to, the global minimum. You may want to play with the control parameters of the optimization.
from numpy import exp, sin
import PyCEGO
def HundredDigitPlus(c):
x, y = c
if isinstance(x, PyCEGO.Numberish):
x = x.as_double()
y = y.as_double()
return 0.25*x**2 + exp(sin(100*x))+ sin(140*sin(x)) + 0.25*y**2 + sin(120*exp(y)) +sin(sin(160*y))-sin(20*(x+y))
D = 2
Nlayers = 3
layers = PyCEGO.NumberishLayers(HundredDigitPlus, D, D*30, Nlayers, 3)
layers.set_bounds([PyCEGO.Bound(-1.0, 1.0) for _ in range(D)])
layers.set_builtin_evolver(PyCEGO.BuiltinEvolvers.differential_evolution)
VTR = -4 # Value to reach as acceptable optimization run
for counter in range(1000):
layers.do_generation()
cost, coeffs = layers.get_best()
if counter % 50 == 0:
print(layers.print_diagnostics())
if cost < VTR:
break
print('final', cost)
print('deviation to global minimum', cost-(-3.398166873463248))
i: 0 best: -2.22316 c: -0.637227, 0.078973, queue: 0 i: 50 best: -3.04526 c: 0.167675, 0.853562, queue: 0 i: 100 best: -3.34623 c: 0.168343, 0.539182, queue: 0 i: 150 best: -3.34623 c: 0.168343, 0.539182, queue: 0 i: 200 best: -3.34623 c: 0.168343, 0.539182, queue: 0 i: 250 best: -3.34623 c: 0.168343, 0.539182, queue: 0 i: 300 best: -3.34623 c: 0.168343, 0.539182, queue: 0 i: 350 best: -3.36946 c: 0.169955, -0.401414, queue: 0 i: 400 best: -3.39264 c: 0.170340, -0.403245, queue: 0 i: 450 best: -3.39816 c: 0.169688, -0.403071, queue: 0 i: 500 best: -3.39817 c: 0.169675, -0.403046, queue: 0 i: 550 best: -3.39817 c: 0.169674, -0.403046, queue: 0 i: 600 best: -3.39817 c: 0.169674, -0.403046, queue: 0 i: 650 best: -3.39817 c: 0.169674, -0.403046, queue: 0 i: 700 best: -3.39817 c: 0.169674, -0.403046, queue: 0 i: 750 best: -3.39817 c: 0.169674, -0.403046, queue: 0 i: 800 best: -3.39817 c: 0.169674, -0.403046, queue: 0 i: 850 best: -3.39817 c: 0.169674, -0.403046, queue: 0 i: 900 best: -3.39817 c: 0.169674, -0.403046, queue: 0 i: 950 best: -3.39817 c: 0.169674, -0.403046, queue: 0 final -3.398166873463249 deviation to global minimum -8.881784197001252e-16