-- numpy, pylab The pylab output will draw -- a set of points inside a circle defined by x0,y0,R0 -- the circle (x0,y0) with rad R0 -- the optimized circle with minimum R enclosing the points """ from mystic.models import circle, sparse_circle import pylab # generate training set & define cost function # CostFactory2 allows costfunction to reuse datapoints from training set x0, y0, R0 = [10., 20., 3] npts = 20 xy = sparse_circle(x0, y0, R0, npts) cost = sparse_circle.CostFactory2(xy) # function to find the 'support vectors' given R # SV in quotes because they are found by optimizing the primal, # as opposed to "directly" via the dual. def sv(data, xx,yy,rr): svl = [] for i in range(len(data)): x,y = data[i] if abs((xx-x)*(xx-x)+(yy-y)*(yy-y) - rr*rr) < 0.01: svl.append(i) return svl # DEsolver inputs MAX_GENERATIONS = 2000