xor_sim (faber_tweann v2.4.0)

View Source

XOR scape. The module examples/xor/src/morphology_xor.erl has declared scape = {private, xor_sim} since the repository was created, and until now no such module existed.

Presents the four XOR cases once each per evaluation, in fixed order, and accumulates squared error.

Encoding is Sher's (Handbook Ch 7): -1.0/1.0 rather than 0.0/1.0, matching the tanh output range of the default neuron.

[-1, -1] -> -1 [ 1, -1] -> 1 [-1, 1] -> 1 [ 1, 1] -> -1

Fitness

Lifetime-based, as in DXNN2: 0.0 on the first three cases, the real value once at the end. Fitness is 1/(RMSE + epsilon), so a perfect network scores very large but finite.

goal_reached

Returned instead of a plain halt when all four cases land within tolerance of their target. This is what lets the population monitor freeze total_evaluations at the moment of solution; without it, evaluations-to-solve is unmeasurable and no comparison against published figures is possible.

The tolerance-based test is deliberate rather than a fitness threshold: fitness here is continuous and unbounded, so any threshold would be arbitrary and would drift with the epsilon.

Summary

Functions

Score the output against the current case.

The four XOR cases as {Inputs, Target}.

Fresh state: all four cases pending.

Serve the current case's inputs, advancing to it on first request.

Distance from target within which an output counts as correct.

Functions

act(ActuatorName, Params, Output, State)

Score the output against the current case.

cases()

The four XOR cases as {Inputs, Target}.

init(Params)

Fresh state: all four cases pending.

sense(SensorName, Params, State)

Serve the current case's inputs, advancing to it on first request.

The scape advances on sense rather than on act because the sensor always fires before the actuator within one sense-think-act cycle.

tolerance()

Distance from target within which an output counts as correct.