// // Test program for Quasi-Newton optimization objects // #include <fstream> #include "OptQNewton.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 = {"tstqnewton.out"}; // Create a Nonlinear problem object NLF1 nlp(n,rosen,init_rosen); nlp.setIsExpensive(true); // Create a "Tolerances" object and set the tolerances TOLS tol; tol.setDefaultTol(); tol.setFTol(1.e-9); // Set convergence tolerance to 1.e-9 tol.setMaxIter(200); // Set maximum number of outer iterations to 200 // Build a Quasi-Newton object and optimize OptQNewton objfcn(&nlp,tol); if (!objfcn.setOutputFile(status_file, 0)) cerr << "main: output file open failed" << endl; objfcn.setTRSize(100.); // Set initial trust region radius to 100 objfcn.optimize(); objfcn.printStatus("Solution from quasi-newton"); objfcn.cleanup(); }
Next Section: Bound-constrained minimization | Back to Solvers Page
Last revised September 14, 2006 .