Exemplo n.º 1
0
	return jprod(x,w)

# end def 

# =============================================================================
# Main program
# =============================================================================

n = 5
x0 = 3*numpy.ones(n,'d')
pi0 = numpy.zeros(n,'d')
Lvar = 1.e-4*numpy.ones(n,'d')
Ucon = numpy.ones(n,'d')

testmodel = NLPModel(n=n,m=n,name='Scalable Test 1',x0=x0,Lvar=Lvar,Ucon=Ucon)
testmodel.obj = obj
testmodel.cons = cons
testmodel.grad = grad
testmodel.jac = jac

testMFmodel = MFModel(n=n,m=n,name='Matrix-Free Scalable Test 1',x0=x0,
	Lvar=Lvar,Ucon=Ucon)
testMFmodel.obj = obj
testMFmodel.cons = cons
testMFmodel.grad = grad
testMFmodel.jprod = jprod
testMFmodel.jtprod = jtprod

# Test vectors for checking Jacobian vector product
vec1 = numpy.ones(n)
vec2 = numpy.arange(n,dtype='d')