Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats managers #63

Merged
merged 53 commits into from
Jun 1, 2016
Merged
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
2164781
Last commit before I completely overhaul OEE.h
emilydolson Apr 6, 2016
eba2749
Merge branch 'master' of github.com:devosoft/Empirical
emilydolson Apr 8, 2016
d70eea3
Merge branch 'master' of github.com:devosoft/Empirical
emilydolson Apr 19, 2016
4e615bc
Adding update signal
emilydolson Apr 22, 2016
24aa95f
Merge branch 'master' of github.com:devosoft/Empirical
emilydolson Apr 22, 2016
0ebbf5c
Complexity and Ecology work
emilydolson May 11, 2016
b787d67
Fixed merge conflict
emilydolson May 11, 2016
2c7be2f
Merge branch 'master' of github.com:devosoft/Empirical
emilydolson May 11, 2016
6ae3880
All metrics work
emilydolson May 11, 2016
2abc7e5
All metrics work
emilydolson May 12, 2016
fdd1819
All metrics work, skeletonization streamlined
emilydolson May 13, 2016
570aab4
Separate generations deduction works now
emilydolson May 13, 2016
e718cf2
Merge branch 'master' of github.com:devosoft/Empirical
emilydolson May 13, 2016
24e903a
Cleaned up OEE.h, added comments
emilydolson May 13, 2016
de8731e
Added example for OEE tracker
emilydolson May 14, 2016
7481633
Fixed bug in change deque length, added fitness tracking
emilydolson May 14, 2016
bcb6fa9
Merge branch 'master' of github.com:devosoft/Empirical
emilydolson May 14, 2016
86fe09b
Added print statement to verify settings
emilydolson May 14, 2016
88b491e
Added template specializations to appease std::vector
emilydolson May 15, 2016
8aac649
Made template specialization of ShannonDiversity to take a World
emilydolson May 18, 2016
1c525dc
Worlds are iterable
emilydolson May 18, 2016
7c51aeb
Fixing merge conflict
emilydolson May 18, 2016
779a6f4
Use world iterator in stats
emilydolson May 19, 2016
89150a8
Merge branch 'master' of github.com:devosoft/Empirical into nullorgs
emilydolson May 19, 2016
e6629c8
Fixed tournament selection to only choose from valid orgs
emilydolson May 19, 2016
229d7d9
NK_OEE now uses const landscapes
emilydolson May 19, 2016
39d792d
Lineage tracker does everything automatically with signals
emilydolson May 19, 2016
b119b08
Made ids actually propagate correctly
emilydolson May 19, 2016
295fd66
Elite selection is null org safe
emilydolson May 19, 2016
7795f83
GetValidOrgIndices actually works now
emilydolson May 19, 2016
0303f20
Merge in Jake and Stevens addition to Stats.h
emilydolson May 20, 2016
c41f784
Merge in null org handling
emilydolson May 20, 2016
a740eb6
Base stats manager functionality works
emilydolson May 20, 2016
f331839
StatsManagers handle output locations
emilydolson May 22, 2016
b718da7
Worlditerator uses pointers
emilydolson May 22, 2016
a848858
Added error message for invalid file
emilydolson May 22, 2016
b68dba6
Created default stats manager, made header
emilydolson May 23, 2016
14a5af0
Merge branch 'master' of github.com:devosoft/Empirical
emilydolson May 23, 2016
261a9f3
Added comments, cleaned up types
emilydolson May 23, 2016
49744de
OEE stats manager uses base output
emilydolson May 23, 2016
09fdf57
Stats managers have config files
emilydolson May 23, 2016
34198f6
Fixed possible null dereference in tournament fitness calculation
emilydolson May 23, 2016
db2c17d
Guard against null dereference in MutatePop
emilydolson May 23, 2016
39ae05f
StatsManagers can be passed as template arguments
emilydolson May 27, 2016
eb645f2
LineageTracker and OEEStats now follow general StatsManager format
emilydolson May 29, 2016
2149343
LineageTracker and OEEStats now follow general StatsManager format
emilydolson May 29, 2016
4fd1544
Merge branch 'master' of github.com:emilydolson/Empirical
emilydolson May 29, 2016
0a6b803
Lineage tracker automatically hooks up to OEE stats
emilydolson May 29, 2016
97f0ffb
Automatic lineage tracker construction works
emilydolson May 29, 2016
adadaac
Made stats generic and moved them to tools
emilydolson May 29, 2016
a92e954
Merge branch 'master' of github.com:devosoft/Empirical
emilydolson May 30, 2016
a80244f
Fixed g++ compilation bug
emilydolson May 31, 2016
a6897a1
Stats Manager headers + assorted cleanup
emilydolson Jun 1, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed tournament selection to only choose from valid orgs
  • Loading branch information
