117 |
for (j = 0; j < numThr; j++) |
for (j = 0; j < numThr; j++) |
118 |
EcoSystems[j]->Update(v); |
EcoSystems[j]->Update(v); |
119 |
#endif |
#endif |
|
optvec[i]->OptimiseLikelihood(); |
|
|
this->writeOptValues(); |
|
|
} |
|
|
} |
|
|
|
|
120 |
#ifdef GADGET_OPENMP |
#ifdef GADGET_OPENMP |
|
void Ecosystem::OptimiseOMP() { |
|
|
int i; |
|
|
for (i = 0; i < optvec.Size(); ++i) { |
|
121 |
optvec[i]->OptimiseLikelihoodOMP(); |
optvec[i]->OptimiseLikelihoodOMP(); |
122 |
int j, numThr = omp_get_max_threads ( ); |
#else |
123 |
DoubleVector v = this->getValues(); |
optvec[i]->OptimiseLikelihood(); |
124 |
for (j = 0; j < numThr; j++) |
#endif |
|
EcoSystems[j]->Update(v); |
|
125 |
this->writeOptValues(); |
this->writeOptValues(); |
126 |
} |
} |
127 |
} |
} |
|
#endif |
|
128 |
|
|
129 |
double Ecosystem::SimulateAndUpdate(const DoubleVector& x) { |
double Ecosystem::SimulateAndUpdate(const DoubleVector& x) { |
130 |
int i, j; |
int i, j; |
184 |
handle.logMessage(LOGINFO, "\nThe overall likelihood score is", this->getLikelihood()); |
handle.logMessage(LOGINFO, "\nThe overall likelihood score is", this->getLikelihood()); |
185 |
} |
} |
186 |
|
|
|
//#ifdef GADGET_OPENMP |
|
|
//void Ecosystem::writeOptValuesOMP() { |
|
|
// int i; |
|
|
// DoubleVector tmpvec(likevec.Size(), 0.0); |
|
|
// for (i = 0; i < likevec.Size(); ++i) |
|
|
// tmpvec[i] = likevec[i]->getUnweightedLikelihood(); |
|
|
// |
|
|
// int iters = 0, numThr = omp_get_max_threads ( ); |
|
|
// for (i = 0; i < numThr; i++) |
|
|
// iters += EcoSystems[i]->getFuncEval(); |
|
|
// handle.logMessage(LOGINFO, "\nAfter a total of", funceval+iters, "function evaluations the best point found is"); |
|
|
// keeper->writeBestValues(); |
|
|
// handle.logMessage(LOGINFO, "\nThe scores from each likelihood component are"); |
|
|
// handle.logMessage(LOGINFO, tmpvec); |
|
|
// if (!isZero(keeper->getBestLikelihoodScore())) // no better point has been found |
|
|
// handle.logMessage(LOGINFO, "\nThe overall likelihood score is", keeper->getBestLikelihoodScore()); |
|
|
// else |
|
|
// handle.logMessage(LOGINFO, "\nThe overall likelihood score is", this->getLikelihood()); |
|
|
//} |
|
|
//#endif |
|
|
|
|
187 |
void Ecosystem::writeInitialInformation(const char* const filename) { |
void Ecosystem::writeInitialInformation(const char* const filename) { |
188 |
keeper->openPrintFile(filename); |
keeper->openPrintFile(filename); |
189 |
keeper->writeInitialInformation(likevec); |
keeper->writeInitialInformation(likevec); |