TAO (as a component of the PETSc distribution) comes with a number of example programs to help demonstrate how to solve optimization problems with the TAO algorithms. These examples can be found in
WHAT THIS EXAMPLE DEMONSTRATES
FURTHER DETAILS:
DO THE FOLLOWING:
cd petsc/src/tao/unconstrained/examples/tutorials make rosenbrock1
mpiexec -n 1 ./rosenbrock1 -tao_monitor -tao_view [Expected output]
mpiexec -n 1 ./rosenbrock1 -tao_monitor -tao_view -tao_type nls [Expected output]
Notice in the output that (as should be expected) the derivative-free method (nm) takes many more iterations than methods that use derivatives, and that using finite differences has little affect on the iteration count but a large affect on the number of function evaluations.
mpiexec -n 1 ./rosenbrock1 -tao_monitor -tao_view -tao_type nm [Expected output] mpiexec -n 1 ./rosenbrock1 -tao_monitor -tao_view -tao_type cg [Expected output] mpiexec -n 1 ./rosenbrock1 -tao_monitor -tao_view -tao_type cg -tao_fd_gradient [Expected output]
WHAT THIS EXAMPLE DEMONSTRATES
FURTHER DETAILS:
By discretizing the domain into triangular elements, the pressure surrounding the journal bearing is defined as the minimum of a quadratic function whose variables are bounded below by zero.
DO THE FOLLOWING:
cd petsc/src/tao/bound/examples/tutorials make jbearing2
mpiexec -n 1 ./jbearing2 -mx 32 -my 32 -tao_monitor -tao_view -tao_type blmvm [Expected output]
mpiexec -n 16 ./jbearing2 -mx 256 -my 256 -tao_monitor -tao_view -tao_type blmvm [Expected output] mpiexec -n 16 ./jbearing2 -mx 256 -my 256 -tao_monitor -tao_view -tao_type tron [Expected output] mpiexec -n 16 ./jbearing2 -mx 256 -my 256 -tao_monitor -tao_view -tao_type gpcg [Expected output]Notice that the gpcg algorithm assumes the application's objective function is quadratic, so the hessian does not need to be explicitly computed after the first iteration.
WHAT THIS EXAMPLE DEMONSTRATES
FURTHER DETAILS:
DO THE FOLLOWING:
cd petsc/src/tao/unconstrained/examples/tutorials make minsurf2
mpiexec -n 16 ./minsurf2 -mx 32 -my 32 -tao_type lmvm [Expected output]
Now try running the same application using the derivative-free Nelder-Mead algorithm (nm). Notice that when we used this algorithm on the two-variable Rosenbrock example previously, the performance was worse than lmvm but not unusable. Increasing the number of variables past 100 makes this algorithm unusable for most purposes. This example fails to converge after a function evaluation budget of 4000 (This budget can be lifted using the command line option -tao_max_funcs n) compared to only around 20 function evaluations needed for lmvm.
mpiexec -n 16 ./minsurf2 -mx 32 -my 32 -tao_type nm [Expected output]
mpiexec -n 16 ./minsurf2 -mx 32 -my 32 -tao_type lmvm -tao_fd_gradient [Expected output]
mpiexec -n 16 ./minsurf2 -mx 32 -my 32 -tao_type test [Expected output]