Current section

Files

Jump to
faber_tweann assets neat-evolution.svg
Raw

assets/neat-evolution.svg

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 700">
<defs>
<linearGradient id="nodeGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#2196F3;stop-opacity:1" />
<stop offset="100%" style="stop-color:#1565C0;stop-opacity:1" />
</linearGradient>
<linearGradient id="newNodeGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#4CAF50;stop-opacity:1" />
<stop offset="100%" style="stop-color:#2E7D32;stop-opacity:1" />
</linearGradient>
<linearGradient id="mutationGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#FF5722;stop-opacity:1" />
<stop offset="100%" style="stop-color:#D84315;stop-opacity:1" />
</linearGradient>
<marker id="arrow" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#666"/>
</marker>
<marker id="greenArrow" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#4CAF50"/>
</marker>
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="2" dy="2" stdDeviation="2" flood-opacity="0.2"/>
</filter>
</defs>
<!-- Background -->
<rect width="900" height="700" fill="#f8f9fa"/>
<!-- Title -->
<text x="450" y="35" font-family="Arial, sans-serif" font-size="22" font-weight="bold" text-anchor="middle" fill="#333">
NEAT Topology Evolution: Structural Mutations
</text>
<!-- === ORIGINAL NETWORK (Top Left) === -->
<rect x="30" y="60" width="260" height="200" rx="10" fill="white" stroke="#ddd" stroke-width="1" filter="url(#shadow)"/>
<text x="160" y="85" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="#333">
Generation 0: Initial Network
</text>
<!-- Original network nodes -->
<circle cx="80" cy="140" r="18" fill="url(#nodeGrad)"/>
<text x="80" y="145" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">In</text>
<circle cx="240" cy="140" r="18" fill="url(#nodeGrad)"/>
<text x="240" y="145" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">Out</text>
<!-- Original connection -->
<line x1="98" y1="140" x2="222" y2="140" stroke="#666" stroke-width="2"/>
<text x="160" y="135" font-family="monospace" font-size="9" text-anchor="middle" fill="#666">w=0.8</text>
<text x="160" y="180" font-family="monospace" font-size="10" text-anchor="middle" fill="#666">
Genes: [(1,2,0.8,enabled)]
</text>
<text x="160" y="195" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="#888">
Innovation: 1
</text>
<!-- Arrow to add_node mutation -->
<path d="M 295 160 L 330 160" stroke="#4CAF50" stroke-width="2" marker-end="url(#greenArrow)"/>
<text x="312" y="150" font-family="Arial, sans-serif" font-size="10" fill="#4CAF50">add_node</text>
<!-- === ADD NODE MUTATION (Top Right) === -->
<rect x="340" y="60" width="260" height="200" rx="10" fill="white" stroke="#4CAF50" stroke-width="2" filter="url(#shadow)"/>
<text x="470" y="85" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="#333">
add_node Mutation
</text>
<!-- Network with new node -->
<circle cx="380" cy="140" r="18" fill="url(#nodeGrad)"/>
<text x="380" y="145" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">In</text>
<circle cx="470" cy="140" r="18" fill="url(#newNodeGrad)"/>
<text x="470" y="145" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">H</text>
<text x="470" y="175" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="#4CAF50">NEW!</text>
<circle cx="560" cy="140" r="18" fill="url(#nodeGrad)"/>
<text x="560" y="145" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">Out</text>
<!-- New connections -->
<line x1="398" y1="140" x2="452" y2="140" stroke="#4CAF50" stroke-width="2"/>
<text x="425" y="135" font-family="monospace" font-size="8" text-anchor="middle" fill="#4CAF50">w=1.0</text>
<line x1="488" y1="140" x2="542" y2="140" stroke="#4CAF50" stroke-width="2"/>
<text x="515" y="135" font-family="monospace" font-size="8" text-anchor="middle" fill="#4CAF50">w=0.8</text>
<!-- Old connection (disabled) -->
<line x1="398" y1="155" x2="542" y2="155" stroke="#ccc" stroke-width="1" stroke-dasharray="4,2"/>
<text x="470" y="168" font-family="monospace" font-size="8" text-anchor="middle" fill="#aaa">(disabled)</text>
<text x="470" y="205" font-family="monospace" font-size="9" text-anchor="middle" fill="#666">
Genes: [(1,3,1.0,en), (3,2,0.8,en), (1,2,disabled)]
</text>
<text x="470" y="220" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="#888">
Innovations: 1, 2, 3
</text>
<!-- Arrow to add_connection mutation -->
<path d="M 605 160 L 640 160" stroke="#FF5722" stroke-width="2" marker-end="url(#arrow)"/>
<text x="612" y="150" font-family="Arial, sans-serif" font-size="9" fill="#FF5722">add_link</text>
<!-- === ADD CONNECTION MUTATION (Top Far Right) === -->
<rect x="650" y="60" width="230" height="200" rx="10" fill="white" stroke="#FF5722" stroke-width="2" filter="url(#shadow)"/>
<text x="765" y="85" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="#333">
add_link Mutation
</text>
<!-- Network with additional connection -->
<circle cx="690" cy="140" r="16" fill="url(#nodeGrad)"/>
<text x="690" y="144" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">In</text>
<circle cx="765" cy="140" r="16" fill="url(#newNodeGrad)"/>
<text x="765" y="144" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">H</text>
<circle cx="840" cy="140" r="16" fill="url(#nodeGrad)"/>
<text x="840" y="144" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="white">Out</text>
<!-- Connections -->
<line x1="706" y1="140" x2="749" y2="140" stroke="#666" stroke-width="1.5"/>
<line x1="781" y1="140" x2="824" y2="140" stroke="#666" stroke-width="1.5"/>
<!-- New direct connection (skip) -->
<path d="M 706 150 Q 765 190 824 150" stroke="#FF5722" stroke-width="2" fill="none"/>
<text x="765" y="185" font-family="monospace" font-size="8" text-anchor="middle" fill="#FF5722">NEW: w=0.3</text>
<text x="765" y="215" font-family="monospace" font-size="8" text-anchor="middle" fill="#666">
Skip connection added
</text>
<text x="765" y="230" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="#888">
Innovation: 4
</text>
<!-- === WEIGHT MUTATION (Bottom Left) === -->
<rect x="30" y="280" width="260" height="180" rx="10" fill="white" stroke="#9C27B0" stroke-width="2" filter="url(#shadow)"/>
<text x="160" y="305" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="#333">
Weight Mutation
</text>
<!-- Before weights -->
<text x="80" y="335" font-family="Arial, sans-serif" font-size="11" fill="#666">Before:</text>
<rect x="60" y="345" width="180" height="25" rx="4" fill="#f0f0f0"/>
<text x="150" y="362" font-family="monospace" font-size="10" text-anchor="middle" fill="#666">
w = 0.8
</text>
<!-- After weights -->
<text x="80" y="395" font-family="Arial, sans-serif" font-size="11" fill="#9C27B0">After:</text>
<rect x="60" y="405" width="180" height="25" rx="4" fill="#f3e5f5"/>
<text x="150" y="422" font-family="monospace" font-size="10" text-anchor="middle" fill="#9C27B0">
w = 0.8 + gaussian(0, 0.1) = 0.73
</text>
<text x="160" y="455" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="#888">
Perturb or replace with new random value
</text>
<!-- === CROSSOVER (Bottom Center) === -->
<rect x="310" y="280" width="280" height="180" rx="10" fill="white" stroke="#2196F3" stroke-width="2" filter="url(#shadow)"/>
<text x="450" y="305" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="#333">
Crossover (Sexual Reproduction)
</text>
<!-- Parent 1 genes -->
<text x="330" y="335" font-family="Arial, sans-serif" font-size="10" fill="#666">Parent A (more fit):</text>
<rect x="330" y="340" width="30" height="20" rx="3" fill="#4CAF50"/>
<text x="345" y="354" font-family="monospace" font-size="8" text-anchor="middle" fill="white">1</text>
<rect x="365" y="340" width="30" height="20" rx="3" fill="#4CAF50"/>
<text x="380" y="354" font-family="monospace" font-size="8" text-anchor="middle" fill="white">2</text>
<rect x="400" y="340" width="30" height="20" rx="3" fill="#FF9800"/>
<text x="415" y="354" font-family="monospace" font-size="8" text-anchor="middle" fill="white">3</text>
<rect x="435" y="340" width="30" height="20" rx="3" fill="#4CAF50"/>
<text x="450" y="354" font-family="monospace" font-size="8" text-anchor="middle" fill="white">5</text>
<!-- Parent 2 genes -->
<text x="330" y="380" font-family="Arial, sans-serif" font-size="10" fill="#666">Parent B:</text>
<rect x="330" y="385" width="30" height="20" rx="3" fill="#2196F3"/>
<text x="345" y="399" font-family="monospace" font-size="8" text-anchor="middle" fill="white">1</text>
<rect x="365" y="385" width="30" height="20" rx="3" fill="#2196F3"/>
<text x="380" y="399" font-family="monospace" font-size="8" text-anchor="middle" fill="white">2</text>
<rect x="400" y="385" width="30" height="20" rx="3" fill="#ccc"/>
<text x="415" y="399" font-family="monospace" font-size="8" text-anchor="middle" fill="white">-</text>
<rect x="435" y="385" width="30" height="20" rx="3" fill="#2196F3"/>
<text x="450" y="399" font-family="monospace" font-size="8" text-anchor="middle" fill="white">4</text>
<!-- Offspring -->
<text x="330" y="425" font-family="Arial, sans-serif" font-size="10" fill="#9C27B0">Offspring:</text>
<rect x="330" y="430" width="30" height="20" rx="3" fill="#9C27B0"/>
<text x="345" y="444" font-family="monospace" font-size="8" text-anchor="middle" fill="white">1</text>
<rect x="365" y="430" width="30" height="20" rx="3" fill="#9C27B0"/>
<text x="380" y="444" font-family="monospace" font-size="8" text-anchor="middle" fill="white">2</text>
<rect x="400" y="430" width="30" height="20" rx="3" fill="#FF9800"/>
<text x="415" y="444" font-family="monospace" font-size="8" text-anchor="middle" fill="white">3</text>
<rect x="435" y="430" width="30" height="20" rx="3" fill="#2196F3"/>
<text x="450" y="444" font-family="monospace" font-size="8" text-anchor="middle" fill="white">4</text>
<rect x="470" y="430" width="30" height="20" rx="3" fill="#FF9800"/>
<text x="485" y="444" font-family="monospace" font-size="8" text-anchor="middle" fill="white">5</text>
<text x="540" y="360" font-family="Arial, sans-serif" font-size="9" fill="#FF9800">Disjoint</text>
<text x="540" y="375" font-family="Arial, sans-serif" font-size="9" fill="#FF9800">genes</text>
<!-- === SPECIATION (Bottom Right) === -->
<rect x="610" y="280" width="270" height="180" rx="10" fill="white" stroke="#FF9800" stroke-width="2" filter="url(#shadow)"/>
<text x="745" y="305" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="#333">
Speciation
</text>
<text x="745" y="330" font-family="Arial, sans-serif" font-size="11" text-anchor="middle" fill="#666">
Compatibility Distance:
</text>
<text x="745" y="355" font-family="monospace" font-size="11" text-anchor="middle" fill="#333">
d = c1*E/N + c2*D/N + c3*W
</text>
<!-- Species circles -->
<circle cx="670" cy="400" r="35" fill="none" stroke="#4CAF50" stroke-width="2"/>
<circle cx="660" cy="395" r="8" fill="#4CAF50"/>
<circle cx="680" cy="390" r="8" fill="#4CAF50"/>
<circle cx="670" cy="410" r="8" fill="#4CAF50"/>
<text x="670" y="445" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="#4CAF50">Species 1</text>
<circle cx="760" cy="400" r="35" fill="none" stroke="#2196F3" stroke-width="2"/>
<circle cx="750" cy="395" r="8" fill="#2196F3"/>
<circle cx="770" cy="405" r="8" fill="#2196F3"/>
<text x="760" y="445" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="#2196F3">Species 2</text>
<circle cx="840" cy="400" r="25" fill="none" stroke="#FF9800" stroke-width="2"/>
<circle cx="840" cy="400" r="8" fill="#FF9800"/>
<text x="840" y="435" font-family="Arial, sans-serif" font-size="9" text-anchor="middle" fill="#FF9800">Species 3</text>
<!-- Legend -->
<rect x="30" y="480" width="850" height="90" rx="8" fill="white" stroke="#ddd" stroke-width="1"/>
<text x="455" y="505" font-family="Arial, sans-serif" font-size="14" font-weight="bold" text-anchor="middle" fill="#333">
NEAT Innovation Numbers
</text>
<text x="50" y="535" font-family="Arial, sans-serif" font-size="11" fill="#333">
Each new structural mutation gets a unique innovation number, enabling:
</text>
<text x="70" y="555" font-family="Arial, sans-serif" font-size="10" fill="#666">
1. Tracking homologous genes across genomes (same innovation = same structure)
</text>
<text x="475" y="555" font-family="Arial, sans-serif" font-size="10" fill="#666">
2. Meaningful crossover alignment
</text>
<text x="70" y="570" font-family="Arial, sans-serif" font-size="10" fill="#666">
3. Computing compatibility distance for speciation
</text>
<text x="475" y="570" font-family="Arial, sans-serif" font-size="10" fill="#666">
4. Historical markings that persist across generations
</text>
<!-- Footer reference -->
<text x="455" y="590" font-family="Arial, sans-serif" font-size="10" font-style="italic" text-anchor="middle" fill="#888">
Based on: K. Stanley and R. Miikkulainen, "Evolving Neural Networks through Augmenting Topologies" (2002)
</text>
<!-- Innovation Timeline -->
<rect x="30" y="595" width="850" height="90" rx="8" fill="#fafafa" stroke="#ddd" stroke-width="1"/>
<text x="455" y="620" font-family="Arial, sans-serif" font-size="13" font-weight="bold" text-anchor="middle" fill="#333">
Innovation Timeline
</text>
<line x1="80" y1="655" x2="830" y2="655" stroke="#ddd" stroke-width="2"/>
<!-- Timeline markers -->
<circle cx="120" cy="655" r="12" fill="#666"/>
<text x="120" y="660" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">1</text>
<text x="120" y="680" font-family="Arial, sans-serif" font-size="8" text-anchor="middle" fill="#666">Initial</text>
<circle cx="280" cy="655" r="12" fill="#4CAF50"/>
<text x="280" y="660" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">2</text>
<text x="280" y="680" font-family="Arial, sans-serif" font-size="8" text-anchor="middle" fill="#4CAF50">add_node</text>
<circle cx="440" cy="655" r="12" fill="#4CAF50"/>
<text x="440" y="660" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">3</text>
<text x="440" y="680" font-family="Arial, sans-serif" font-size="8" text-anchor="middle" fill="#4CAF50">add_node</text>
<circle cx="600" cy="655" r="12" fill="#FF5722"/>
<text x="600" y="660" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">4</text>
<text x="600" y="680" font-family="Arial, sans-serif" font-size="8" text-anchor="middle" fill="#FF5722">add_link</text>
<circle cx="760" cy="655" r="12" fill="#9C27B0"/>
<text x="760" y="660" font-family="Arial, sans-serif" font-size="10" text-anchor="middle" fill="white">...</text>
<text x="760" y="680" font-family="Arial, sans-serif" font-size="8" text-anchor="middle" fill="#9C27B0">future</text>
</svg>