Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Diff of /trunk/gadget/ecosystem.cc
[mareframe] / trunk / gadget / ecosystem.cc Repository:
ViewVC logotype

Diff of /trunk/gadget/ecosystem.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1, Mon Feb 10 17:09:07 2014 UTC revision 16, Tue Oct 13 11:29:01 2015 UTC
# Line 1  Line 1 
1  #include "ecosystem.h"  #include "ecosystem.h"
2  #include "runid.h"  #include "runid.h"
3  #include "global.h"  #include "global.h"
4    #ifdef _OPENMP
5    #include <omp.h>
6    #endif
7    
8    #ifdef _OPENMP
9    extern Ecosystem** EcoSystems;
10    //extern StochasticData* data;
11    #endif
12    
13  Ecosystem::Ecosystem(const MainInfo& main) : printinfo(main.getPI()) {  Ecosystem::Ecosystem(const MainInfo& main) : printinfo(main.getPI()) {
14    
# Line 32  Line 40 
40        infile.open(filename, ios::in);        infile.open(filename, ios::in);
41        handle.checkIfFailure(infile, filename);        handle.checkIfFailure(infile, filename);
42        handle.Open(filename);        handle.Open(filename);
43        this->readOptimisation(commin);        unsigned seed;
44          main.getForcePrint();
45          this->readOptimisation(commin, main.getSeed());
46        handle.Close();        handle.Close();
47        infile.close();        infile.close();
48        infile.clear();        infile.clear();
# Line 101  Line 111 
111  void Ecosystem::Optimise() {  void Ecosystem::Optimise() {
112    int i;    int i;
113    for (i = 0; i < optvec.Size(); i++) {    for (i = 0; i < optvec.Size(); i++) {
114    #ifdef _OPENMP
115              int j, numThr = omp_get_max_threads ( );
116              DoubleVector v = this->getValues();
117              for (j = 0; j < numThr; j++)
118                      EcoSystems[j]->Update(v);
119    #endif
120    #ifdef SPECULATIVE
121              optvec[i]->OptimiseLikelihoodOMP();
122    #else
123      optvec[i]->OptimiseLikelihood();      optvec[i]->OptimiseLikelihood();
124    #endif
125      this->writeOptValues();      this->writeOptValues();
126    }    }
127  }  }
# Line 148  Line 168 
168    for (i = 0; i < likevec.Size(); i++)    for (i = 0; i < likevec.Size(); i++)
169      tmpvec[i] = likevec[i]->getUnweightedLikelihood();      tmpvec[i] = likevec[i]->getUnweightedLikelihood();
170    
171    handle.logMessage(LOGINFO, "\nAfter a total of", funceval, "function evaluations the best point found is");    int iters = 0;
172    #ifdef _OPENMP
173      int numThr = omp_get_max_threads ( );
174        for (i = 0; i < numThr; i++)
175              iters += EcoSystems[i]->getFuncEval();
176    #endif
177      handle.logMessage(LOGINFO, "\nAfter a total of", funceval+iters, "function evaluations the best point found is");
178    keeper->writeBestValues();    keeper->writeBestValues();
179    handle.logMessage(LOGINFO, "\nThe scores from each likelihood component are");    handle.logMessage(LOGINFO, "\nThe scores from each likelihood component are");
180    handle.logMessage(LOGINFO, tmpvec);    handle.logMessage(LOGINFO, tmpvec);

Legend:
Removed from v.1  
changed lines
  Added in v.16

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge