Centralize thread count suggestion
This commit is contained in:
parent
854ad5a1a3
commit
1d901ccc01
@ -282,7 +282,7 @@ namespace BitEvolver
|
|||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
thread_count = std::thread::hardware_concurrency();
|
thread_count = this->GetThreadCountSuggestion();
|
||||||
|
|
||||||
//
|
//
|
||||||
for ( i=0; i<thread_count; i++) {
|
for ( i=0; i<thread_count; i++) {
|
||||||
@ -377,6 +377,18 @@ namespace BitEvolver
|
|||||||
//
|
//
|
||||||
return this->chromosomes[chromosome_index];
|
return this->chromosomes[chromosome_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int Population::GetThreadCountSuggestion()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int thread_count;
|
||||||
|
|
||||||
|
//
|
||||||
|
thread_count = std::thread::hardware_concurrency();
|
||||||
|
|
||||||
|
return thread_count;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,6 +89,8 @@ namespace BitEvolver
|
|||||||
std::shared_ptr<Chromosome> BreedChild();
|
std::shared_ptr<Chromosome> BreedChild();
|
||||||
std::shared_ptr<Chromosome> PickChromosomeForBreeding();
|
std::shared_ptr<Chromosome> PickChromosomeForBreeding();
|
||||||
|
|
||||||
|
//
|
||||||
|
int GetThreadCountSuggestion();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user