Files Classes Functions Hierarchy
#include <explorerand.h>
Public Types | |
| typedef typeop< EXP >::Targ::FNtype | FN |
| typedef typeop< EXP >::Tbare::Ttype | T |
Public Member Functions | |
| explorerand (uintc N_, T const h0step=20.0, uintc indexmax_=500) | |
| Construct a N dimensional direct search object on FN. | |
| explorerand (FN fn_, uintc N_, T const h0step=20.0, uintc indexmax_=500) | |
| FN can be a reference. | |
| void | operator++ () |
| Iterate towards the minimum. | |
Public Attributes | |
| RND | rnd |
A search is made in both directions about xi[k].
EXP is expected to support exploreh or one of its derivations.
This method became comparable to the others with a higher number of iterations.
Definition at line 15 of file explorerand.h.
| typedef typeop<EXP>::Targ::FNtype explorerand< EXP, RND >::FN |
Definition at line 21 of file explorerand.h.
| typedef typeop<EXP>::Tbare::Ttype explorerand< EXP, RND >::T |
Definition at line 22 of file explorerand.h.
| explorerand< EXP, RND >::explorerand | ( | uintc | N_, | |
| T const | h0step = 20.0, |
|||
| uintc | indexmax_ = 500 | |||
| ) | [inline] |
Construct a N dimensional direct search object on FN.
Definition at line 26 of file explorerand.h.
00031 : EXP(N_,h0step,indexmax_) {}
| explorerand< EXP, RND >::explorerand | ( | FN | fn_, | |
| uintc | N_, | |||
| T const | h0step = 20.0, |
|||
| uintc | indexmax_ = 500 | |||
| ) | [inline] |
FN can be a reference.
Definition at line 35 of file explorerand.h.
00041 : EXP(fn_,N_,h0step,indexmax_) {}
| void explorerand< EXP, RND >::operator++ | ( | ) | [inline] |
Iterate towards the minimum.
Definition at line 50 of file explorerand.h.
References explorerand< EXP, RND >::rnd, and SHOW.
00051 { 00052 EXP::hasStateChanged=false; 00053 00054 if (!EXP::valid) 00055 return; 00056 00057 if (EXP::index>EXP::indexmax) 00058 { 00059 EXP::valid=false; 00060 #ifndef NDEBUG 00061 cout << "error: indexmax reached " << SHOW(EXP::index) << endl; 00062 #endif 00063 return; 00064 } 00065 00066 ++EXP::index; 00067 00068 static T tmp; 00069 00070 for (uint i=0; i<EXP::N; ++i) 00071 { 00072 tmp = EXP::xi[i]; 00073 00074 bool flag=false; 00075 for (uint k=0; k<1; ++k) 00076 { 00077 if (flag==false) 00078 { 00079 EXP::xi[i] += EXP::hi[i]*rnd(); 00080 if (EXP::evaluate()) 00081 { 00082 flag=true; 00083 // cout << "***" << endl; 00084 continue; 00085 } 00086 00087 EXP::xi[i] = tmp - EXP::hi[i]*rnd(); 00088 if (EXP::evaluate()) 00089 { 00090 flag=true; 00091 // cout << "###" << endl; 00092 continue; 00093 } 00094 } 00095 } 00096 00097 if (flag==true) 00098 continue; 00099 00100 00101 EXP::xi[i] = tmp; 00102 00103 /* 00104 00105 EXP::xi[i] += EXP::hi[i]; 00106 if (EXP::evaluate()) 00107 continue; 00108 00109 EXP::hi[i] *= -1; 00110 EXP::xi[i] += EXP::hi[i]; 00111 EXP::xi[i] += EXP::hi[i]; 00112 if (EXP::evaluate()) 00113 continue; 00114 00115 tmp = EXP::xi[i]; 00116 00117 // Try find a random solution with the interval. 00118 EXP::xi[i] += EXP::hi[i]*2.0*rnd(); 00119 if (EXP::evaluate()) 00120 { 00121 cout << "success" << endl; 00122 continue; 00123 } 00124 00125 cout << "fuck" << endl; 00126 00127 EXP::xi[i] = tmp; 00128 00129 EXP::xi[i] -= EXP::hi[i]; 00130 */ 00131 00132 EXP::hi[i] *= 0.61803398875; 00133 } 00134 }
| RND explorerand< EXP, RND >::rnd |
1.5.8