Longest Filled Common Subsequence (LFCS)
- LFCS is a string-optimization problem that maximizes the longest common subsequence by inserting a prescribed multiset into a base string under multiplicity constraints.
- It features dual formulations—via insertions into B and deletions from A—enabling a range of methods from exact ILP models to heuristic approaches like random sampling, local search, and adaptive CMSA.
- Empirical benchmarks, including applications in audio matching, demonstrate LFCS's practical relevance and the challenges of scaling solutions in NP-hard combinatorial search spaces.
Searching arXiv for LFCS papers and related benchmarks. The Longest Filled Common Subsequence (LFCS) problem is a variant of the Longest Common Subsequence (LCS) problem in which the input consists of two strings and over an alphabet , together with a multiset of characters . The task is to insert the characters from into , obtaining a new string , so that the LCS between and is maximized. An equivalent formulation deletes from a set of symbols that can be matched to 0 under its multiplicity constraints, and then maximizes the sum of the number of deleted symbols and 1, where 2 is the residual subsequence of 3. LFCS was introduced as a new string-optimization problem and studied first through hardness and approximation, then through heuristics, integer programming, and more recently scalable hybrid metaheuristics and application-driven benchmarks (Mincu et al., 2019, Djukanovic et al., 12 Sep 2025).
1. Formal definition and equivalent viewpoints
In its direct formulation, LFCS asks for an insertion of the multiset 4 into 5 such that the resulting string 6 maximizes the LCS score against 7. The multiset nature of 8 is essential: only the symbol counts matter, not an intrinsic order. This distinguishes LFCS from ordinary LCS and from edit-distance variants in which all operations are freely chosen.
The alternative formulation is operationally important. One may select symbols in 9 to be “matched” with 0, subject to the condition that for each symbol the number selected does not exceed its multiplicity in 1. If 2 denotes the string obtained from 3 after removing those selected symbols, then the objective is
4
or equivalently
5
where 6 is the number of deleted symbols. This dual view underlies both the heuristic design of the 2019 study and the scalable CMSA framework introduced later (Mincu et al., 2019, Djukanovic et al., 12 Sep 2025).
LFCS is NP-hard, and the only guaranteed algorithm explicitly identified in the supplied literature is a 7-approximation due to Castelli, Dondi, Mauro, and Zoppis, originally presented at CPM 2017 and discussed in subsequent work (Mincu et al., 2019). A plausible implication is that LFCS sits at the intersection of subsequence optimization and constrained augmentation, where combinatorial complexity derives not only from ordering constraints, as in LCS, but also from multiset-budget constraints induced by 8.
2. Combinatorial structure and search-space reduction
The 2019 heuristic study emphasizes that the deletion-based formulation substantially sharpens the search perspective. Rather than exploring all possible insertions into 9, it suffices to consider subsets of symbols in 0 whose per-symbol counts are feasible with respect to 1 (Mincu et al., 2019).
Let 2 and
3
The resulting search-space size is expressed as
4
This formulation makes explicit that the difficulty of LFCS depends on the interaction between symbol frequencies in 5 and the multiplicity profile of 6, not merely on 7 and 8.
This structural view also explains several empirical phenomena later reported. The 2019 experiments observed that random sampling can perform well when the search space is small, especially for larger alphabets and shorter strings (Mincu et al., 2019). The 2025 work, by contrast, reports that prior datasets lacked the discriminative power needed to assess scalability, suggesting that search-space compression alone is insufficient for large instances unless it is paired with mechanisms that focus computation on promising components (Djukanovic et al., 12 Sep 2025).
3. Integer linear programming formulations
A central methodological step in the 2019 paper is the introduction of an ILP model for LFCS, solved in experiments with Gurobi to obtain exact solutions for moderate-sized instances (Mincu et al., 2019). The model uses binary variables 9 and 0:
- 1 if 2 and this pairing appears in the LCS of 3 and 4;
- 5 if the symbol 6 in 7 is matched with 8.
The objective is
9
The constraints encode the subsequence structure and multiset feasibility: 0
1
2
3
The first family enforces non-crossing LCS matches, the second ensures that each position of 4 is used at most once, the third ensures that each position of 5 is matched at most once, and the fourth enforces the multiplicity budget of 6.
The 2025 CMSA paper presents a summarized ILP in essentially the same spirit, but adapted to subproblems restricted to variables corresponding only to matches observed in a maintained solution pool. In that framework, an external black-box solver—specifically CPLEX—is used to solve the reduced ILP (Djukanovic et al., 12 Sep 2025). This suggests a methodological continuity: exact ILP remains central, but scalability is sought by aggressively shrinking the active variable set rather than by solving the full formulation on large instances.
4. Heuristic algorithms and approximation behavior
The 2019 experimental study introduces two classes of heuristics and compares them with the earlier 7-approximation algorithm (Mincu et al., 2019).
The first is uniform random sampling. It randomly matches as many occurrences of each symbol in 8 as exist in 9, forms 0, evaluates 1 plus the number matched with 2, and repeats this process 10,000 times by default. The method is simple, but the experiments indicate that it can find the optimum in a significant fraction of small instances when the search space is small.
The second is a local search algorithm denoted 3. Starting from a current solution 4, it iteratively explores all possible matchings in a window of length 5, effectively “matching” up to 6 consecutive symbols in 7 at a time, and then updates to the best neighboring solution. The paper reports variants 8, 9, and 0 for 1, respectively. The process continues until no further improvement is possible.
The reported behavior is nuanced. All algorithms reach within 97% of the optimum on average. The 2-approximation is described as robust, but local search can beat it in cases with small alphabets and larger strings. Random sampling can outperform others in some settings but worsens as the search space grows. Increasing the window size 3 does not always increase effectiveness, because irreversibility can induce local optima (Mincu et al., 2019). This last observation is important: larger neighborhoods are not automatically more useful when a move can destroy structure that later iterations cannot efficiently reconstruct.
5. Experimental benchmarks and empirical performance
The 2019 study evaluates heuristics on procedurally generated random instances with string lengths 4 and alphabet sizes 5, 6, and 7, with 100 instances generated for each parameter set. Optima are computed by ILP with Gurobi (Mincu et al., 2019). A representative excerpt from the reported optimum-hit counts is shown below.
| Alphabet | 8 | Optimum hits |
|---|---|---|
| 9 | 64 | 3/5 approx: 50; rand: 22; S1: 57; S2: 60; S4: 51 |
| 0 | 80 | 3/5 approx: 71; rand: 36; S1: 78; S2: 79; S4: 67 |
| 1 | 48 | 3/5 approx: 85; rand: 100; S1: 82; S2: 86; S4: 85 |
These results show that performance is strongly instance-dependent. In particular, random sampling can be extremely competitive on some large-alphabet configurations, whereas local search dominates in others.
The 2025 study argues that previously used datasets were too small or too synthetic to reveal scalability differences, and introduces a large synthetic benchmark of 1,620 instances, including cases up to 2, with alphabet sizes 3, as well as a realistic audio benchmark based on discretized per-second energy profiles from popular songs (Djukanovic et al., 12 Sep 2025). On 1,510 problem instances with known optimal solutions, the proposed adaptive CMSA solves 1,486 and achieves over 99.9% optimal solution quality. The paper further states that previous approaches, including ILP, fail to return non-trivial solutions as size increases, especially for RNA-sized alphabets, while Adapt-CMSA outperforms all other methods in solution quality on all 12 large benchmark groups (Djukanovic et al., 12 Sep 2025).
A plausible implication is that the empirical regime of LFCS has shifted from moderate-size exact optimization and small-instance heuristic comparison to genuinely large-scale combinatorial search, where benchmark design itself materially affects conclusions about algorithm quality.
6. Adaptive CMSA, explainability, and application domains
The principal algorithmic contribution of the 2025 work is an adaptive Construct, Merge, Solve, Adapt (CMSA) framework specialized for LFCS (Djukanovic et al., 12 Sep 2025). CMSA iteratively constructs a pool of promising solutions, merges their components to define a restricted subproblem, solves that subproblem optimally with an external solver, and adapts the component pool by rewarding successful and penalizing unsuccessful components.
In the LFCS-specific representation, each solution 4 consists of positions in 5 matched to 6, denoted 7, and positions selected for LCS in 8, denoted 9. The subproblem ILP includes only variables corresponding to component matches observed in the current pool 0. The framework includes self-adaptive features: dynamic adjustment of the number of constructed solutions and of diversity through the parameter 1, mutation from the current best via random local edits, and early termination in CPLEX as soon as a new better solution is found (Djukanovic et al., 12 Sep 2025).
The same paper also reports an empirical explainability analysis using SHAP with XGBoost regression. The features are string length 2, alphabet size 3, query length 4, and multiset size 5. For Adapt-Cmsa and other heuristics, the most important features are 6 and 7; larger 8 and larger 9 are associated with higher quality, while 00 and 01 have lesser positive or sometimes negative impact. For ILP, the paper states that for small sizes it behaves like heuristics, whereas for large sizes performance is explained by input size and alphabet size limiting practical tractability (Djukanovic et al., 12 Sep 2025).
An application-driven extension is the use of LFCS for song identification from degraded audio excerpts. Songs are mapped to per-second energy profiles discretized to 10 levels, candidate songs are represented as strings 02, the degraded query is represented as 03, and 04 captures non-ordered energy evidence. The reported setup uses 8 popular songs and degradation levels 05. The study states that the correct song is identified robustly at low to high degradation, and that Adapt-Cmsa consistently outperforms classic ILP and prior heuristics in this setting (Djukanovic et al., 12 Sep 2025). This suggests that LFCS is not merely a theoretical variant of LCS, but a model for sequence matching in which partial order is retained in one channel and lost in another.
7. Position within the LFCS literature
The literature reflected in the supplied arXiv record presents a clear progression. First, LFCS is defined, shown NP-hard, and accompanied by a 06-approximation algorithm as the foundational worst-case guarantee, as discussed in later work (Mincu et al., 2019). Second, the problem is reformulated in deletion space, equipped with a first ILP model, and investigated experimentally via random sampling and local search, demonstrating that practical performance can substantially exceed the worst-case guarantee on moderate-size instances (Mincu et al., 2019). Third, the scope expands to large-scale benchmarks, adaptive CMSA, empirical explainability, and an engineering application in audio querying, with the claim of state-of-the-art performance on both standard and newly introduced benchmarks (Djukanovic et al., 12 Sep 2025).
One recurring misconception would be to treat LFCS as merely “LCS plus insertions.” The supplied formulations show that the problem is more constrained and more structured: the inserted material is restricted to a prescribed multiset, and the optimization can be equivalently viewed as selecting deletions from 07 under multiplicity budgets. Another possible misconception is that exact ILP supersedes heuristics; the later results instead indicate a division of labor in which full ILP is effective for small and moderate instances, while large instances require hybrid frameworks that use ILP only on dynamically constructed subproblems (Mincu et al., 2019, Djukanovic et al., 12 Sep 2025).
An open question explicitly stated in the 2019 study is whether there exists a provably better-than-08-approximation algorithm for LFCS (Mincu et al., 2019). The subsequent progress reported in 2025 concerns empirical dominance and scalability rather than improved approximation guarantees, so that question remains central in the problem’s theoretical profile.