summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/explicitsimulation.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/explicitsimulation.cpp b/src/explicitsimulation.cpp
index 3e4edc3..b9693b5 100644
--- a/src/explicitsimulation.cpp
+++ b/src/explicitsimulation.cpp
@@ -131,11 +131,18 @@ Genetic::PhenotypeId Genetic::ExplicitSimulation::selectWeighted()
131 if( dSel < dRun ) 131 if( dSel < dRun )
132 return i.getKey(); 132 return i.getKey();
133 } 133 }
134 134/*
135 sio << "Genetic::ExplicitSimulation::selectWeighted() - failed, picked max" 135 sio << "Genetic::ExplicitSimulation::selectWeighted() - failed, picked random"
136 << sio.nl; 136 << sio.nl;
137 sio << " " << dMinFitness << " - " << dMaxFitness << " -- " << dTotalFitness << " > " << dRun << " > " << dSel << sio.nl; 137 sio << " " << dMinFitness << " - " << dMaxFitness << " -- " << dTotalFitness << " > " << dRun << " > " << dSel << sio.nl;
138 abort(); 138// abort();
139*/
140 int iSel = Bu::Random::rand( hFitness.getSize() );
141 for( FitnessHash::iterator i = hFitness.begin(); i; i++ )
142 {
143 if( --iSel <= 0 )
144 return i.getKey();
145 }
139 146
140 return uMaxFitness; 147 return uMaxFitness;
141} 148}