1 Introduction
Spoofing attacks have been the object of study of various researchers as computer systems became more prevalent. In these attacks, a malicious individual aims to gain access to a system’s resources by masking their true identity and intentions, in order to either inflict damage to the system or access unauthorised content. Such attacks can be remote attacks to a computer networks ([CTM07], [LiTr06a], [LiTr06b], [PDB13]), but can also have a physical aspect ([KMD17], [SKP18]). The overaching goal of the field is to design systems that are able to efficiently detect and localise such attacks, without infringing significant overheads to the system, and without hindering the overall experience of the users. To the effect of localisation, the employment of various algorithms has been proposed, including clustering algorithms.
Pruning algorithms are ubiquitous in computer science and are applied in a vast array of problems, however their application to the localisation problem has been limited. Such algorithms are used in order emphasize the speed of computation over the optimality of the solution. This is essential in applications where real time computation requirements are indispensable (as is the detection of an attack). Several authors have proposed adaptive algorithms with varying motivations: some algorithms try to minimise the power consumption of the pruning procedure ([Tes+05], [HeCh02], [HeCh04]), while others aim to employ ideas from theoretical computer science to improve the accuracy of the algorithm ([BiLi10], [LiHa10]). Some authors even use techniques from control theory to adaptively alter the pruning parameter ([ZhDu04]).
Adaptive algorithms are a prime candidate for analysis using tropical geometry ([MaSt15]), which has been increasing in popularity. Many authors ([ThMa18], [ChMa17]) resort to using tropical geometry for its appealing properties; namely the piecewise linearity of the solution space, and the intuitive reasoning regarding that space. Tropical geometry allows for a layer of abstraction; instead of reasoning about the algorithm itself, we can reason about the solution space it produces, which often can lead to deductions about the possible solutions. This can be exteremely useful in modern day, since the sheer size and dimensionality of the input data can make explicit remarks about the function of algorithms near impossible.
Despite tropical geometry’s appeal, previous approaches of adaptive pruning algorithms have not taken advantage of these properties. Authors have proposed (numerical) optimisations which can reduce the energy consumption of convolutional code decoding, and others have analysed the structure of specific models in order to make deductions and predictions about the pruning parameter. In contrast, in this paper we try to adapt the pruning parameter based solely on the shape and state of the solution space, without assuming any specific structure of the applied model.
Reference [CTM07]
proposes the use of the Kmeans algorithm for the detection and localisation of spoofing attacks. Extended work has been done on the detection of spoofing attacks, both in communication networks (
[LiTr06a], [LiTr06b]), but also in speech recognition systems ([KMD17], [SKP18]). In [PDB13] the authors try to offer a mathematical framework for cyber attacks from a systemtheoretic perspective. References [Tes+05], [HeCh02], and [HeCh04] tackle pruning from a telecommunications perspective, aiming to minimize the energy consumption during decoding in receivers. The authors of [ZhDu04] aim to utilise metrics, derived from an assumed system structure, to predict the evolution of the leniency parameter. Reference [BiLi10] tries to exploit the inherent nature of speech recognition in order to speed up pruning. Finally, in [LiHa10] the authors try to efficiently understand the structure of the solution space by computing cliques in order to, subsequently, improve pruning. However, that approach is supervised; each specific application domain has to be analysed and evaluated as to whether cliques can be computed, and thus the approach is not generilisable.In this work we propose an adaptive variation of the Viterbi pruning in order to solve the localisation problem by exploiting the geometrical structure of the solution space. In particular, tropical polytopes can be defined during each step of the Viterbi algorithm. We utilise two metrics (defined in our previous work [ThMa18]) deriving from the tropical polytopes of the Viterbi pruning in order to design the new adaptive algorithm. The proposed algorithm computes the metrics’ values at each time frame and then compares them with a previous history in order to decide whether or not to adapt the current value of the pruning parameter. In the case that pruning is indeed warranted, the algorithm tries to adapt the parameter to the effect of maintaining the volume enclosed in the solution space.
2 Background
2.1 Tropical Algebra and Geometry
Tropical algebra ([GoMi08], [Butk10], [Cuni79]) is an algebraic body similar to linear algebra, where the pair of main operations is . It operates on the extended real multidimentional space (). The minplus matrix multiplication is denoted , and its result between two matrices is given by:
(1) 
where denotes the minimum (see [Mara17] for details).
Tropical geometry ([MaSt15]) studies the objects of Euclidean geometry under the tropical prism. Similar to its Euclidean counterpart, a tropical polytope will be a closed intersection of a finite number of tropical halfspaces. Figure 1 offers visual examples of tropical halfspaces and polytopes.
2.2 Tropical Viterbi
The Viterbi algorithm can be written in tropical algebra, as we proposed in [ThMa18], in the following closed form:
(2) 
where
is the state vector,
is the matrix of the transition weights, and is a diagonal matrix containing the observation weights for the input symbol at each state.In [ThMa18] we analysed the pruning variant of the Viterbi algorithm in tropical algebra and comment on its geometry. Therein, a vector of variables is considered, and then it is bounded by the Viterbi update law of (2) and the pruning vector , where is the leniency parameter. This defines a tropical polytope on the variable vector , which encloses all the possible assignments of the variables that satisfy the constraints (which, essentially, is the solution space for the pruning procedure). Then, at every interval of the algorithm, two metrics are calculated based on that polytope:

a metric based on the normalized volume inside the polytope:
(3) 
a metric based on the entropy of the polytope:
(4)
where . Essentially, is the degree to which each dimension satisfies the Viterbi constraints.
2.3 Poisson distributions
It is very common for network requests in telecommunications applications to be modeled as Poisson distributions (
[BeTs08], [Pitm99]). Poisson distributions are controlled by the parameter , which can be interpreted as the mean amount of requests in a time frame. Alternatively, in queueing systems theparameter can be perceived as the average time units that a user will have to wait until he is serviced. Formally, the probability of witnessing exactly
requests in the time frame (or waiting for time units) is given by Equation (5):(5) 
where
is the random variable modeling the number of requests in the time frame. Some important characteristics of the distribution:

The distribution is discretevalued. This makes it ideal to model number of requests in a network.

The distribution’s mean is equal to the parameter .

The distribution is memoryless. In essence, this means that if a user has already made requests, then the probability of making a total of requests is equal to the probability of making requests. Formally:
(6)
3 Algorithm
We propose a novel adaptive pruning algorithm that dynamically adapts the pruning parameter by consulting the metrics and ([ThMa18]). The algorithm computes the metrics and then decides, based on a history of previous values, if the current interval warrants an adaptation of the pruning parameter . If that proves to be the case, the parameter is increased or decreased accordingly, in order to maintain the volume enclosed in the polytope. In essence, the algorithm computes a new value for each time frame, based on the state of the solution space (Figure 2). The main parameters of the algorithm are:
i. the parameter , which is the percentage threshold for . If the current value of differs from the running history by a percentage more than , then the algorithm will adapt the parameter .
ii. the parameter , which is the percentage change for . If the algorithm proceeds to the adaptation of , the current value of is compared with the running history. If it is larger, then this means that the current value of allows for the inclusion of more paths than before, and thus the algorithms proceeds to decrease the value of by a percentage of . Similarly, if is smaller than the running history, the algorithm increases by a percentage of , in order to allow for the survival of more paths.
iii. the parameter , which is the length of the running history. The algorithm first collects samples for the running history, and then compares the current interval’s metrics with the average of the most recent entries in order to decide if an adaptation is warranted, and also whether to increase or decrease the parameter .
iv. the parameter , which is the initial value of the pruning parameter . is also used as the pruning parameter for the first intervals, in order to calculate the history of the metrics and .
Algorithm 1 presents the proposed algorithm. Besides the parameters mentioned above, the algorithm also accepts other inputs required for the simulation and the Viterbi computation. In particular, a simulation runtime is required, as well as the number of states and the initial, transition, and observation costs and .
In essence, the algorithm operates as follows. First, the Viterbi computation is performed using the previous value for the parameter . Then, the geometrical metrics and are calculated from the polytope of the Viterbi computation. Then, the algorithm compares the current value of the metric with the running history. This is done because , essentially, calculates the entropy of the solution space. In information theory ([ShWe98], [CoTh06], [Ston15]), entropy is a measure of surprise. In particular entropy is used to communicate if a new sample conveys a significant amount of information. For example, if a sample abides by the expectations of the current parameterisation of the distribution, then the entropy will be low, indicating that the sample provides no new information regarding the understanding of the distribution (and thus we are not surprised to observe this sample when we are sampling our distribution). Conversely, if a sample is atypical for the current parameterisation, then the entropy will be high, indicating that the sample provides new information regarding our understanding of the distribution, suggesting that the parameterisation might be wrong. The algorithm tries to leverage this measure of surprise, by comparing the level of current entropy with a running history. If there is a significant difference, this indicates a change in the solution space; the previous parameterisation of will no longer have similar effects. Thus, in such cases, the algorithm decides to update the value of in order to curb the levels of excitement.
When the algorithm decides there exists a need for adaptation, the metric is examined and compared to its running history. This is done because, as already mentioned, is a measure of the volume of the solution space. Volume can convey quantitative information about the solution space. By maintaining that volume, we ensure that the solution space has some metric similarity throughout iterations. The normalized volume is useful since the values that the state vector admits change over time. As the total costs get larger (or the probabilities get smaller), then the leniency parameter has less of an effect. By trying to maintain the normalized volume, we ensure that the leniency parameter will adapt to accomodate larger weights in the later iterations of the Viterbi pruning. The algorithm tries to leverage these observations by keeping a history of the metric . In cases were pruning is warranted (as indicated by the percentage change in ), an effort is made to maintain the normalized volume metric , in order to keep the size of the solution space similar. Figure 3 further illustrates this process.
Adapting the parameter based solely on the maintenance of the volume metric would have two undesirable effects:

