x0 = matrix(-lmbda[0]+1.0, (n,1)) s0 = +w s0[::n+1] += x0 # Initial feasible z is identity. z0 = matrix(0.0, (n,n)) z0[::n+1] = 1.0 dims = {'l': 0, 'q': [], 's': [n]} sol = solvers.conelp(c, Fs, w[:], dims, kktsolver = Fkkt, primalstart = {'x': x0, 's': s0[:]}, dualstart = {'z': z0[:]}) return sol['x'], matrix(sol['z'], (n,n)) n = 10 w = normal(n,n) run_go = True if len(sys.argv[1:]) > 0: if sys.argv[1] == "-sp": helpers.sp_reset("./sp.data") helpers.sp_activate() run_go = False x, z = mcsdp(w) if run_go: print "\n *** running GO test ***" helpers.run_go_test("../testmcsdp", {'x': x, 'z': z, 'data': w}) else: print "w ", helpers.strSpe(w, "%.17f") #print "x=\n", helpers.strSpe(x, "%.17f") #print "z=\n", helpers.strSpe(z, "%.17f")
b = matrix([ 1.5, .0, -1.2, -.7, .0]) m, n = A.size I = matrix(0.0, (n,n)) I[::n+1] = 1.0 G = matrix([-I, matrix(0.0, (1,n)), I]) h = matrix(n*[0.0] + [1.0] + n*[0.0]) dims = {'l': n, 'q': [n+1], 's': []} P = A.T*A q = -A.T*b #localcones.options.update(opts) #sol = localcones.coneqp(P, q, G, h, dims, kktsolver='chol') solvers.options.update(opts) sol = solvers.coneqp(P, q, G, h, dims) if sol['status'] == 'optimal': print "x=\n", helpers.strSpe(sol['x'], "%.5f") print "s=\n", helpers.strSpe(sol['s'], "%.5f") print "z=\n", helpers.strSpe(sol['z'], "%.5f") print "\n *** running GO test ***" helpers.run_go_test("../testconeqp", {'x': sol['x'], 's': sol['s'], 'z': sol['z']}) if len(sys.argv[1:]) > 0: if sys.argv[1] == "-sp": helpers.sp_reset("./sp.data") helpers.sp_activate() testqp({'maxiters': 20})