人工生命模拟器无结果输出:进化人工生物全部死亡问题求助
Troubleshooting Total Extinction in Your Artificial Biological Evolution Experiment
First off, let's break down the likely culprits behind your total population wipe—this is a super common pain point when starting out with evolutionary neural networks, so you're not alone here.
Possible Root Causes
- Initial Neural Network Viability: You're starting with ~8 random input-output connected neurons for non-asexual initial organisms, but random connections don't guarantee even basic functionality. If none of these initial organisms can produce outputs that keep them "alive" (whatever your fitness/survival criteria are), they'll die off before any mutations can save the population.
- Overly Aggressive Mutation: A 25% mutation rate is really high—most evolutionary setups use rates in the 0.1-5% range. At 25%, you're almost certainly destroying any fragile functional weights that might emerge, rather than refining them. Unconstrained mutations (like huge random weight jumps) can break even a "good" network in one step.
- Fitness Function Blind Spots: If your fitness function doesn't reward incremental progress (like just being able to process inputs without crashing, or producing any non-random output), there's no path for evolution to build up viable networks. For example, if survival requires perfect task performance right away, random initial networks have zero chance.
- Abrupt Architecture Scaling: Your setup allows up to 25 hidden neurons, but initial organisms only have 8 input-output neurons. If mutations can't gradually add hidden neurons over generations, you might be stuck with networks that can't learn complex enough behaviors to survive.
Actionable Fixes to Try
- Bootstrap Initial Viability: Instead of fully random initial neurons, seed a few organisms with minimally functional networks. For example, create networks that map a subset of inputs directly to outputs (even if not optimal) to ensure at least some initial survival. You can also start with smaller input/output sets and scale up once you have a stable population.
- Tune Mutation Parameters: Drop that mutation rate to 1-5% first. Add mutation magnitude control—limit mutations to small adjustments (e.g., ±0.1 or ±0.5 around existing weights) instead of random extreme values. For structural mutations (adding hidden neurons), make those even rarer (like 0.1% chance per generation).
- Refine Your Fitness Function: Add "survival bonuses" for basic functionality:
- Reward networks that produce outputs within a valid range (no NaNs or extreme values)
- Give small fitness points for any input-output correlation, even if it's not the desired behavior
- Gradually increase the fitness threshold as the population stabilizes
- Gradual Architecture Evolution: Start with 0 hidden neurons (just input-output) and only allow mutations that add hidden neurons once the population has mastered basic input-output mapping. This lets evolution build complexity incrementally.
- Loosen Survival Criteria: If organisms die after one generation without meeting a strict threshold, let them survive for 2-3 generations even with low fitness—this gives mutations time to find a path forward.
Quick sanity check: Have you verified your neural network code works outside the evolution loop? Test a manually created network to ensure it processes inputs, produces outputs, and your fitness calculation correctly evaluates performance. Sometimes the issue is a bug in network logic, not the evolution setup.
Hope these tips help you get your population back on track—evolutionary algorithms are all about iterating on these parameters, so don't get discouraged!
内容的提问来源于stack exchange,提问作者Sam
相关产品推荐
相关产品推荐

