MCPcopy Create free account
hub / github.com/FareedKhan-dev/ai-long-task / _sample_parent

Method _sample_parent

data/database.py:1276–1294  ·  view source on GitHub ↗

Sample a parent program from the current island for the next evolution step Returns: Parent program from current island

(self)

Source from the content-addressed store, hash-verified

1274 )
1275
1276 def _sample_parent(self) -> Program:
1277 """
1278 Sample a parent program from the current island for the next evolution step
1279
1280 Returns:
1281 Parent program from current island
1282 """
1283 # Use exploration_ratio and exploitation_ratio to decide sampling strategy
1284 rand_val = random.random()
1285
1286 if rand_val < self.config.exploration_ratio:
1287 # EXPLORATION: Sample from current island (diverse sampling)
1288 return self._sample_exploration_parent()
1289 elif rand_val < self.config.exploration_ratio + self.config.exploitation_ratio:
1290 # EXPLOITATION: Sample from archive (elite programs)
1291 return self._sample_exploitation_parent()
1292 else:
1293 # RANDOM: Sample from any program (remaining probability)
1294 return self._sample_random_parent()
1295
1296 def _sample_exploration_parent(self) -> Program:
1297 """

Callers 1

sampleMethod · 0.95

Tested by

no test coverage detected