-
Notifications
You must be signed in to change notification settings - Fork 7
Examples
All examples are in the examples/ directory and are built as standalone executables. Each follows the same pattern: create a simulation, build elements, wire interactions, set up plots, and run the application loop.
Source: examples/ex_field_couplings.cpp
Executable: ex_field_couplings
Demonstrates field-to-field coupling across three neural fields representing different temporal contexts: past, present, and next.
Architecture:
- Three
NeuralFieldelements, each with its own lateral interaction kernel and Gaussian stimulus - Two
FieldCouplingelements bridging past→present and present→next - Heatmap plots for both coupling weight matrices
Key concepts: multi-field architectures, field coupling topology, heatmap visualization of weight matrices
Source: examples/ex_field_coupling_learning.cpp
Executable: ex_field_coupling_learning
Shows how FieldCoupling weights evolve online through co-activation of a source and target field.
Key concepts: Hebbian learning, enabling/disabling learning at runtime (setLearning(true)), watching weight matrices form over time
Source: examples/ex_gauss_and_field_couplings.cpp
Executable: ex_gauss_and_field_couplings
Combines GaussFieldCoupling (fixed Gaussian basis) and FieldCoupling (learned) in the same architecture.
Key concepts: comparing fixed vs. learnable coupling profiles
Source: examples/ex_complementary_action_selection.cpp
Executable: ex_comp_act_selection
A classic DNF application: two competing neural fields that implement a winner-take-all (WTA) mechanism. When one field forms a stable bump, it suppresses the other through inhibitory coupling.
Key concepts: competitive dynamics, inhibitory field coupling, action selection via DNF
Source: examples/ex_asymmetric_gauss_kernel.cpp
Executable: ex_asymmetric_gauss_kernel
Demonstrates the AsymmetricGaussKernel and its effect on bump dynamics. The asymmetric component (controlled by timeShift) introduces directional drift in the activity bump.
Key concepts: asymmetric lateral interactions, bump propagation, timeShift parameter tuning
Source: examples/ex_two_robot_team.cpp
Executable: ex_two_robot_team
A larger architecture modelling coordination between two robotic agents using DNF. Fields represent spatial locations and task-relevant dimensions; couplings encode the joint-task constraints.
Key concepts: multi-agent DNF architectures, spatial encoding, coupling-based coordination
Source: examples/ex_grand_architecture.cpp
Executable: ex_grand_architecture
A large, comprehensive DNF architecture combining many element types across multiple coupled fields. Useful as a stress test and as a template for complex real-world architectures.
Key concepts: scaling to many elements, organizing large architectures, performance
Source: examples/ex_packaging_task.cpp
Executable: ex_packaging_task
A task-specific simulation modelling a packaging or manipulation scenario using DNF. Fields represent object properties and spatial locations; couplings encode task constraints between them.
Key concepts: task-oriented DNF design, domain-specific field architecture
Source: examples/ex_cross_dimension_kernels.cpp
Executable: ex_cross_dimension_kernels
Demonstrates kernels that couple two neural fields of different spatial dimensions. A cross-dimension kernel projects activity from a source field onto a target field of different size, enabling multi-scale or heterogeneous field architectures.
Key concepts: cross-dimension coupling, kernel resampling, multi-scale DNF architectures
Source: examples/ex_boost_stimulus.cpp
Executable: ex_boost_stimulus
Demonstrates the BoostStimulus element as a global gain control mechanism. The boost raises the entire field's resting level, pushing it closer to or above the detection threshold without providing any spatial information.
Architecture:
- One
NeuralFieldwith aMexicanHatKernelfor lateral interactions - One
GaussStimulusproviding a localized spatial input - One
BoostStimulusproviding a spatially uniform activation boost -
NormalNoisefor sub-threshold fluctuations
Key concepts: global input vs. spatial input, resting-level control, on/off gating with isActive, how a boost interacts with detection threshold
Source: examples/ex_memory_trace.cpp
Executable: ex_memory_trace
Demonstrates the MemoryTrace element as a working memory mechanism. A GaussStimulus drives the neural field into a self-sustained peak; the stimulus can then be turned off at runtime by setting its amplitude to zero via the element parameter panel. After it is removed, the memory trace retains an excitatory footprint that facilitates re-activation at the same location.
Architecture:
- One
NeuralFieldwith aMexicanHatKernelfor lateral interactions andNormalNoise - One
GaussStimulusas a transient cue - One
MemoryTracereceiving the field's sigmoid output - One
GaussKernelprojecting the memory trace back into the field as weak excitatory input
Key concepts: dual-timescale learning, working memory through trace feedback, tauBuild / tauDecay parameter tuning, history-dependent field dynamics
Every example follows this structure:
// 1. Simulation + visualization + app
auto simulation = std::make_shared<Simulation>("name", deltaT);
auto visualization = std::make_shared<Visualization>(simulation);
Application app{ simulation, visualization };
// 2. Windows
app.addWindow<user_interface::MainMenuBar>();
app.addWindow<user_interface::StaticLayoutWindow>(simulation, visualization);
// 3. Elements
ElementFactory factory;
auto field = factory.createElement(NEURAL_FIELD, commonParams, fieldParams);
auto kernel = factory.createElement(MEXICAN_HAT_KERNEL, commonParams, kernelParams);
// ...
// 4. Register
simulation->addElement(field);
simulation->addElement(kernel);
// 5. Wire
field->addInput(kernel);
kernel->addInput(field);
// 6. Plots
visualization->plot(commonPlotParams, LinePlotParameters{},
{ { field->getUniqueName(), "activation" } });
// 7. Loop
app.init();
while (!app.hasGUIBeenClosed())
app.step();
app.close();