{'fraction_non_alphanumeric': 0.04201391280391212, 'fraction_numerical': 0.010193539499965562, 'mean_word_length': 4.44023979018359, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Memetic Algorithms with Partial Lamarckism for the Shortest Common Supersequence Problem

The Shortest Common Supersequence problem is a hard combinatorial optimization problem with numerous practical applications. We consider the use of memetic algorithms (MAs) for solving this problem. A specialized local-improvement operator based on character removal and heuristic repairing plays a central role in the MA. The tradeoff between the improvement achieved by this operator and its computational cost is analyzed. Empirical results indicate that strategies based on partial lamarckism (i.e., moderate use of the improvement operator) are slightly superior to full-lamarckism and no-lamarckism.


Introduction
The Shortest Common Supersequence Problem (SCSP) is a classical problem from the realm of string analysis. In essence, the SCSP consists of finding a minimal-length sequence S of symbols such that all strings in a certain set L are embedded in S (a more detailed description of the problem and the notion of embedding will be provided in next section). The SCSP provides a "clean" combinatorial optimization problem of great interest from the point of view of Theoretical Computer Science. In this sense, the SCSP has been studied in depth, and we now have accurate characterizations of its computational complexity. These characterizations range from the classical complexity paradigm (i.e., unidimensional complexity) to the more recent parameterized complexity paradigm (i.e., multidimensional complexity). We will survey some of these results in next section as well, but it can be anticipated that the SCSP is intrinsically hard [1,2,3] under many formulations and/or restrictions.
These hardness results would not be critical were the SCSP a mere academic problem. However, the SCSP turns out to be also a very important problem from an applied standpoint: it has applications in planning, data compression, and bioinformatics among other fields [4,5,6]. Thus, the practical impossibility of utilizing exact approaches for tackling this problem in general motivates attention be re-directed to heuristic approaches. Such heuristic approaches are aimed to producing probably-(yet not provably-) optimal solutions to the SCSP. Examples of such heuristics are the Majority Merge (MM) algorithm, and related variants [7], or the Alphabet-Leftmost (AL) algorithm [8]. More sophisticated heuristics have been also proposed, for instance, evolutionary algorithms (EAs) [7,9]. This work will follow the way paved by previous EA approaches to this problem. To be precise, the use of memetic algorithms (MAs) will be considered. The main feature of this MA is the utilization of a twofold local-improvement strategy: on one hand, a repair mechanism is used to restore feasibility of solutions, shortening them if possible; on the other hand, an iterated local-search strategy is used to further improve solution quality. The computational impact of this latter component will be here analyzed, and confronted with the quality improvement attainable.

The Shortest Common Supersequence Problem
First of all, let us define the notion of supersequence. Let s and r be two strings of symbols taken from an alphabet Σ. String s can be said to be a supersequence of r (denoted as s r) using the following recursive definition: Plainly, the definition above implies that r can be embedded in s, meaning that all symbols in r are present in s in the very same order (although not necessarily consecutive). We can now formally define the decisional version of the SCSP: Shortest Common Supersequence Problem Instance: A set L of m strings {s 1 , · · · , s m }, s i ∈ Σ * (where Σ is a certain alphabet), and a positive integer k. Question: Does there exist a string s ∈ Σ * , |s| k, such that s s i for all s i ∈ L?
Obviously, associated with this decisional problem, we have its optimization version in which the smallest k is sought such that the corresponding instance is a yes-instance. Let us now consider the computational complexity of the SCSP.
The SCS problem can be shown to be NP-hard, even if strong constraints are posed on L, or on Σ. For example, it is NP-hard in general when all s i have length two [5], or when the alphabet size |Σ| is two [2]. At any rate, it must be noted that NP-hard results are usually over-stressed; in fact, the NPcharacterization is a worst-case scenario, and such worst cases may be unlikely (for example, 3-SAT is NP-hard, yet most instances are easily solvable; only those located at the phase transition between satisfiability and non-satisfiability are hard to solve). A more sensible characterization of hardness is required in order to deal with these issues, and parameterized complexity is the key.
Parameterized complexity [10] approaches problems from a multidimensional perspective, realizing its internal structure, and isolating some parameters. If hardness (that is, non-polynomial behavior) can be isolated within these parameters, the problem can be efficiently solved for fixed values of them. Here, efficiently means in time O(f (k)n c ), where k is the parameter value, n is the problem size, f is an arbitrary function of k only, and c is a constant independent of k and n. A paradigmatic example of this situation is provided by Vertex Cover: it is NP-hard in general, but it can be solved in time O(1.271 k +n), where n is the number of vertices, and k is the maximum size of the vertex cover sought [11,12]. Problems such as Vertex Cover for which this hardness-isolation is possible are termed fixed-parameter tractable (FPT). Non-FPT problem will fall under some class in the W −hierarchy. Hardness for class W [1] is the current measure of intractability.
Several parameterizations are possible for the SCSP. Firstly, the maximum length k of the supersequence sought can be taken as a parameter. If the alphabet size is constant, or another parameter, then the problem turns in this case to be FPT, since there are at most |Σ| k supersequences, and these can be exhaustively checked. However, this is not very useful in practice because k max |s i |. If the number of strings m is used as a parameter, then SCS is W [1]−hard, and remains so even if |Σ| is taken as another parameter [6], or is constant [3]. Failure of finding FPT results in this latter scenario is particularly relevant since the alphabet size in biological problems is fixed (e.g., there are just four nucleotides in DNA). Furthermore, the absence of FPT algorithms implies the absence of fully polynomial time approximation schemes (FPTAS) for the corresponding problem, that is, there does not exist an algorithm returning solutions within factor 1 + from the optimum in time which is polynomial in n and 1/ .

Heuristics for the SCSP
The hardness results mentioned in the previous subsection motivate the utilization of heuristic approaches for tackling the SCSP. One of the most popular algorithms for this purpose is Majority Merge (MM). This is a greedy algorithm that constructs a supersequence incrementally by adding the symbol most frequently found at the front of the strings in L, and removing these symbols from the corresponding strings. More precisely: for s i ∈ L, s i = βs i do let s i ← s i 6: let s ← sβ 7: until si∈L |s i | = 0 8: return s The myopic functioning of MM makes it incapable of grasping the global structure of strings in L. In particular, MM misses the fact that the strings can have different lengths [7]. This implies that symbols at the front of short strings will have more chances to be removed, since the algorithm has still to scan the longer strings. For this reason, it is less urgent to remove those symbols. In other words, it is better to concentrate in shortening longer strings first. This can be done by assigning a weight to each symbol, depending of the length of the string in whose front is located. Branke et al. [7] propose to use precisely this string length as weight, i.e., step 3 in the previous pseudocode would be modified to have ν(α) ← si=αs i |s i |. Another heuristic has been proposed by Rahmann [8] in the context of the application of the SCSP to a microarray production setting. This algorithm is termed Alphabet-Leftmost (AL), and its functioning can be described as follows: if ∃s j ∈ L : s j = π i s j then 5: for s j ∈ L, s j = π i s j do let s j ← s j 6: let s ← sπ i 7: end if 8: let i ← (i MOD |Σ|) + 1 9: until si∈L |s i | = 0 10: return s As it can be seen, AL takes as input the list of strings whose supersequence is sought, and a permutation of symbols in the alphabet. The algorithm then proceeds with successive repetitions of this pattern until the all strings in L are embedded. Obviously, unproductive steps (i.e., when the next symbol in row does not appear at the front of any string in L) are ignored. Such a simple algorithm can provide very good results for some SCSP instances.

Memetic Algorithms for the SCSP
One of the difficulties faced by an EA (or by a MA) when applied to the SCSP is the existence of feasibility constraints, i.e., an arbitrary string s ∈ Σ * , no matter its length, is not necessarily a supersequence of strings in L. Typically, these situations can be solved in three ways: (i) allowing the generation of infeasible solutions and penalizing accordingly, (ii) using a repairing mechanism for mapping infeasible solutions to feasible solutions, and (iii) defining appropriate operators and/or problem representation to avoid the generation of infeasible solutions. We have analyzed these three approaches elsewhere, and we have found that option (ii) provided better results than option (i) and (iii) (in this latter case, we considered an EA that used ideas from GRASP [13] as suggested in [14]). We will thus elaborate on this option.
As it can be seen, this repairing function not only completes s in order to have a valid supersequence, but also removes unproductive steps, as it is done in AL. Thus, it also serves the purpose of local improver to some extent. After this repairing, raw fitness (to be minimized) is simply computed as: As mentioned in Sect. 1, an additional local-improvement level is considered. To do so, we have considered the neighborhood define by the Delete k : Σ * × (Σ * ) m → Σ * operation [8]. The functioning of this operation is as follows: Delete k (s, L) = ρ(s , L) i fk = 1 and s = αs αDelete k−1 (s , L| α ) if k > 1 and s = αs (4) This operation thus removes the k-th symbol from s, and then submits it to the repair function so that all all strings in L can be embedded. Notice that the repairing function can actually find that the sequence is feasible, hence resulting in a reduction of length by 1 symbol. A full local-search scheme is defined by iterating this operation until no single deletion results in length reduction: if f itness(r) < f itness(s) then 5: let s ← r 6: let k ← 0 7: else 8: let k ← k + 1 9: end if 10: end while 11: return s The application of this LS operator has a computational cost that we measure as the number of partial evaluations in step 3 above. More precisely, since the application of the repairing function starts at position k, we compute each application of Delete k to s as (|r| − k)/|r| fitness evaluations. This is accumulated during the run of the MA to have a more sensible estimation of the search cost.

Experimental Results
The experiments have been done with a steady-state MA (popsize = 100, p X = .9, p m = 1/n, maxevals = 100, 000), using binary tournament selection, uniform crossover, and random-substitution mutation. In order to analyze the impact of local search, the LS operation is not always applied, but randomly with probability p. The values p ∈ {0, 0.01, 0.1, 0.5, 1} have been considered. We denote by MA x% the use of p = x/100. Notice that MA 0% would then be a plain repair-based EA. Two different sets of problem instances have been used in the experimentation. The first one is composed of random strings with different lengths. To be precise, each instance is composed of eight strings, four of them with 40 symbols, and the remaining four with 80 symbols. Each of these strings is randomly built, using an alphabet Σ. Four subsets of instances have been defined using different alphabet sizes, namely |Σ| =2, 4, 8, and 16. For each alphabet size, five different instances have been generated.
Secondly, a more realistic benchmark consisting of strings with a common source has been considered. A DNA sequence from a SARS coronavirus strain has been retrieved from a genomic database 1 , and has been taken as supersequence; then, different sequences are obtained from this supersequence by scanning it from left to right, and skipping nucleotides with a certain fixed probability. In these experiments, the length of the supersequence is 158, the gap probability is 10%, 15%, or 20% and the number of so-generated sequences is 10.
First of all, the results for the random strings are shown in Table 1. All MAs perform notably better than AL. The results for MM (not shown) are similar to those of AL (more precisely, they are between 2.5% and 10% better, still far worse than the MAs). Regarding the different MAs, performance differences tend to be higher for increasing alphabet sizes. In general, MAs with p > 0 are better than MA 0% (the differences are statistically significant according to a Wilcoxon ranksum test [15] in above 90% of the problem instances). MA 1% provides somewhat better results, although the improvement with respect to the other MAs (p > 0) is only significant in less than 20% of the problem instances.
The results for the strings from the SARS DNA sequence are shown in Table 2. Again, AL performs quite poorly here. Unlike the previous set of instances, MM (not shown) does perform notably better than AL. Actually, it matches the performance of MA 0% for low gap probability (10% and 15%), and yields an average 227.8 for the larger gap probability. In this latter problem instance, the MAs with p > 0 seem to perform marginally better. MA 100% and MA 1% provide local search). Using partial lamarckism (0 < p < 1) provides in some problem instances better results, and does not seem to be harmful on any of the remaining instances. Hence, it can offer the best tradeoff between quality improvement and computational cost. Future work will be directed to confirm these results on other neighborhood structures for local search. In this sense, alternatives based on symbol insertions or symbol swaps can be considered [8].