scape behaviour (faber_tweann v2.4.0)
View SourceThe scape: the environment a neural network is evaluated in.
A scape is an independent process, spawned by the exoself before the sensors, neurons and actuators, and terminated before the cortex. It owns the problem state and is the ONLY source of fitness.
Why this module exists
faber-tweann shipped without any scape. #sensor.scape and #actuator.scape were declared in the morphologies and read by nobody, sensors returned zeros for unrecognised names, actuators passed their input through, and exoself computed fitness as the sum of the network's own outputs. No end-to-end evolutionary run had ever completed. See faber-ecosystem/docs/CONFORMANCE.md and insight 001.
Protocol
Verbatim from DXNN2 (see faber-ecosystem/docs/PROTOCOL.md). The wire format matters: the Ch 13 benchmarker and the Ch 16 substrate encoding both assume it.
sensor -> scape {SensorPid, sense, Name, Params} scape -> sensor {ScapePid, percept, SensoryVector} actuator -> scape {ActuatorPid, action, Name, Params, Output} scape -> actuator {ScapePid, Fitness, HaltFlag} exoself -> scape {ExoSelfPid, terminate}
HaltFlag is 0 to continue, 1 to end the evaluation, or the atom goal_reached when the scape has decided the task is solved. goal_reached propagates through actuator and cortex to the exoself so that evaluations-to-solve can be recorded; without it that metric is unmeasurable, which is the whole reason Table 14.1 comparison was blocked.
Departure from DXNN2
Sher implements every scape as a function inside one scape module (a scape_xor_sim function inside it). Here scape is a generic process that dispatches to a callback module implementing the scape behaviour. The morphologies already declare scapes as atoms (scape = {private, xor_sim}), so dispatching to a module of that name is both more faithful to the declaration and extensible without editing a shared file. The wire protocol is unchanged.
Summary
Functions
Spawn a scape process on the local node.
Spawn and immediately name it, for callers that have the name to hand.