1 |
#include "ecosystem.h" |
#include "ecosystem.h" |
2 |
#include "runid.h" |
#include "runid.h" |
3 |
#include "global.h" |
#include "global.h" |
4 |
|
#include <ctime> |
5 |
#ifdef _OPENMP |
#ifdef _OPENMP |
6 |
#include <omp.h> |
#include <omp.h> |
7 |
#endif |
#endif |
12 |
#endif |
#endif |
13 |
extern volatile int interrupted_print; |
extern volatile int interrupted_print; |
14 |
|
|
15 |
|
time_t starttime, stoptime; |
16 |
|
|
17 |
Ecosystem::Ecosystem(const MainInfo& main) : printinfo(main.getPI()) { |
Ecosystem::Ecosystem(const MainInfo& main) : printinfo(main.getPI()) { |
18 |
|
|
19 |
funceval = 0; |
funceval = 0; |
115 |
void Ecosystem::Optimise() { |
void Ecosystem::Optimise() { |
116 |
int i; |
int i; |
117 |
for (i = 0; i < optvec.Size(); i++) { |
for (i = 0; i < optvec.Size(); i++) { |
118 |
|
time(&starttime); |
119 |
#ifdef _OPENMP |
#ifdef _OPENMP |
120 |
int j, numThr = omp_get_max_threads ( ); |
int j, numThr = omp_get_max_threads ( ); |
121 |
DoubleVector v = this->getValues(); |
DoubleVector v = this->getValues(); |
127 |
#else |
#else |
128 |
optvec[i]->OptimiseLikelihood(); |
optvec[i]->OptimiseLikelihood(); |
129 |
#endif |
#endif |
130 |
|
time(&stoptime); |
131 |
this->writeOptValues(); |
this->writeOptValues(); |
132 |
} |
} |
133 |
} |
} |
188 |
handle.logMessage(LOGINFO, "\nThe overall likelihood score is", keeper->getBestLikelihoodScore()); |
handle.logMessage(LOGINFO, "\nThe overall likelihood score is", keeper->getBestLikelihoodScore()); |
189 |
else |
else |
190 |
handle.logMessage(LOGINFO, "\nThe overall likelihood score is", this->getLikelihood()); |
handle.logMessage(LOGINFO, "\nThe overall likelihood score is", this->getLikelihood()); |
191 |
|
|
192 |
|
handle.logMessage(LOGINFO, "\n Runtime for the algorithm was ", difftime(stoptime, starttime)," seconds\n"); |
193 |
} |
} |
194 |
|
|
195 |
void Ecosystem::writeInitialInformation(const char* const filename) { |
void Ecosystem::writeInitialInformation(const char* const filename) { |