## 4 The ARPO Metaheuristic  
The ARPO matheuristic combines three main components: _(a)_ an ILS framework [34]; _(b)_ the use of a biased randomization process [66; 67] that guides the generation of new 'promising' solutions (perturbation stage); and _(c)_ the use of a quadratic programming solver that, given a current portfolio, optimizes the levels of investment of each asset (local search). ILS is a conceptually simple yet powerful metaheuristic that has proven to be very efficient in solving complex combinatorial optimization problems. The underlying idea behind ILS is to narrow the search for candidate local optimal solutions returned by some embedded algorithm, typically a local search heuristic. Reference [68] show that ILS obtains the best average performance among a set of selected metaheuristic approaches in three classical combinatorial optimization problems: bin packing, permutation flow shop, and personnel scheduling. The authors also emphasize two main factors for its success: _(i)_ an excellent balance between exploration and exploitation by \"systematically combining a perturbation followed by local search\"; and _(ii)_ its relative simplicity and the reduced number of parameters required, factors that facilitate its quick implementation in practical applications. Algorithm 1 shows the main procedure of the ARPO algorithm. Apart from the inputs defining the instance, also the maximum computing time allowed, \(maxTime\), and an additional parameter, _beta_, are passed to the procedure--the use of this additional parameter will be discussed later. The ARPO procedure starts by generating a 'dummy' initial solution (line 01). This initial solution is constructed by including the \(k_{min}\) assets with the highest return levels. The weights are determined by maximizing the expected return without violating the quantity constraints. This way, if the expected return provided by this solution does not reach the minimum return threshold imposed by the investor, then the problem will be infeasible since no other solution will do it (lines 02-04). Notice, however, that it is also likely to obtain a high risk associated with this initial solution--hence the name dummy. At this point, a quick local search (lines 06-07) is applied to this initial solution in order to improve it without losing its feasibility. This local search uses quadratic programming in order to optimize the investment level assigned to each asset (i.e., \(x_{i}\ \forall i\in\{1,\ldots,n\}\)) in the current portfolio (solution), given a sub-set of assets (\(z_{i}\ \forall i\in\{1,\ldots,n\}\)). The improved solution will be considered both as the current 'base' solution and the 'best-so-far' solution (line 08). Now, the ARPO procedure resumes by starting an iterative improvement process (lines 11-35). As in most ILS frameworks, this process comprises three stages: _(a)_ the _perturbation_ stage (lines 12-15), which applies strong changes to the current base solution in order to increase exploration of the space of solutions; _(b)_ the _local search_ stage (lines 16-22), which tries to perform a quick improvement of the current base solution by applying some operators--in our case, it is based on the combined use of quadratic programming and a cache memory; and _(c)_ the _acceptation_ stage (lines 23-33), which makes use of a credit-based system in order to allow accepting, under certain restrictive conditions, a new base solution even when it offers a slightly higher risk than the current base solution--this 'degradation' of the base solution is allowed in order to reduce the probabilities of getting trapped in a local minimum during the searching process. As regards as the _perturbation_ stage (Algorithm 2), this follows a destruction-reconstruction process. First, this process takes as an input the current base solution. Second, the current base solution is partially destroyed according to some random criterion--in our case, a randomly selected number of assets are deleted from the portfolio--(lines 01-09).