proj home

Files   Classes   Functions   Hierarchy  

minexpdimtest Class Reference

#include <minexpdimtest.h>

List of all members.

Static Public Member Functions

static void test01 ()
static void test02 ()
static void test03 (int argc, char **argv)
static void test04 (int argc, char **argv)
static void test05 (int argc, char **argv)


Detailed Description

Definition at line 7 of file minexpdimtest.h.


Member Function Documentation

void minexpdimtest::test01 (  )  [static]

Definition at line 15 of file minexpdimtest.cpp.

References funcstate< X >::counter, error, minexpdim< X >::fn, minexpdim< X >::himax(), minexpdim< X >::magnitude_increase, printvecfunc(), minexpdim< X >::reset(), SHOW, minexpdim< X >::xi, and funcstate< X >::xi.

Referenced by main().

00016 {
00017   minexpdim<double> mn(* new prob_f001,0.3);
00018   //minexpdim<double> mn(* new prob_f002,0.3);
00019   mn.fn->xi[0]=1;
00020   mn.fn->xi[1]=1;
00021   double error = 1e-4;
00022   mn.reset();
00023   cout << printvecfunc(mn.xi,3) << endl;
00024   //for ( ; !mn && (abs(mn.hi[0])+abs(mn.hi[1])>error); ++mn );
00025   for ( ; !mn && (mn.himax()>error); ++mn );
00026 
00027   cout << printvecfunc(mn.xi,3) << endl;
00028 
00029   cout << SHOW(mn.fn->counter) << endl;
00030 
00031   cout << "exploratory with magnitude increase for successive search." <<
00032 endl;
00033   mn.fn->counter=0;
00034   mn.fn->xi[0]=1;
00035   mn.fn->xi[1]=1;
00036   mn.magnitude_increase=true;
00037   mn.reset();
00038   for ( ; !mn && (mn.himax()>error); ++mn );
00039   cout << printvecfunc(mn.xi,3) << endl;
00040   cout << SHOW(mn.fn->counter) << endl;
00041 }

void minexpdimtest::test02 (  )  [static]

Definition at line 44 of file minexpdimtest.cpp.

References funcstate< X >::counter, minexpdim< X >::fn, minexpdim< X >::moveOrder1(), printvecfunc(), minexpdim< X >::reset(), minexpdim< X >::xi, and funcstate< X >::xi.

Referenced by main().

00045 {
00046   cout << "Looking at moveOrder1 functions." << endl;
00047 
00048   double x0[2] = {1.0,1.0};
00049 
00050 //  funcstate<double> * f01 = ;
00051   minexpdim<double> mn(* new prob_f001,0.3);
00052   copy(x0,x0+2,mn.fn->xi);
00053   mn.reset();
00054 
00055   uint imax=4;
00056   cout << "mn" << endl;
00057   for (uint i=0; i<imax; ++i)
00058   {
00059     cout << printvecfunc(mn.xi,3) << " "; 
00060     mn.moveOrder1();
00061     cout << mn.fn->counter << endl;
00062   }
00063 
00064   //funcstate<double> * f02 = new prob_f001;
00065   minexpdim<double> mn2(* new prob_f001,0.3);
00066   copy(x0,x0+2,mn2.fn->xi);
00067   mn2.reset();
00068 
00069   cout << "mn2" << endl;
00070   for (uint i=0; i<imax; ++i)
00071   {
00072     cout << printvecfunc(mn2.xi,3) << " "; 
00073     mn2.moveOrder1();
00074     cout << mn2.fn->counter << endl;
00075   }
00076 }

void minexpdimtest::test03 ( int  argc,
char **  argv 
) [static]

Definition at line 79 of file minexpdimtest.cpp.

References funcstate< X >::counter, error, minexpdim< X >::fn, minexpdim< X >::himax(), minexpdim< X >::himaxtol(), minexpdim< X >::hiset(), commandline::mapvar(), printvecfunc(), minexpdim< X >::reset(), SHOW, minexpdim< X >::xi, and funcstate< X >::xi.

Referenced by main().

00080 {
00081   cout << "Using ++ with first order approximator explicitly - minexpdimN class" << endl;
00082 //  cout << "Terminating with himax(), an inner product error measure" << endl;
00083 
00084   commandline cmd(argc,argv);
00085 
00086   minexpdimN<double> mn(*new prob_f001,0.3);
00087   double x0[2] = {1.0,1.0};
00088   double error = 1e-4;
00089   cmd.mapvar(error,"error");
00090   cout << SHOW(error) << endl;
00091 
00092   copy(x0,x0+2,mn.fn->xi);
00093   mn.reset();
00094   cout << printvecfunc(mn.xi,3) << endl;
00095 
00096   bool hfixed=false;
00097   cmd.mapvar(hfixed,"hfixed");
00098 
00099   uint i=0;
00100   uint imax=80;
00101   do
00102   {
00103     ++mn;
00104     cout << setw(3) << i << " " << printvecfunc(mn.xi,3);
00105     cout << " " << mn.fn->counter << " " << mn.himax() << endl;
00106     ++i;
00107 
00108     if (hfixed==true)
00109       mn.hiset(mn.himaxtol());
00110 
00111   } while ((mn.xi[2] > error)&&(i<imax));
00112 
00113 }

