Conjugate Gradient Method

   #include <fstream>

   #include "OptCG.h"
   #include "NLF.h"
   #include "tstfcn.h"
   using NEWMAT::ColumnVector;
   using namespace OPTPP;

   void update_model(int, int, ColumnVector) {}

   int main ()
     int n = 2;
     static char *status_file = {"tstcg.out"};

     //  Create a Nonlinear problem object
     NLF1 nlp(n,rosen,init_rosen);
     //  Build a CG object and optimize 
     OptCG objfcn(&nlp);   

     if (!objfcn.setOutputFile(status_file, 0))
       cerr << "main: output file open failed" << endl;

     // Set gradient tolerance equal to 1.0e-6

     objfcn.printStatus("Solution from CG: Fcn not Expensive");



View the output of a conjugate gradient method

Next Section: Quasi-Newton method with trust-region | Back to Unconstrained minimization

Last revised September 14, 2006 .

Bug Reports    OPT++ Developers    Copyright Information    GNU Lesser General Public License
Documentation, generated by , last revised August 30, 2006.