コード例 #1
0
ファイル: testIP.py プロジェクト: edwintye/pygotools
blas.nrm2(hTemp1[-n::] - matrix(GTemp)[-n::,:] * solSOCP['x'][1::] )

blas.nrm2(hTemp[1::] - GTemp[1::,1::] * sol1['x'] )

# now an socp

print sol1['x']
print sol2['x']
print qpOut['x']
print solSOCP['x'][1::]
## sqp

xhat, output = sqp(rosen,
                   rosen_der,
                   x0=theta,
                   maxiter=100,
                   method='trust',
                   disp=5, full_output=True)

xhat, output = sqp(rosen,
                   rosen_der,
                   rosen_hess,
                   x0=theta,
                   maxiter=100,
                   method='trust',
                   disp=5, full_output=True)

xhat, output = sqp(rosen,
                   rosen_der,
                   rosen_hess,
                   x0=theta,
コード例 #2
0
                              jac=objFH.gradient,
                              hess=objFH.jtj,
                              bounds = numpy.array(boxBounds),
                              method = 'trust-ncg',
                              options = {'maxiter':1000},
                              callback=objFH.thetaCallBack)



from pygotools.convex import sqp, ip

boxBoundsArray = numpy.array(boxBounds)
lb = numpy.array([0.0,0.0,0.0])
ub = numpy.array([5.0,5.0,5.0])

xhat,qpOut = sqp(objFH.cost, objFH.gradient, hessian=objFH.jtj, x0=[0.5,0.5,0.5], lb=lb, ub=ub,disp=3,full_output=True)

xhat,qpOut = sqp(objFH.cost, objFH.gradient, hessian=None, x0=[0.5,0.5,0.5], lb=lb, ub=ub,disp=3,full_output=True)

xhat,output = ip(objFH.cost,
                 objFH.gradient,
                 hessian=objFH.jtj,
                 x0=[0.5,0.5,0.5],
                 lb=lb, ub=ub,
                 method='bar',
                 disp=3, full_output=True)

xhat,output = ip(objFH.cost, objFH.gradient, hessian=None, x0=[0.5,0.5,0.5], lb=lb, ub=ub,disp=3,full_output=True)

xhat,output = ipD(objFH.cost, objFH.gradient, hessian=objFH.jtj, x0=[0.5,0.5,0.5], lb=lb, ub=ub,disp=3,full_output=True)
コード例 #3
0
ファイル: testIP2.py プロジェクト: edwintye/pygotools
                method='exact',
                disp=3, full_output=True)


xhatA, outputA = trustRegion(objFH.cost, objFH.gradient, hessian='SR1',
                x0=theta,
                maxiter=100,
                method='exact',
                disp=3, full_output=True)



## sqp

xhat, output = sqp(objFH.cost,
                   objFH.gradient,
                   x0=theta,
                   disp=4, full_output=True)

xhat, output = sqp(objFH.cost,
                   objFH.gradient,
                   x0=theta,
                   lb=lb, ub=ub,
                   disp=4, full_output=True)

## interior point interface

xhat, output = ip(objFH.cost,
                  objFH.gradient,
                  x0=theta,
                  lb=None, ub=None,
                  G=None, h=None,