20. Creation and Destruction

A TAO solver can be created with the command
   info = TaoCreate(MPI_Comm comm,TaoMethod method,TAO_SOLVER *newsolver); 
The first argument in this routine is an MPI communicator indicating which processes are involved in the solution process. In most cases, this should be set to MPI_COMM_WORLD. The second argument in this creation routine specifies the default method that should be be used to solve the optimization problem. The third argument in TaoCreate() is a pointer to a TAO solver object. This routine creates the object and returns it to the user. The TAO object is then to be used in all TAO routines.

The various types of TAO solvers and the flags that identify them will be discussed in the following chapters. The solution method should be carefully chosen depending upon the problem that is being solved. Some solvers, for instance, are meant for problems with no constraints, while other solvers acknowledge constraints in the problem and solve them accordingly. The user must also be aware of the derivative information that is available. Some solvers require second-order information, while other solvers require only gradient or function information. The TaoMethod can also be set to TAO_NULL in the TaoCreate() routine if the user selects a method at runtime using the options database. The command line option -tao_method followed by an TAO method will override any method specified by the second argument. The command line option -tao_method tao_lmvm, for instance, will specify the limited memory variable metric method for unconstrained optimization. Note that the TaoMethod variable is a string that requires quotation marks in an application program, but quotation marks are not required at the command line. The method that TAO uses to solve an optimization problem can be changed at a later point in the program with the command TaoSetMethod(), whose arguments are a TAO solver and a string that uniquely identifies a method for solving the problem.

Each TAO solver that has been created should also be destroyed using the command

   info = TaoDestroy(TAO_SOLVER solver); 
This routine frees the internal data structures used by the solver.