Collektive

website·Indexed 30 days ago

https://collektive.github.io

A Kotlin-first framework for aggregate programming in collective systems. It provides a Domain Specific Language (DSL) and compiler plugin for developing scalable distributed systems, featuring constructs for field calculus and aggregate contexts.

Tokens
6.4K
Snippets
21
Records
42
Agent score
75%

What's inside Collektive

  1. Overview of Collektive Framework

    Collektive is a scalable, Kotlin-first framework for designing collective systems. It features a type-safe DSL for system design, a composable architecture based on reusable collective functions, and a Practical Aggregate Language that utilizes aggregate operators. The framework is fully multiplatform, supporting JVM, JS, Native, Android, and iOS.
  2. Overview of Aggregate Operators in Collektive DSL

    The DSL provides several operators to manipulate fields and model device behavior:

    • exchange: Core operator for custom, anisotropic interaction with neighbors.
    • exchanging: Related to the exchange process.
    • share / sharing: Models the space-time evolution of the device.
    • neighboring / neighboringViaExchange: Provides access to neighbor values and allows sending information to them.
    • evolve / evolving: Models the state evolution of the device over time.
  3. Overview of FieldVMC and its relationship to VMC

    FieldVMC is a generalization of the Vascular Morphogenesis Controller (VMC) model, reinterpreting VMC dynamics as an aggregate field computation. While the original VMC assumes a tree structure (directed acyclic graph with a single root) and synchronous updates, FieldVMC enables decentralized and asynchronous execution over arbitrary undirected graphs. Hierarchical structures in FieldVMC emerge from local self-organizing interactions rather than an explicitly maintained tree. FieldVMC is a monotonic extension of VMC, meaning it can reproduce VMC behaviors while adding capabilities for structure merging, splitting, and optimization, and is self-stabilizing under eventual quiescence.
  4. Overview of the Collektive framework

    Collektive is an open-source framework based on the principles of Aggregate Programming. It is designed to simplify the development of self-organizing collective behaviors in dynamic, distributed environments (such as IoT devices, drone swarms, or sensor networks). The framework abstracts low-level device interactions and communication, allowing developers to focus on high-level coordination logic using a declarative approach—describing what the system should achieve rather than managing individual device states manually.
  5. Overview of the Aggregate Programming paradigm

    Aggregate Programming (AP) is a macroprogramming approach designed for dynamic networks, particularly in IoT and distributed systems. It focuses on the functional composition of reusable collective behavior blocks to achieve complex and resilient behaviors in environments characterized by heterogeneous, resource-constrained devices, frequent failures, and unpredictable topologies.
  6. Understand the Field data structure in Collektive

    A Field is a data structure used by devices in a network to map device IDs to their local values within a neighborhood (the set of directly connected devices). Each field contains the device's own localId, its localValue, and a map of neighbors containing the IDs and values of all connected devices.

    Example of a field for an isolated device (ID 0) with value 0: ϕ(localId=0, localValue=0, neighbors={})

    Example of a field for device 0 (value 5) connected to device 1 (value 10) and device 2 (value 15): ϕ(localId=0, localValue=5, neighbors={1=10, 2=15})

  7. Understand Field Calculus Constructs in Aggregate Programming

    Field Calculus is the lowest software layer in aggregate programming, providing an interface between the system and the device infrastructure. It introduces the concept of a 'field', where each networked device contributes a local value to form a distributed structure. Key capabilities include:

    • Distributed Computation: Executing built-in or user-defined logic on data across the system (e.g., sensor readings).
    • State Evolution: Modeling how local device state changes based on previous states and environment inputs.
    • Neighbor Interaction: Collecting and aggregating information from neighboring devices to support spatial computations (e.g., detecting the closest node).
    • Conditional Branching: Partitioning the network into regions that execute different operations based on local or global conditions.
  8. Understand the Collektive project submodule architecture

    The Collektive project is organized into several specialized submodules that handle different aspects of aggregate computing and simulation:

    • collektive-dsl: Core implementation of the Domain-Specific Language (DSL) for aggregate computing, containing the operators and logic.
    • collektive-stdlib: Standard library providing essential functions and utilities for aggregate computing operations.
    • collektive-compiler-plugin: Consists of a frontend (validates DSL code for dangerous or inappropriate patterns) and a backend (modifies the runtime stack data structure to register function names upon calls).
    • collektive-compiler-embeddable: Contains compiler-embedded, an embeddable version of the compiler for integration into other projects to extend or customize compilation features.
    • collektive-gradle-plugin: A Gradle plugin required to include and apply the compiler plugin to Gradle-based projects.
    • alchemist-incarnation-collektive: An implementation of Collektive specifically for the Alchemist simulator (a distributed systems simulation framework).
  9. Implement field-based runtime task replanning for multi-robot systems

    Field-based runtime task replanning, grounded in the Aggregate Computing (AC) paradigm, allows multi-robot systems to adapt plans in real-time in unpredictable environments without centralized control. The mission and environment are represented as evolving computational fields, enabling decentralized decision-making. Two primary strategies are used for triggering replanning:

    1. Gossip-based approach: Every robot independently monitors the collective state (active nodes and task status) and triggers replanning upon detecting changes. This is the most robust strategy against high failure rates.
    2. Leader-based approach: A leader is dynamically elected via distributed consensus to initiate and compute the replan, which reduces overall computational load but depends on leader stability.
  10. Collektive Architecture Overview

    Collektive is composed of three independent components:

    1. The core DSL (Domain Specific Language) which defines language syntax and semantics.
    2. The compiler plugin which automatically devises the communication protocol.
    3. The stdlib (Standard Library) which provides common functionalities and data structures.

    It is designed for multiplatform environments (JVM, JS, Native) using Gradle as the build system, but can also be used in single-platform (e.g., JVM only) environments.

  11. Create and organize blog posts in Docusaurus

    Docusaurus blogging features are powered by the @docusaurus/plugin-content-blog plugin. To create a blog post, add Markdown files or folders to the blog directory. To co-locate images with a post, use a folder structure. Blog post dates are automatically extracted from filenames using the format YYYY-MM-DD-title.md or by placing an index.md inside a folder named YYYY-MM-DD-title.
    # Example filename for a post dated May 30, 2019
    2019-05-30-welcome.md
    
    # Example folder structure for a post with images
    2019-05-30-welcome/
    ├── index.md
    └── image.jpg
  12. Set up Alchemist Simulator dependencies for Collektive

    To use the Alchemist distributed systems simulation platform with Collektive, you must add the Alchemist core, SwingUI, and Euclidean Geometry dependencies, as well as the Collektive incarnation dependency. Note that Alchemist is a JVM-only simulator.
    dependencies {
        implementation("it.unibo.alchemist:alchemist:<latest-version>")
        implementation("it.unibo.alchemist:alchemist-swingui:<latest-version>")
        implementation("it.unibo.alchemist:alchemist-euclidean-geometry:<latest-version>")
        implementation("it.unibo.collektive:alchemist-incarnation-collektive:<latest-version>")
    }