emilydolson committed May 19, 2016
commit e6629c81b58c5364355b65fb7ad18ad7c744d8f2
37 changes: 31 additions & 6 deletions evo/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,23 @@ namespace evo {
popM.Print(os, empty, spacer);
}

//Helper function to return PopulationManager indices of
//all organisms that are not null
emp::vector<int> GetValidOrgIndices(){
int count = 0;
emp::vector<int> valid_orgs;
valid_orgs.resize(popM.size());
for (int i = 0; i < popM.size(); ++i){
if (this->IsOccupied(i)){
valid_orgs.push_back(i);
count++;
}
}

valid_orgs.resize(count);
return valid_orgs;
}

// Selection mechanisms choose organisms for the next generation.

// Elite Selection picks a set of the most fit individuals from the population to move to
Expand Down Expand Up @@ -331,14 +348,17 @@ namespace evo {
// Helper function to run a tournament when fitness is pre-calculated
void RunTournament(const emp::vector<double> & fitness, int t_size, int tourny_count=1){
emp_assert(random_ptr != nullptr && "TournamentSelect() requires active random_ptr");

emp::vector<int> valid_orgs = GetValidOrgIndices();

for (int T = 0; T < tourny_count; T++) {
emp::vector<int> entries = Choose(*random_ptr, popM.size(), t_size);
double best_fit = fitness[entries[0]];
emp::vector<int> entries = Choose(*random_ptr, valid_orgs.size(), t_size);
double best_fit = fitness[valid_orgs[entries[0]]];
int best_id = entries[0];

// Search for a higher fit org in the tournament.
for (int i = 1; i < t_size; i++) {
const double cur_fit = fitness[entries[i]];
const double cur_fit = fitness[valid_orgs[entries[i]]];
if (cur_fit > best_fit) {
best_fit = cur_fit;
best_id = entries[i];
Expand All @@ -353,14 +373,19 @@ namespace evo {
// Helper function to run a tournament when fitness is NOT pre-calculated
void RunTournament(std::function<double(ORG*)> fit_fun, int t_size, int tourny_count=1){
emp_assert(random_ptr != nullptr && "TournamentSelect() requires active random_ptr");

//This technique for avoiding null orgs can probably be improved
//once org managers are handling that
emp::vector<int> valid_orgs = GetValidOrgIndices();

for (int T = 0; T < tourny_count; T++) {
emp::vector<int> entries = Choose(*random_ptr, popM.size(), t_size);
double best_fit = fit_fun(popM[entries[0]]);
emp::vector<int> entries = Choose(*random_ptr, valid_orgs.size(), t_size);
double best_fit = fit_fun(popM[valid_orgs[entries[0]]]);
int best_id = entries[0];

// Search for a higher fit org in the tournament.
for (int i = 1; i < t_size; i++) {
const double cur_fit = fit_fun(popM[entries[i]]);
const double cur_fit = fit_fun(popM[valid_orgs[entries[i]]]);
if (cur_fit > best_fit) {
best_fit = cur_fit;
best_id = entries[i];
Expand Down