We use a few cookies

Essential cookies keep the library working. With your permission, we'd also like to use analytics to see what's useful and improve the experience. Read our Privacy Policy or Cookie Policy.

Skip to main content
Home/e-Resources/Artificial Intelligence & Machine Learning/Bio-Inspired Artificial Intelligence (AI) Algorithms in K-12 and Postgraduate STEM Education: The Firefly Algorithm across Block-Based and Textual Programming Environments
PeriodicalsArtificial Intelligence & Machine Learning

Bio-Inspired Artificial Intelligence (AI) Algorithms in K-12 and Postgraduate STEM Education: The Firefly Algorithm across Block-Based and Textual Programming Environments

Checking your access to this record.

Abstract & Overview

The Firefly Algorithm (FA) is a bio-inspired metaheuristic that performs robustly on multimodal optimization problems, but it is rarely encountered before graduate level because its Gaussian attraction formulation assumes fluency in calculus and probability that pre-university students do not yet have. This article presents a two-tier implementation of FA designed to make its core mechanism–attraction that decays with distance–directly manipulable across grade bands. A simplified single-attractor variant was implemented in MIT Scratch for elementary and secondary students, and a canonical pairwise variant was implemented in Python (NumPy) for upper-secondary, undergraduate and postgraduate study, complemented by an interactive Pygame visualization that lets students watch the algorithm converge in real time on an actual fitness landscape. Both implementations couple the light-absorption coefficient directly into the attraction strength following a Gaussian decay model and are aligned block-for-block so that students moving between environments can recognize each construct in its counterpart form; the accompanying lesson sequence is grounded in the 5E instructional model, Resnick’s Creative Learning Spiral, and Project- Based Learning. Convergence experiments on the Sphere, Rastrigin, and Ackley benchmark functions over 30 independent runs confirm that both implementations function correctly, with the canonical pairwise variant converging one to two orders of magnitude closer to the global optimum at the cost of Scratch-level manipulability. The two implementations, together with the interactive Pygame visualization, form a coherent, verified instructional pathway from block-based to textual programming for teaching bio-inspired Artificial Intelligence (AI) algorithms in K-12 and beyond.

Cite this record

Konstantinos Salpasaranis (2026). Bio-Inspired Artificial Intelligence (AI) Algorithms in K-12 and Postgraduate STEM Education: The Firefly Algorithm across Block-Based and Textual Programming Environments. European Journal of Artificial Intelligence and Machine Learning, 5(5), 10–23. https://doi.org/10.24018/ejai.2026.5.5.70612

Copy in another style

Salpasaranis, K. (2026). Bio-Inspired Artificial Intelligence (AI) Algorithms in K-12 and Postgraduate STEM Education: The Firefly Algorithm across Block-Based and Textual Programming Environments. European Journal of Artificial Intelligence and Machine Learning, 5(5), 10–23. https://doi.org/10.24018/ejai.2026.5.5.70612
Author names are used as deposited, so check their order before you submit.

Metadata is harvested from open-access indexes and can be incomplete. Check a citation against the published version before relying on it — see our open access & attribution policy.