Firstly, the parameter would be adapted at every iteration, in order to maintain the normalized volume. While this is not necessarily undesirable, it has certain implications. Examining only the volume metric we have a quantitative analysis of the solution space, but lack a qualitative analysis. This means that very few high probable paths are indistinguishable from a vast number of very low probability paths. We would like to be able to understand such a shift of the solution space, and volumebased metrics alone cannot offer such a luxury.

Secondly, and most importantly, maintaining the starting volume is very strongly interweaved with the initial parameter . Indeed, the volume is calculated based on the initial parameter , and thus the whole premise of the algorithm would rely heavily on the value of that parameter. While starting conditions still matter in the proposed algorithm, their effect is not as drastic as if we were to rely on the starting volume.
Thus, a combination of the metrics and is considered in the adaptation of the leniency parameter .
4 Results
We performed experiments to evaluate Algorithm 1 using a simulated attack on a network. In particular we assumed that a malevolent user has gained anauthorized access to the network and he wishes to disrupt its function by performing a large number of requests to the network, and thus hogging the available resources, hindering the service of benevolent users. We would like to utilise Algorithm 1 in order to solve the localisation problem and thus determine that malevolent user. We also assume that user exhibits some intelligence, by varrying the rate according to which he sends packets to the network in timed intervals. We also, in certain experiments, allow for the attacker to try and further spoof his identity by changing his position in the network, trying to further mask his identity. Thus, our adaptive algorithm will try to dynamically adapt the value of the pruning parameter across the iterations, in order to locate the attacker without wasting the system’s resources (namely, without examining a large number of states). Figure 4 represents the form of the input signals. There, the number of requests the attacker performs at each time interval is indicated by the black line. The average number of requests by all the other users in the network is indicated by the blue line. Also represented in the figure are the maximum and minimum numbers of requests the other users make to the network at each time interval. The number of requests for both the attacker and the benevolent users are modeled with Poisson distributions of varying parameters, as discussed in Section 2.
In the modeling for the experiments, we assigned a lower Poisson parameter to the attacker. This choice was made because the original framework that was proposed for the metrics and was modeled in minplus algebra, and thus the Viterbi algorithm aims to find the sequence of the lowest cost. In that vein, we decided to keep the modeling the same, to highlight the mathematical origin of the algorithm. At the same time, we wanted the experiment to maintain its immediately interpretable nature, meaning that the parameter of the Poisson distributions reflect the average number of requests by each user. Thus, we allowed a lower Poisson parameter to the attacker, and perform the minplus calculations.
Figure 5 presents how the algorithm adapts the leniency parameter for an instance of the experiment. The particular values of that experiment were , , and . The value is similar to the learning rate of optimisation algorithms, and thus needs to be sufficiently small, in order to regulate the weight each iteration has.
5 Conclusion
In this work we proposed a variation of the Viterbi pruning as the solution for an attacker localisation problem. In particular, we proposed an adaptive pruning algorithm inspired by the geometrical aspect of the tropical analysis of the Viterbi pruning. By analysing the tropical geometry of the traditional pruning algorithm, we incorporate metrics into the proposed adaptive algorithm in order to evaluate the need for adaptation. In the case the algorithm deemed that the current time interval’s metrics vary sufficiently from the previous history, then an adaptation is made to the effect of maintaining the previous levels of the enclosed volume . We experimented with various values for the parameters of the algorithm and presented numerical results of the application of the proposed algorithm in the task of locating a simulated attacker on a network.