Final modifications to serial version
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1556 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
d64e3ed67b
commit
6647cde165
4 changed files with 76 additions and 6 deletions
|
|
@ -32,6 +32,6 @@ SET( PHYLOMOEA_SOURCES eigensolver.cpp
|
||||||
|
|
||||||
ADD_EXECUTABLE( PhyloMOEA-serial ${PHYLOMOEA_SOURCES} )
|
ADD_EXECUTABLE( PhyloMOEA-serial ${PHYLOMOEA_SOURCES} )
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(PhyloMOEA gsl gslcblas GTL eo eoutils ga moeo cma)
|
TARGET_LINK_LIBRARIES(PhyloMOEA-serial gsl gslcblas GTL eo eoutils ga moeo cma)
|
||||||
|
|
||||||
INSTALL( TARGETS PhyloMOEA RUNTIME DESTINATION bin)
|
INSTALL( TARGETS PhyloMOEA-serial RUNTIME DESTINATION bin)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ RandomNr *rn;
|
||||||
//Sequences *seq;
|
//Sequences *seq;
|
||||||
long seed;
|
long seed;
|
||||||
//vector<phylotreeIND> arbores;
|
//vector<phylotreeIND> arbores;
|
||||||
string datafile,usertree, expid, path, algotype;
|
string datafile,usertree, expid, path, algotype, optimize_branch;
|
||||||
double pcrossover, pmutation, kappa, alpha;
|
double pcrossover, pmutation, kappa, alpha;
|
||||||
unsigned int ngenerations, popsize, ncats;
|
unsigned int ngenerations, popsize, ncats;
|
||||||
ofstream exp_data,evolution_data, best_media_scores, final_trees, final_pareto_trees, clades_pareto, clades_final,final_scores,pareto_scores;
|
ofstream exp_data,evolution_data, best_media_scores, final_trees, final_pareto_trees, clades_pareto, clades_final,final_scores,pareto_scores;
|
||||||
|
|
@ -30,6 +30,9 @@ ofstream exp_data,evolution_data, best_media_scores, final_trees, final_pareto_t
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
struct timeval tempo1, tempo2, result;
|
||||||
|
gettimeofday(&tempo1, NULL);
|
||||||
|
|
||||||
welcome_message();
|
welcome_message();
|
||||||
|
|
||||||
eoParser parser(argc, argv);
|
eoParser parser(argc, argv);
|
||||||
|
|
@ -48,6 +51,7 @@ int main(int argc, char *argv[])
|
||||||
usertree = parser.createParam(string(), "treef", "Treefile", 't',"Param").value();
|
usertree = parser.createParam(string(), "treef", "Treefile", 't',"Param").value();
|
||||||
path = parser.createParam(string(), "path", "Treefile", 'p',"Param").value();
|
path = parser.createParam(string(), "path", "Treefile", 'p',"Param").value();
|
||||||
algotype = parser.createParam(string("nsgaii"), "algo", "Algorith, Type", 'b',"Param").value();
|
algotype = parser.createParam(string("nsgaii"), "algo", "Algorith, Type", 'b',"Param").value();
|
||||||
|
optimize_branch = parser.createParam(string("yes"), "opt", "Optimize Branch Lenght", 'o',"Param").value();
|
||||||
ostringstream convert;
|
ostringstream convert;
|
||||||
convert << seed;
|
convert << seed;
|
||||||
expid = parser.createParam(convert.str(), "expid", "Experiment ID", 'e',"Param").value();
|
expid = parser.createParam(convert.str(), "expid", "Experiment ID", 'e',"Param").value();
|
||||||
|
|
@ -184,7 +188,7 @@ int main(int argc, char *argv[])
|
||||||
// optimize remaining solutions
|
// optimize remaining solutions
|
||||||
cout << "\nOptimizing tree branch lenghts...\n";
|
cout << "\nOptimizing tree branch lenghts...\n";
|
||||||
|
|
||||||
optimize_solutions( finalsolutions, lik_calc );
|
if(optimize_branch=="yes")optimize_solutions( finalsolutions, lik_calc );
|
||||||
cout << "\nReevaluating individuals \n";
|
cout << "\nReevaluating individuals \n";
|
||||||
apply<PhyloMOEO> ( byobj, finalsolutions );
|
apply<PhyloMOEO> ( byobj, finalsolutions );
|
||||||
|
|
||||||
|
|
@ -244,6 +248,8 @@ int main(int argc, char *argv[])
|
||||||
// delete probmatrixs;
|
// delete probmatrixs;
|
||||||
delete rn;
|
delete rn;
|
||||||
cout << "\nPhyloMOEA execution finishes !\n";
|
cout << "\nPhyloMOEA execution finishes !\n";
|
||||||
|
gettimeofday(&tempo2, NULL);
|
||||||
|
print_elapsed_time(&tempo1,&tempo2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,66 @@ extern string datafile,usertree, expid, path;
|
||||||
extern double pcrossover, pmutation, kappa, alpha;
|
extern double pcrossover, pmutation, kappa, alpha;
|
||||||
extern unsigned int ngenerations, popsize, ncats;
|
extern unsigned int ngenerations, popsize, ncats;
|
||||||
|
|
||||||
|
int timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y)
|
||||||
|
{
|
||||||
|
/* Perform the carry for the later subtraction by updating y. */
|
||||||
|
if (x->tv_usec < y->tv_usec) {
|
||||||
|
int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
|
||||||
|
y->tv_usec -= 1000000 * nsec;
|
||||||
|
y->tv_sec += nsec;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x->tv_usec - y->tv_usec > 1000000) {
|
||||||
|
int nsec = (x->tv_usec - y->tv_usec) / 1000000;
|
||||||
|
y->tv_usec += 1000000 * nsec;
|
||||||
|
y->tv_sec -= nsec;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compute the time remaining to wait.
|
||||||
|
tv_usec is certainly positive. */
|
||||||
|
result->tv_sec = x->tv_sec - y->tv_sec;
|
||||||
|
result->tv_usec = x->tv_usec - y->tv_usec;
|
||||||
|
|
||||||
|
/* Return 1 if result is negative. */
|
||||||
|
return x->tv_sec < y->tv_sec;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void print_elapsed_time(struct timeval *x, struct timeval *y)
|
||||||
|
{
|
||||||
|
struct timeval result;
|
||||||
|
timeval_subtract(&result,y,x);
|
||||||
|
long remainder = result.tv_sec % 3600;
|
||||||
|
long hours = (result.tv_sec - remainder)/3600;
|
||||||
|
long seconds = remainder % 60;
|
||||||
|
long minutes = (remainder - seconds) / 60;
|
||||||
|
cout << "Execution time : ";
|
||||||
|
cout.width(3);
|
||||||
|
cout.fill(' ');
|
||||||
|
cout << hours << ":";
|
||||||
|
cout.width(2);
|
||||||
|
cout.fill('0');
|
||||||
|
cout << minutes << ":";
|
||||||
|
cout.width(2);
|
||||||
|
cout.fill('0');
|
||||||
|
cout << seconds << "." << result.tv_usec << "(" << result.tv_sec << ")" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void print_elapsed_time_short(struct timeval *x, struct timeval *y, ostream &os)
|
||||||
|
{
|
||||||
|
struct timeval result;
|
||||||
|
timeval_subtract(&result,y,x);
|
||||||
|
os << " " << result.tv_sec << "." << result.tv_usec;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void print_cpu_time(clock_t start, clock_t end)
|
||||||
|
{
|
||||||
|
double cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
|
||||||
|
cout << " " << cpu_time_used << " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void welcome_message()
|
void welcome_message()
|
||||||
{
|
{
|
||||||
cout << "\nPhyloMOEA, a program for multi-criteria phylogenetic inference\n";
|
cout << "\nPhyloMOEA, a program for multi-criteria phylogenetic inference\n";
|
||||||
|
|
|
||||||
|
|
@ -30,5 +30,9 @@ void welcome_message();
|
||||||
void save_exp_params(ostream &);
|
void save_exp_params(ostream &);
|
||||||
void optimize_solutions( eoPop<PhyloMOEO> &, LikelihoodCalculator &);
|
void optimize_solutions( eoPop<PhyloMOEO> &, LikelihoodCalculator &);
|
||||||
void readtrees(const char *, eoPop<PhyloMOEO> &);
|
void readtrees(const char *, eoPop<PhyloMOEO> &);
|
||||||
|
int timeval_subtract (struct timeval *, struct timeval *, struct timeval *);
|
||||||
|
void print_cpu_time(clock_t ,clock_t);
|
||||||
|
void print_elapsed_time(struct timeval *, struct timeval *);
|
||||||
|
void print_elapsed_time_short(struct timeval *, struct timeval *, ostream &os=cout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue