diff options
Diffstat (limited to 'methods')
-rw-r--r-- | methods/aga/aga.hpp | 10 | ||||
-rw-r--r-- | methods/powell/bas_util.hpp | 17 |
2 files changed, 14 insertions, 13 deletions
diff --git a/methods/aga/aga.hpp b/methods/aga/aga.hpp index f87d215..577e526 100644 --- a/methods/aga/aga.hpp +++ b/methods/aga/aga.hpp @@ -146,7 +146,6 @@ namespace opt_utilities uni_rand(get_element(lower_bound,j), get_element(upper_bound,j)) ); - } } @@ -186,7 +185,7 @@ namespace opt_utilities sum+=samples[i].v; } - std::sort(samples.begin(),samples.end(),vp_comp<double,std::vector<double> >()); + std::sort(samples.begin(),samples.end(),vp_comp<rT,pT>()); if(sum2/samples.size()-pow(sum/samples.size(),2)<threshold) { return false; @@ -240,16 +239,17 @@ namespace opt_utilities buffer.resize(n2); double n_per_dim=pow((double)n0,1./get_size(lower_bound)); resize(reproduction_box,get_size(lower_bound)); + for(int i=0;i<get_size(lower_bound);++i) { - + set_element(reproduction_box,i, (get_element(upper_bound,i)- get_element(lower_bound,i))/n_per_dim); } - + while(iter()){} - + return samples.begin()->p; } diff --git a/methods/powell/bas_util.hpp b/methods/powell/bas_util.hpp index 743dc3c..6a53f0a 100644 --- a/methods/powell/bas_util.hpp +++ b/methods/powell/bas_util.hpp @@ -1,6 +1,7 @@ #ifndef BAS_UTIL #define BAS_UTIL #include <core/opt_traits.hpp> +#include <algorithm> namespace opt_utilities { template <typename T> @@ -31,15 +32,15 @@ namespace opt_utilities opt_eq(b,c); opt_eq(c,d); } - template <typename T> - void swap(T& ax,T& bx) - { + // template <typename T> + // void swap(T& ax,T& bx) + //{ // swap(ax,bx); - T temp; - opt_eq(temp,ax); - opt_eq(ax,bx); - opt_eq(bx=temp); - } + // T temp; + //opt_eq(temp,ax); + //opt_eq(ax,bx); + //opt_eq(bx,temp); + //} template <typename T> T sign(const T& a,const T& b) |