|
@@ -12,7 +12,7 @@
|
|
|
#include <time.h>
|
|
|
#include <iostream>
|
|
|
|
|
|
-#include "numbase.h" // ice random
|
|
|
+//#include "numbase.h" // ice random
|
|
|
#include "optimization/AdditionalIceUtils.h"
|
|
|
#include "core/optimization/blackbox/Definitions_core_opt.h"
|
|
|
|
|
@@ -190,7 +190,11 @@ void AdaptiveDirectionRandomSearchOptimizer::init()
|
|
|
/*
|
|
|
seed rand
|
|
|
*/
|
|
|
+#ifdef NICE_USE_ICE
|
|
|
ice::Randomize();
|
|
|
+#else
|
|
|
+ srand(0);
|
|
|
+#endif
|
|
|
|
|
|
/*
|
|
|
check if bounds are active! bounds are needed
|
|
@@ -218,8 +222,11 @@ void AdaptiveDirectionRandomSearchOptimizer::init()
|
|
|
{
|
|
|
for(int l = 0; l < static_cast<int>(m_numberOfParallelPoints);l++)
|
|
|
{
|
|
|
+#ifdef NICE_USE_ICE
|
|
|
m_Parameters(k,l) = m_parameters(k,0) + m_scales(k,0) *2.0* (ice::RandomD() - 0.5);
|
|
|
-
|
|
|
+#else
|
|
|
+ m_Parameters(k,l) = m_parameters(k,0) + m_scales(k,0) *2.0* (drand48() - 0.5);
|
|
|
+#endif
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -232,7 +239,11 @@ void AdaptiveDirectionRandomSearchOptimizer::init()
|
|
|
{
|
|
|
for(int l = 0; l < static_cast<int>(m_numberOfParallelPoints);l++)
|
|
|
{
|
|
|
+#ifdef NICE_USE_ICE
|
|
|
m_Parameters(k,l) = m_advancedinitLowerBounds(k,0) +ice::RandomD() * (m_advancedinitUpperBounds(k,0) - m_advancedinitLowerBounds(k,0) ) ;
|
|
|
+#else
|
|
|
+ m_Parameters(k,l) = m_advancedinitLowerBounds(k,0) +drand48()* (m_advancedinitUpperBounds(k,0) - m_advancedinitLowerBounds(k,0) ) ;
|
|
|
+#endif
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -267,8 +278,11 @@ void AdaptiveDirectionRandomSearchOptimizer::init()
|
|
|
{
|
|
|
for(int k = 0; k < static_cast<int>(m_numberOfParameters);k++)
|
|
|
{
|
|
|
+#ifdef NICE_USE_ICE
|
|
|
m_Parameters(k,u) = m_parameters(k,0) + m_scales(k,0) * 2.0*(ice::RandomD() - 0.5);
|
|
|
-
|
|
|
+#else
|
|
|
+ m_Parameters(k,u) = m_parameters(k,0) + m_scales(k,0) * 2.0*(drand48() - 0.5);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -355,7 +369,11 @@ OPTIMIZATION::matrix_type AdaptiveDirectionRandomSearchOptimizer::generatePoint(
|
|
|
{
|
|
|
if(m_scales(i,0) > 0.0 )
|
|
|
{
|
|
|
+#ifdef NICE_USE_ICE
|
|
|
newPoint(i,0) = m_scales(i,0) * 2.0*(ice::RandomD() - 0.5);
|
|
|
+#else
|
|
|
+ newPoint(i,0) = m_scales(i,0) * 2.0*(drand48() - 0.5);
|
|
|
+#endif
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -718,7 +736,11 @@ int AdaptiveDirectionRandomSearchOptimizer::optimize()
|
|
|
/*
|
|
|
generate random number [0,1]
|
|
|
*/
|
|
|
+#ifdef NICE_USE_ICE
|
|
|
double choice = ice::RandomD();
|
|
|
+#else
|
|
|
+ double choice = drand48();
|
|
|
+#endif
|
|
|
int u_chosen = 0;
|
|
|
|
|
|
for(int u = 0; u < static_cast<int>(m_numberOfParallelPoints); u++)
|