183 |
#endif |
#endif |
184 |
|
|
185 |
extern Ecosystem* EcoSystem; |
extern Ecosystem* EcoSystem; |
186 |
#ifndef NO_OPENMP |
#ifdef _OPENMP |
187 |
extern Ecosystem** EcoSystems; |
extern Ecosystem** EcoSystems; |
188 |
#endif |
#endif |
189 |
|
|
805 |
/// Represents the function that computes how good the parameters are |
/// Represents the function that computes how good the parameters are |
806 |
double evaluate_f(const DoubleVector& params) { |
double evaluate_f(const DoubleVector& params) { |
807 |
double trialf; |
double trialf; |
808 |
#ifndef NO_OPENMP |
#ifdef _OPENMP |
809 |
int id = omp_get_thread_num (); |
int id = omp_get_thread_num (); |
810 |
trialf = EcoSystems[id]->SimulateAndUpdate(params); |
trialf = EcoSystems[id]->SimulateAndUpdate(params); |
811 |
#else |
#else |
1035 |
EcoSystem->resetVariables(); //JMB need to reset variables in case they have been scaled |
EcoSystem->resetVariables(); //JMB need to reset variables in case they have been scaled |
1036 |
if (scale) { |
if (scale) { |
1037 |
EcoSystem->scaleVariables(); |
EcoSystem->scaleVariables(); |
1038 |
#ifndef NO_OPENMP |
#ifdef _OPENMP |
1039 |
int numThr = omp_get_max_threads ( ); |
int numThr = omp_get_max_threads ( ); |
1040 |
for(i = 0; i < numThr; i++) // scale the variables for the ecosystem of every thread |
for(i = 0; i < numThr; i++) // scale the variables for the ecosystem of every thread |
1041 |
EcoSystems[i]->scaleVariables(); |
EcoSystems[i]->scaleVariables(); |
1087 |
ReproducibleSearch<Siman, DoubleVector, ControlClass, evaluate_f, buildNewParams_f> |
ReproducibleSearch<Siman, DoubleVector, ControlClass, evaluate_f, buildNewParams_f> |
1088 |
pa(s, x, simanniter); |
pa(s, x, simanniter); |
1089 |
|
|
1090 |
#ifndef NO_OPENMP |
#ifdef _OPENMP |
1091 |
// OpenMP parallelization |
// OpenMP parallelization |
1092 |
int numThr = omp_get_max_threads ( ); |
int numThr = omp_get_max_threads ( ); |
1093 |
pa.paral_opt_omp(funcval,numThr,numThr); |
pa.paral_opt_omp(funcval,numThr,numThr); |