1. Introduction
Maximum Rank-Distance (MRD) codes are a class of error-correcting codes that achieve the Singleton-like bound for rank distance, providing optimal performance for rank-metric error correction. Since their introduction by Delsarte in 1978 [
1], and further development by Gabidulin in 1985 [
2], MRD codes have become an essential tool in areas such as network coding, cryptography, and storage systems [
3].
Despite their importance, the construction of MRD codes remains challenging and open-ended. Classical constructions such as Gabidulin codes are well understood, but recent discoveries [
4] have shown the existence of other inequivalent MRD codes, demonstrating the potential for more comprehensive explorations.
However, most known MRD codes are obtained through algebraic constructions that do not always generalize well across all parameters. Moreover, recent works [
5,
6] have demonstrated that codes with desirable properties, such as higher generalized rank weights, can be constructed beyond the classical setting, motivating the search for new MRD codes.
In this paper, we propose a novel approach to constructing MRD codes using Particle Swarm Optimization (PSO). PSO is a population-based metaheuristic algorithm that excels at solving high-dimensional, complex optimization problems [
7]. By applying PSO to the combinatorial space of MRD codes [
8], we aim to discover new codes and provide a systematic framework for their construction.
The remainder of this paper is organized as follows:
Section 2 reviews related work on MRD codes and optimization techniques.
Section 3 presents the necessary algebraic background.
Section 4 details the theoretical framework underlying our approach.
Section 5 introduces our PSO-guided construction method.
Section 6 discusses the results and limitations of our approach, and
Section 7 concludes the paper.
2. Related Work
2.1. Evolution and Recent Advances in Rank Metric and MRD Code Constructions
The theory of rank-metric codes began with the foundational work of Delsarte in 1978, who introduced the concept of a rank metric on matrices and defined rank-metric codes as sets of matrices over a finite field with distance measured by the rank of their difference [
1]. In the same work, Delsarte also provided the first construction of MRD codes—those meeting the Singleton-like bound for the rank metric—via bilinear forms. This insight drew a parallel between MRD codes in the rank metric and MDS codes in the Hamming metric, establishing the existence of rare optimal codes under rank distance [
9].
Building on this foundation, E. M. Gabidulin independently introduced in 1985 a general family of MRD codes now known as Gabidulin codes [
2]. His construction employed evaluations of linearized polynomials of the form
over extension fields, closely analogous to how Reed–Solomon codes use regular polynomials. These codes were shown to be MRD for all feasible parameters
, thereby generalizing Reed–Solomon codes to the rank-metric setting.
In 2005, Kshevetskiy and Gabidulin introduced a generalized version of Gabidulin codes, extending their structure and enhancing their suitability for cryptographic applications while retaining optimality and providing additional algebraic flexibility [
10]. Gabidulin codes have long been the most extensively studied family of MRD codes due to their
q-linearized-polynomial construction, which achieves the Singleton-like bound
. This construction guarantees provably optimal rank-distance and dimension along with efficient algebraic decoding algorithms [
3].
For decades, it was widely believed that Gabidulin codes encompassed all practically relevant MRD codes. However, this perception shifted dramatically in 2016 when John Sheekey introduced
twisted Gabidulin codes, a groundbreaking infinite family of linear MRD codes
inequivalent to classical Gabidulin codes [
4]. By incorporating a twisting term into the linearized polynomial structure, Sheekey uncovered deep connections between MRD codes and semifield theory, significantly broadening the landscape of MRD code constructions and demonstrating that these codes can arise from fundamentally distinct algebraic foundations.
Subsequent research from 2018 onward has focused on expanding the catalog of MRD codes and understanding their structure in new parameter regimes. One significant direction has been the study of scattered subspaces (linear sets) in projective geometries, which correspond bijectively to rank-metric codes. In 2017, Csajbók et al. established that maximum scattered linear sets yield MRD codes, leading to new constructions beyond the classical
limitation [
11]. Following this, Bartoli et al. (2018) constructed a 3-dimensional MRD code for the case
with even
m, covering a previously inaccessible region in the parameter space not covered by Gabidulin codes [
5,
12].
In 2019, Sheekey proposed a generalized MRD code construction using skew polynomial rings, integrating both classical and twisted Gabidulin codes into a unified framework [
13]. This approach significantly expanded the known families of MRD codes, enabling new constructions for many parameter sets by leveraging the algebraic structure of non-commutative polynomials and semifields.
More recently, Alfarano et al. (2022/2023) introduced a new family of
-linear MRD codes of length
that are not direct sums of smaller MRD codes [
6]. These codes also demonstrated strictly larger generalized rank weights than known MRD codes, highlighting new structural richness and correcting the misconception that all MRD codes exhibit similar rank weight distributions.
Together, these developments represent a significant evolution in MRD code theory—from initial bilinear constructions to modern algebraic and geometric frameworks—and continue to open new pathways for theoretical advancement and practical applications in coding and cryptography.
2.2. Heuristic and Automated Searches for MRD Codes
Given the complexity of defining MRD codes algebraically, researchers have increasingly employed computational methods to find or verify new codes. For example, the classification of MRD codes with
by Csajbók et al. (2020) combined theoretical insights with computational searches [
14].
Despite these efforts, the use of heuristic algorithms, particularly PSO, for MRD code discovery remains largely unexplored. Genetic Algorithms (GA), however, have shown success in evolving block codes in the Hamming metric domain, suggesting that similar strategies might be effective for rank-metric code construction [
15,
16].
PSO, widely regarded for its efficiency in high-dimensional optimization, offers a promising avenue for MRD code discovery. While PSO has been adapted for combinatorial problems [
8], it has not yet been applied directly to MRD code construction. The adaptability of PSO to discrete and combinatorial problems suggests that it could be a powerful tool for exploring the space of MRD codes.
This paper builds upon these works by proposing a PSO-guided approach to MRD code construction, aiming to bridge the gap between algebraic theory and computational search techniques.
3. Algebraic Background
This section reviews the concepts and notation that underlie maximum-rank-distance (MRD) codes and their construction.
3.1. Rank Metric
The
rank metric measures the distance between two matrices—or, equivalently, between vectors over an extension field—by the rank of their difference (the minimum number of rank-1 increments needed to transform one into the other) [
3]. A
rank-metric code is a subset of
used for error detection and correction when this metric is applied.
According to Gabidulin [
3], the error-correcting capability of a matrix code depends on the minimum
rank distance
For
the global distance is
The code is called -linear if it is a k-dimensional subspace of with .
If
is
-linear it admits the
generator-matrix form
Each is a codeword, viewed either as a vector over or, via a fixed -linear isomorphism, as an matrix over the base field.
3.2. Singleton Bound and Singleton-Like Bound
Classical Hamming case. For a Hamming-metric block code of length
n, dimension
k, and minimum distance
d, the classical Singleton bound is [
9]
Rank-metric analogue. For
with minimum rank distance
d and
-dimension
k, Delsarte and Gabidulin [
1,
2,
3] proved the Singleton-type bounds
3.3. Maximum Rank-Distance (MRD) Codes
A code
is a
maximum rank-distance (MRD) code when it achieves equality in the Singleton-like bound:
Lemma 1.
Let generate a -linear code . Then is MRD iff
Hence an MRD code can be identified by the full-rank preservation of its generator matrix under premultiplication by any full-rank
matrix over the base field ([
3] Lemma 2.2).
3.4. Gabidulin Codes
Let
q be a prime power and
with
(since for Gabidulin codes, the code length
n must not exceed the field extension degree
m (
), and the dimension
k must not exceed the length (
)) [
3]. Choose
For a
q-
linearised polynomial
define the evaluation map explicitly as a matrix:
The
Gabidulin code is then given by the set of matrix evaluations:
forming an
-linear
code with parameters:
Its generator matrix appears explicitly as a Moore (or
-Vandermonde) matrix:
Since satisfies Lemma 1, attains the Singleton-like bound and is an MRD code.
4. Theoretical Framework
This section lays out the foundations for using PSO to construct MRD codes. We first summarise PSO and then formulate code construction as a combinatorial optimisation problem.
4.1. Particle Swarm Optimisation
Particle swarm optimisation (PSO) is a population-based metaheuristic inspired by the collective motion of biological swarms [
7,
8]. A swarm of
S particles explores the search space; particle
i keeps track of its position
, velocity
, personal best
, and the global best
found so far.
The standard updates are
where
are independent scalars (or component-wise vectors) drawn anew each iteration,
w is the inertia weight, and
are the cognitive and social acceleration coefficients.
4.2. Problem Formulation
Let
be the target parameters of an MRD vector code. We seek a generator matrix
such that the
-linear code
given by the generator-matrix form (
2)-(
3) attains minimum rank distance
where
is the fixed
-linear isomorphism that converts each length-
n vector over the extension field into its
matrix representation [
3]. The rank in (
17) is therefore taken over
on this unfolded matrix.
To search for such a
G we vectorise every
matrix into a particle position in
. The PSO fitness function is the left-hand side of (
17), so particles with larger minimum rank distance are rewarded, guiding the swarm toward matrices that realise MRD codes.
4.3. Objective Function
To guide PSO we require a fitness that rewards generator matrices whose codes meet the MRD criterion. By (
8), a linear rank-metric code is MRD precisely when its minimum rank distance attains the Singleton-like bound. Consequently we maximise that minimum distance.
Let
be the fixed
-linear isomorphism used in (
17). For a candidate generator matrix
G we define
The optimisation goal is
subject to
. If this primary target is reached, secondary terms—such as larger generalised rank weights—may be added to the score to refine the search [
17].
4.4. Search Space and Constraints
The search domain comprises all full-rank
matrices over
. Constraint handling is enforced by
i- a penalty on particles with and
ii- a repair routine that restores full rank if a velocity update introduces dependence. Details are given in
Section 5.
4.5. Representation and Initialisation
Each PSO particle encodes a generator matrix
G (see (
18)). Positions are initialised either purely at random or as low-rank perturbations of Gabidulin generators [
8,
15,
16], ensuring broad coverage of the search space.
4.6. PSO Algorithm for MRD Code Construction
At every iteration the swarm updates velocities and positions via (
15)–(16). After each move the fitness (
18) is evaluated; personal and global bests are updated accordingly, steering the particles toward matrices that realise MRD codes.
This completes the theoretical basis.
Section 5 turns the framework into a concrete PSO-guided construction algorithm.
5. Proposed PSO-Guided Construction Method
This section presents the proposed PSO-guided method for constructing MRD codes. The algorithm leverages PSO’s global search capabilities to explore the space of rank-metric codes effectively.
5.1. Initialisation
The swarm starts with N particles, each encoding a candidate generator matrix (particle ). Two complementary strategies create a diverse yet feasible initial pool.
(i) Purely random sampling. For roughly half of the particles we draw each entry of G independently and uniformly from . Because rank-deficient matrices are unusable, we resample until . A convenient implementation is:
Fix a normal basis of .
Generate a random array over .
Map each m-tuple of -coefficients to the field element .
If the resulting matrix has full -rank, accept; otherwise repeat.
(ii) Perturbed Gabidulin seeds. The remaining particles are produced by adding a low-rank perturbation to a known Gabidulin generator matrix
:
where
(typically
or 2). Perturbations are generated by sampling
with random
and
. This seeding injects useful structure while still encouraging exploration.
For every particle we assign a velocity matrix
by the same uniform procedure as in
Section 5.1-(i), ensuring that the initial momentum is uncorrelated with the starting position.
Together, these two sampling schemes give the swarm a wide coverage of the search space while guaranteeing that every particle begins with a valid full-rank generator matrix.
5.2. Fitness Evaluation
Each particle is scored with the objective in (
18). A particle is
feasible if its minimum rank distance satisfies
. Among feasible particles we break ties lexicographically:
maximise itself;
subject to (a), maximise the second–smallest rank (a proxy for the second generalised rank weight);
subject to (a)–(b), minimise the Hamming weight of the generator (promoting sparse descriptions).
The composite score is used both for personal–best and global–best updates, so the swarm is steered toward MRD codes and, secondarily, toward codes with stronger weight hierarchies.
5.3. Velocity and Position Update
Updates follow (
15)–(16). Here
is the vectorised form of a generator matrix and
is a
difference matrix of the same size.
Because additions in replace the usual Euclidean operations, the update is interpreted as component-wise field addition. The random coefficients modulate the probability that a given entry of is flipped; concretely, we draw from and apply the corresponding term to each entry with that probability.
Matrix-level “velocity clamping’’ is enforced by limiting , preventing excessively disruptive jumps.
5.4. Constraint Handling
Two complementary mechanisms keep the search inside the feasible region:
Penalty. If we subtract from the fitness, with an adaptive penalty weight that grows once every ten iterations.
Repair. After every position update we test . If we replace the shortest set of dependent rows with random full-rank rows, repeating until full rank is restored.
This hybrid strategy keeps the swarm from stagnating on invalid matrices while allowing an occasional escape into promising infeasible regions.
5.5. Termination Criteria
The algorithm stops when any of the following holds:
the iteration counter reaches ;
a particle achieves and all secondary criteria (a)–(c) in the fitness hierarchy;
the global-best score has not improved for consecutive iterations, where .
These criteria balance run-time control with a high probability of discovering an MRD generator matrix.
5.6. Algorithm Summary
The proposed algorithm can be summarized as follows:
|
Algorithm 1 PSO -Guided MRD Code Construction
|
- 1:
Initialize population of N particles (generator matrices).
- 2:
Evaluate fitness of each particle.
- 3:
while termination criteria not met do
- 4:
for each particle do
- 5:
Update velocity and position using PSO equations.
- 6:
Evaluate fitness of the updated particle.
- 7:
Update personal and global bests if improved.
- 8:
end for
- 9:
end while
- 10:
Return the best-found generator matrix.
|
The Python implementation of this algorithm over finite fields, using the
galois library [
18], is available in the GitHub repository, which includes both the source code and documentation. The repository can be accessed at
https://github.com/behnamde/pso_mrd [
19].
6. Discussion
The proposed PSO-guided construction method offers a metaheuristic route to discovering maximum-rank-distance codes by exploiting the global-search capabilities of particle swarm optimisation (PSO). In contrast to purely algebraic methods—such as Gabidulin’s construction—that rely on explicit theoretical derivations, PSO provides a flexible, data-driven framework that can be applied even when no closed-form constructions are known.
6.1. Advantages of the PSO Approach
Generality: The algorithm is applicable to a broad range of MRD parameters, including regimes beyond classical Gabidulin families.
Scalability: Larger dimensions can be tackled by increasing the swarm size or by tuning the fitness-evaluation schedule.
Adaptability: Domain insight—e.g. seeding particles with Gabidulin-like structures—can be injected seamlessly to accelerate convergence.
Exploratory power: The population nature of PSO balances exploration and exploitation, a desirable trait for navigating highly irregular search landscapes.
6.2. Limitations and Challenges
Curse of dimensionality: The search space grows exponentially with the generator-matrix size, making convergence slower for large instances.
Expensive fitness: Computing the minimum rank distance for every particle is costly, especially when k or m is large.
No optimality guarantee: PSO finds high-quality—but not provably optimal—solutions; post-processing heuristics may be required.
Initialization sensitivity: Swarm quality depends heavily on the diversity and structure of the initial population.
6.3. Future Work
Hybrid heuristics: Combine PSO with algebraic insights or other metaheuristics (e.g., genetic algorithms) to improve robustness.
Richer fitness: Incorporate generalised rank weights or decoding complexity into the objective.
Parallelisation: Leverage GPUs and distributed architectures to accelerate particle updates and fitness checks.
Applications: Deploy the discovered codes in network coding, cryptography, and distributed storage to assess real-world gains.
Quantum computation: Investigate quantum-inspired PSO variants and explore how MRD codes can support quantum error-correction or other quantum-information tasks.
7. Conclusion
We have framed MRD-code construction as a combinatorial optimisation problem and introduced a PSO-based algorithm to explore the corresponding search space of generator matrices. By harnessing PSO’s balance of exploration and exploitation, our method can recover MRD codes in parameter regimes where traditional algebraic constructions are unavailable or unwieldy.
Although promising, the approach still faces scalability bottlenecks and relies on carefully crafted fitness functions. Ongoing work will integrate algebraic structure more deeply into the PSO update rules, refine constraint-handling strategies, and benchmark the resulting codes in practical settings.
Overall, this study shows that metaheuristic techniques such as PSO can complement algebraic theory and open new pathways for advancing rank-metric coding. Continued research along these lines is likely to yield further insights and expand the toolbox for modern coding-theory applications.
References
- Delsarte, P. Bilinear forms over a finite field, with applications to coding theory. Journal of Combinatorial Theory, Series A 1978, 25, 226–241. [CrossRef]
- Gabidulin, E.M. Theory of codes with maximum rank distance. Problems of Information Transmission 1985, 21, 1–12.
- Gabidulin, E.M. Rank Codes; TUM.University Press: Technical University of Munich, Arcisstrasse 21, 80333 Munich, 2021. Translated by Vladimir Sidorenko. Layout design, typesetting, and cover design by Vladimir Sidorenko and Caroline Ennemoser. [CrossRef]
- Sheekey, J. A new family of linear maximum rank distance codes. Advances in Mathematics of Communications 2016, 10, 475–488. [CrossRef]
- Bartoli, D.; Giulietti, M.; Marino, G.; Polverino, O. Maximum Scattered Linear Sets and Complete Caps in Galois Spaces. Combinatorica 2015, 38, 255–278. [CrossRef]
- Alfarano, G.N.; Neri, A.; Zullo, F. Maximum Flag-Rank Distance Codes. arXiv preprint arXiv:2303.16653 2023. [CrossRef]
- Kennedy, J.; Eberhart, R. Particle swarm optimization. In Proceedings of the Proceedings of ICNN’95-International Conference on Neural Networks. IEEE, 1995, Vol. 4, pp. 1942–1948. [CrossRef]
- van Zyl, J.P.; Engelbrecht, A.P. Set-Based Particle Swarm Optimisation: A Review. Mathematics 2023, 11, 2980. [CrossRef]
- Hamming, R.W. Error Detecting and Error Correcting Codes. The Bell System Technical Journal 1950, 29, 147–160. [CrossRef]
- Kshevetskiy, A.; Gabidulin, E. The new construction of rank codes. In Proceedings of the Proceedings. International Symposium on Information Theory, 2005. ISIT 2005., 2005, pp. 2105–2108. [CrossRef]
- Csajbók, B.; Marino, G.; Polverino, O.; Zullo, F. Maximum scattered linear sets and MRD-codes. Journal of Algebraic Combinatorics 2017, 46, 193–213. [CrossRef]
- Bartoli, D.; Csajbók, B.; Montanucci, M. On a conjecture about maximum scattered subspaces of q6 × q6. arXiv preprint 2021. [CrossRef]
- Sheekey, J. MRD Codes: Constructions and Connections. In Combinatorics and Finite Fields: Difference Sets, Polynomials, Pseudorandomness and Applications; Schmidt, K.U.; Winterhof, A., Eds.; Radon Series on Computational and Applied Mathematics, De Gruyter, 2019. [CrossRef]
- Csajbók, B.; Marino, G.; Polverino, O.; Zhou, Y. MRD codes with maximum idealizers. Discrete Mathematics 2020, 343, 111985. [CrossRef]
- Cuéllar, M.P.; Gómez-Torrecillas, J.; Lobillo, F.J.; Navarro, G. Genetic algorithms with permutation-based representation for computing the distance of linear codes. arXiv preprint 2020. [CrossRef]
- Azouaoui, A.; Belkasmi, M. Efficient Dual Domain Decoding of Linear Block Codes Using Genetic Algorithms. Journal of Electrical and Computer Engineering 2012. [CrossRef]
- Lunardon, G.; Trombetti, R.; Zhou, Y. Generalized twisted Gabidulin codes. Journal of Combinatorial Theory, Series A 2018, 159, 79–106. [CrossRef]
- Hostetter, M. Galois: A performant NumPy extension for Galois fields, 2020. GitHub repository containing implementation and documentation. Available at https://github.com/mhostetter/galois.
- Dehghani, B. PSO-Guided Construction of MRD Codes in Rank Metric, 2025. GitHub repository containing implementation and documentation. Available at https://github.com/behnamde/pso_mrd.
|
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).