void minexpdimtest::test04 ( int  argc,
char **  argv 
) [static]

Definition at line 116 of file minexpdimtest.cpp.

References funcstate< X >::counter, error, minpatternsearch< X >::fh, minexpdim< X >::fn, minexpdim< X >::himax(), minexpdim< X >::himaxtol(), minexpdim< X >::hiset(), commandline::mapvar(), printvecfunc(), minpatternsearch< X >::reset(), minexpdim< X >::xi, and funcstate< X >::xi.

Referenced by main().

00117 {
00118   commandline cmd(argc,argv);
00119 
00120   double x0[2] = {1.0,1.0};
00121   minpatternsearch<double> mn(*new prob_f001,0.3);
00122   copy(x0,x0+2,mn.fn->xi);
00123   //cout << "mn  " << printvecfunc(mn.xi,3) << endl; 
00124 
00125   mn.reset();
00126 
00127   bool hfixed=false;
00128   cmd.mapvar(hfixed,"hfixed");
00129   bool summary=false;
00130   cmd.mapvar(summary,"summary");
00131 
00132   double error = 1e-4;
00133 
00134   cmd.mapvar(error,"error");
00135   if (summary==false)
00136   {
00137     cout << "xk1 " << printvecfunc(mn.fh[1],3) << endl;
00138     cout << "xk0 " << printvecfunc(mn.fh[0],3) << endl;
00139     cout << "iter x0 x1 f(X) fn's max(hi)" << endl;
00140   }
00141   //for (uint i=0; mn.xi[2] > error; ++i, ++mn)
00142   uint i=0;
00143   uintc imax=20;
00144   bool cond(true);
00145   do  
00146   {
00147     ++mn;
00148     cond = ((mn.xi[2] > error)&&(i<imax));
00149     if (summary==false || cond==false)
00150     {
00151       cout << setw(3) << i << " " << printvecfunc(mn.xi,3);
00152       cout << " " << mn.fn->counter << " " << mn.himax() << endl;
00153     }
00154     ++i;
00155 
00156     if (hfixed==true)
00157       mn.hiset(mn.himaxtol());
00158 
00159   } while (cond);
00160 
00161 }

void minexpdimtest::test05 ( int  argc,
char **  argv 
) [static]

Definition at line 163 of file minexpdimtest.cpp.

References funcstate< X >::counter, error, minpatternsearchorder2< X >::fh, minexpdim< X >::fn, minexpdim< X >::himax(), minexpdim< X >::himaxtol(), minexpdim< X >::hiset(), commandline::mapvar(), printvecfunc(), minpatternsearchorder2< X >::reset(), minexpdim< X >::xi, and funcstate< X >::xi.

Referenced by main().

00164 {
00165   commandline cmd(argc,argv);
00166 
00167   double x0[2] = {1.0,1.0};
00168   minpatternsearchorder2<double> mn(*new prob_f001,0.3);
00169   copy(x0,x0+2,mn.fn->xi);
00170 
00171   mn.reset();
00172 
00173   bool hfixed=false;
00174   cmd.mapvar(hfixed,"hfixed");
00175   bool summary=false;
00176   cmd.mapvar(summary,"summary");
00177 
00178   double error = 1e-4;
00179 
00180   cmd.mapvar(error,"error");
00181   if (summary==false)
00182   {
00183     cout << "xk2 " << printvecfunc(mn.fh[2],3) << endl;
00184     cout << "xk1 " << printvecfunc(mn.fh[1],3) << endl;
00185     cout << "xk0 " << printvecfunc(mn.fh[0],3) << endl;
00186     cout << "iter x0 x1 f(X) fn's max(hi)" << endl;
00187   }
00188   uint i=0;
00189   uintc imax=20;
00190   bool cond(true);
00191   do  
00192   {
00193     ++mn;
00194     cond = ((mn.xi[2] > error)&&(i<imax));
00195     if (summary==false || cond==false)
00196     {
00197       cout << setw(3) << i << " " << printvecfunc(mn.xi,3);
00198       cout << " " << mn.fn->counter << " " << mn.himax() << endl;
00199     }
00200     ++i;
00201 
00202     if (hfixed==true)
00203       mn.hiset(mn.himaxtol());
00204 
00205   } while (cond);
00206 
00207 }


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:50:06 2011 for Chelton Evans Source by  doxygen 1.5.8