Welvet examples

34. systems/evolution

Open original example ↗Recorded results · not a live execution

Part: V · Systems
Package: github.com/openfluke/welvet/systems/evolution
Status: ok — ✅

When

Adaptation, measurement, or evolution (systems/evolution).

Where

import "github.com/openfluke/welvet/systems/evolution"

cd 34-evolution && source ../env.sh && go run .

Why

Topology search and weight crossover need first-class splice + NEAT on CPU-resident grids.

What

SpliceDNA, NEATMutate, NewNEATPopulation, CloneGrid — dtype/quant preserved via SetFromF32.

Sample output (captured)

<nil>

Live capture from go run ./cmd/runall on local ../../welvet (exit 0).

Source

Copied from the Welvet feature book examples (openfluke.github.io/welvet/examples/34-evolution).

main.go

Download source ↓
package main

import (
	"fmt"

	"github.com/openfluke/welvet/architecture"
	"github.com/openfluke/welvet/systems/evolution"
)

func main() {
	a, b := architecture.NewGrid(1, 1, 1, 1), architecture.NewGrid(1, 1, 1, 1)
	child, err := evolution.SpliceDNA(a, b, evolution.DefaultSpliceConfig())
	if err != nil {
		fmt.Println(err)
		return
	}
	_, err = evolution.NEATMutate(child, evolution.DefaultNEATConfig(16))
	fmt.Println(err)
}