pylab.plot([center[0]], [center[1]], 'bo')
    pylab.plot([xy[sv[0], 0], center[0]], [xy[sv[0], 1], center[1]], 'b--')
    c = circle(x0, y0, R0)
    pylab.plot(c[:, 0], c[:, 1], 'r-', linewidth=2)
    c = circle(center[0], center[1], R)
    pylab.plot(c[:, 0], c[:, 1], 'b-', linewidth=2)
    pylab.axis('equal')
    pylab.show()


if __name__ == '__main__':
    npt = 20
    from test_circle import xy
    npt1 = xy.shape[0]
    if npt is not npt1:
        xy = sparse_circle(x0, y0, R0, npt)
    else:
        pass

    # define a QP problem for the objective
    Q = dot(xy, transpose(xy))
    f = -diag(Q) + 10
    H = Q * 2
    # define lower and upper bounds on x
    LB = zeros(npt)
    UB = ones(npt)
    # define equality constraints (A*x == b)
    A = ones((1, npt))
    b = ones(1)

    #   # generic: build a constraint where (A*x == b)
Esempio n. 2
0
    pylab.plot([center[0]],[center[1]],'bo')
    pylab.plot([xy[sv[0],0], center[0]],[xy[sv[0],1], center[1]],'b--')
    c = circle(x0,y0,R0)
    pylab.plot(c[:,0], c[:,1], 'r-', linewidth=2)
    c = circle(center[0],center[1],R)
    pylab.plot(c[:,0], c[:,1], 'b-', linewidth=2)
    pylab.axis('equal')
    pylab.show()


if __name__ == '__main__':
    npt = 20
    from test_circle import xy
    npt1 = xy.shape[0]
    if npt is not npt1:
        xy = sparse_circle(x0,y0,R0,npt)
    else:
        pass

    # define a QP problem for the objective
    Q = dot(xy, transpose(xy))
    f = -diag(Q)+10
    H = Q*2
    # define lower and upper bounds on x
    LB = zeros(npt)
    UB = ones(npt)
    # define equality constraints (A*x == b)
    A = ones((1,npt))
    b = ones(1)

#   # generic: build a constraint where (A*x == b)