File: taopython_protocol.py

package info (click to toggle)
petsc4py 3.24.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,612 kB
  • sloc: python: 13,569; ansic: 1,768; makefile: 345; f90: 313; sh: 14
file content (40 lines) | stat: -rw-r--r-- 981 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from petsc4py.PETSc import TAO
from petsc4py.PETSc import Vec
from petsc4py.PETSc import Viewer


# A template class with the Python methods supported by TAOPYTHON


class TAOPythonProtocol:
    def setFromOptions(self, tao: TAO):
        """Parse the command line options."""
        ...

    def setUp(self, tao: TAO):
        """Set up the optimizer."""
        ...

    def solve(self, tao):
        """Solve the optimisation problem.

        Note:
            Do not override if you want to rely on the default solve routine, using step, preStep and postStep.
        """
        ...

    def step(self, tao: TAO, x: Vec, g: Vec, s: Vec):
        """Given current iterate x compute gradient g and step s."""
        ...

    def preStep(self, tao: TAO):
        """Invoked before step."""
        ...

    def postStep(self, tao: TAO):
        """Invoked after step."""
        ...

    def view(self, tao: TAO, viewer: Viewer):
        """View the optimizer."""
        ...