How lexloki/pybdm-lba works
Main Components
• Core Library (pybdm):
• This package contains the core functionality. The main components include:
– BDM module (bdm.py): Implements the object-oriented API for computing algorithmic complexity.
– Algorithms (algorithms.py): Contains additional routines such as perturbation experiments.
– Utility Modules (encoding.py, options.py, partitions.py, utils.py): Provide supporting operations like data transformation, configuring parameters, or decomposing datasets.
– CTM Data (pybdm/ctmdata): Holds precomputed datasets in compressed pickle files.
• LBA Generation (lba_generation):
• Supports extension datasets and utilities for Linear Bounded Automata (LBA) operations.
• Includes example notebooks, external data sets, and test call scripts.
• Tests:
• The tests/ directory provides unit tests for validating the correct behavior of algorithmic modules.
• Documentation:
• The docs/ directory sets up Sphinx documentation to provide user guides and reference material.
• Build/Configuration & Packaging:
• Files like setup.py, requirements.txt, Makefile, and configuration files (e.g., setup.cfg, tox.ini) support building, testing, and packaging the library.
Relationships and Data Flow
• At the highest level, users/programs import the library (pybdm) to obtain a BDM object.
• The BDM object interacts with various utility components and data sources (CTM datasets) to perform its computations.
• For advanced features, such as perturbation analysis, the BDM object calls functions from the algorithms module.
• The lba_generation directory supports experiments and data generation that feed into or exemplify the library’s methods.
• Parallel processing is taken into account (using joblib), so indicate that the BDM methods can delegate sub-tasks to parallel worker processes.
• External dependencies like NumPy and joblib can be depicted as external resources that interface with the core modules.
Architectural Patterns and Design Principles
• Object-Oriented Design: The architecture inside the pybdm package is based on classes (e.g., the BDM class and the PerturbationExperiment class).
• Modularization: Functions and algorithms are divided across multiple modules allowing for clear separation of concerns.
• Extendability: The separation of the core algorithm (in pybdm) from dataset generation (in lba_generation) is a design that supports extension for different types of input (i.e., Turing Machines vs. LBAs).
• Nodes/Blocks:
• User/Application Code (client code that instantiates and uses BDM).
• PyBDM Core Module:
» BDM API (bdm.py)
» Auxiliary Algorithms (algorithms.py, perturbation tests)
» Utility Modules (encoding, options, partitions, utils)
» CTM dataset access (pybdm/ctmdata)
• LBA Generation Module:
» Jupyter Notebook (bdm.ipynb)
» CTM data files and test call scripting (lba_test_call.cpp, etc.)
• Testing Framework:
» Unit tests from the tests/ directory.
• Documentation/Build Pipeline:
» Sphinx configuration and documentation in docs/.
• External Libraries:
» NumPy for array handling.
» Joblib for parallel processing.
» Others (if needed, e.g., logging, packaging tools).
• That, for parallel processing, tasks flow from the BDM API to external joblib processes.
• That the LBA Generation module outputs or supports data that may be consumed by the BDM modules.
• Test pipeline actively verifying components in the pybdm package.