Lines Matching refs:tao

11     def __call__(self, tao, x):  argument
16 def __call__(self, tao, x, g): argument
23 def __call__(self, tao, x, c): argument
29 def __call__(self, tao, x, J, P): argument
38 def __call__(self, tao, x, c): argument
44 def __call__(self, tao, x, J, P): argument
56 self.tao = PETSc.TAO().create(comm=self.COMM)
59 self.tao = None
63 tao = self.tao
67 tao.setObjective(objective)
68 tao.setGradient(gradient, None)
69 tao.setVariableBounds(varbounds)
70 tao.setObjectiveGradient(objgrad, None)
71 tao.setConstraints(constraint)
72 tao.setHessian(hessian)
73 tao.setJacobian(jacobian)
76 tao = self.tao
77 x = tao.getSolution()
78 (g, _) = tao.getGradient()
79 low, up = tao.getVariableBounds()
97 ksp = self.tao.getKSP()
101 if self.tao.getComm().Get_size() > 1:
103 tao = self.tao
105 x = PETSc.Vec().create(tao.getComm())
108 c = PETSc.Vec().create(tao.getComm())
111 J = PETSc.Mat().create(tao.getComm())
116 tao.setObjective(Objective())
117 tao.setGradient(Gradient(), None)
118 tao.setEqualityConstraints(EqConstraints(), c)
119 tao.setJacobianEquality(EqJacobian(), J, J)
120 tao.setSolution(x)
121 tao.setType(PETSc.TAO.Type.ALMM)
122 tao.setALMMType(PETSc.TAO.ALMMType.PHR)
123 tao.setTolerances(gatol=1.0e-4)
124 tao.setFromOptions()
125 tao.solve()
126 self.assertTrue(tao.getALMMType() == PETSc.TAO.ALMMType.PHR)
130 self.assertTrue(tao.getObjective() is not None)
132 c, g = tao.getEqualityConstraints()
134 g[0](tao, x, c_eval, *g[1], **g[2])
137 J, Jpre, Jg = tao.getJacobianEquality()
138 Jg[0](tao, x, J, Jpre, *Jg[1], **Jg[2])
142 if self.tao.getComm().Get_size() > 1:
144 tao = self.tao
146 x = PETSc.Vec().create(tao.getComm())
149 c = PETSc.Vec().create(tao.getComm())
152 J = PETSc.Mat().create(tao.getComm())
157 tao.setObjective(Objective())
158 tao.setGradient(Gradient(), None)
159 tao.setInequalityConstraints(InEqConstraints(), c)
160 tao.setJacobianInequality(InEqJacobian(), J, J)
161 tao.setSolution(x)
162 tao.setType(PETSc.TAO.Type.ALMM)
163 tao.setALMMType(PETSc.TAO.ALMMType.CLASSIC)
164 tao.setTolerances(gatol=1.0e-4)
165 tao.setFromOptions()
166 tao.solve()
168 self.assertTrue(tao.getALMMType() == PETSc.TAO.ALMMType.CLASSIC)
173 c, h = tao.getInequalityConstraints()
175 h[0](tao, x, c_eval, *h[1], **h[2])
178 J, Jpre, Jh = tao.getJacobianInequality()
179 Jh[0](tao, x, J, Jpre, *Jh[1], **Jh[2])
183 if self.tao.getComm().Get_size() > 1:
185 tao = self.tao
187 x = PETSc.Vec().create(tao.getComm())
190 xl = PETSc.Vec().create(tao.getComm())
194 xu = PETSc.Vec().create(tao.getComm())
198 tao.setVariableBounds((xl, xu))
199 tao.setObjective(Objective())
200 tao.setGradient(Gradient(), None)
201 tao.setSolution(x)
202 tao.setType(PETSc.TAO.Type.BNCG)
203 tao.setTolerances(gatol=1.0e-4)
204 ls = tao.getLineSearch()
206 tao.setFromOptions()
207 tao.solve()
212 if self.tao.getComm().Get_size() > 1:
214 tao = self.tao
216 x = PETSc.Vec().create(tao.getComm())
219 xl = PETSc.Vec().create(tao.getComm())
223 xu = PETSc.Vec().create(tao.getComm())
227 tao.setVariableBounds((xl, xu))
228 tao.setObjective(Objective())
229 tao.setGradient(Gradient(), None)
230 tao.setSolution(x)
231 tao.setType(PETSc.TAO.Type.BQNLS)
232 tao.setTolerances(gatol=1.0e-4)
236 H.createDense((2, 2), comm=tao.getComm())
251 tao.getLMVMMat().setLMVMJ0(H)
253 lmvm_ksp = PETSc.KSP().create(tao.getComm())
256 tao.getLMVMMat().setLMVMJ0KSP(lmvm_ksp)
258 tao.setFromOptions()
259 tao.solve()
261 self.assertEqual(tao.getIterationNumber(), 1)
266 self.assertTrue(tao.getLMVMMat().getLMVMJ0().equal(H))
269 tao.getLMVMMat().getLMVMJ0KSP().getType() == PETSc.KSP.Type.CG