def test_pdas(): 'Test function for pdas()' # Generate a random QP qp = randQP(size=100, numeq=1, numineq=1) pdas(qp.H, qp.c, qp.Aeq, qp.beq, qp.A, qp.bl, qp.bu, qp.l, qp.u, qp.x0) # Solve the random bound constrained QP pdas(qp.H, qp.c, l=qp.l, u=qp.u, x0=qp.x0)
def test_pdas(): 'Test function for pdas()' # Generate a random QP qp = randQP(size = 100, numeq = 1, numineq = 1) pdas(qp.H,qp.c,qp.Aeq,qp.beq,qp.A,qp.bl,qp.bu,qp.l,qp.u,qp.x0) # Solve the random bound constrained QP pdas(qp.H,qp.c,l=qp.l,u=qp.u,x0=qp.x0)
def test_pdas(): 'Test function of pdas' print 'testing function _test_pdas()\n' qp = randQP(100) pdas = PDAS(qp) #p = obs.printer(pdas) #pdas.register('printer',p) #c = obs.conditioner(pdas) #pdas.register('conditioner',c) #pdas.ssm() #pdas.newp() pdas2 = copy(pdas) pdas.exact_solve() pdas2.inexact_solve()
from prob import randQP, randBQP from pdas.pdas import PDAS from copy import copy # Generate a random sparse matrix with 3 rows, 4 columns, sparsity 0.8 mat = sp_rand(3, 4, 0.8) print(mat) # Generate a random positive definite matrix with 5 variables, # condition number 100, sparsity 0.5. Note: random Jocobi rotations # are applied. pdmat = sprandsym(size=5, cond=100, sp=0.5) print(pdmat) # Generate a random QP with 100 variables, 1 equality, 1 inequaity qp = randQP(size=100, numeq=1, numineq=1) # Generate a random bound constrained QP with 100 variables bqp = randBQP(size=100) # Another way to generate a random bound constrained QP with 100 variables bqp2 = randQP(size=100, numeq=0, numineq=0) # Solve the random bound constrained QP by PDAS with exact solve pdas = PDAS(bqp) print 'Solving random bound-constrained QP with exact subproblem solve:' pdas.exact_solve() # Solve the random bound constrained QP by PDAS with inexact solve # import pdb # pdb.set_trace()
from prob import randQP, randBQP from pdas.pdas import PDAS from copy import copy # Generate a random sparse matrix with 3 rows, 4 columns, sparsity 0.8 mat = sp_rand(3,4,0.8) print(mat) # Generate a random positive definite matrix with 5 variables, # condition number 100, sparsity 0.5. Note: random Jocobi rotations # are applied. pdmat = sprandsym(size=5,cond=100,sp=0.5) print(pdmat) # Generate a random QP with 100 variables, 1 equality, 1 inequaity qp = randQP(size = 100, numeq = 1, numineq = 1) # Generate a random bound constrained QP with 100 variables bqp = randBQP(size = 100) # Another way to generate a random bound constrained QP with 100 variables bqp2 = randQP(size = 100, numeq = 0, numineq = 0) # Solve the random bound constrained QP by PDAS with exact solve pdas = PDAS(bqp) print 'Solving random bound-constrained QP with exact subproblem solve:' pdas.exact_solve() # Solve the random bound constrained QP by PDAS with inexact solve # import pdb