1 Introduction

A major challenge in computational chemistry and drug discovery is the search for new molecules that bind with specific receptors in order to activate beneficial biochemical mechanisms minimising side effects [1,2,3,4]. However, the search for new molecules, commonly referred to as virtual screening, is limited by the huge number of possible candidates that exist, as well as by a limited knowledge of the receptors of interest. Various strategies have been developed over the years. Receptor-ligand docking methods identify the optimal binding orientation and position between ligand and receptor, as well as rank the ligands of a database according to their binding affinity [5,6,7]. However, docking requires complete knowledge of the receptor’s molecular structure. Alternative methods are based on molecular similarity, i.e. on the search for molecules with a molecular shape similar to that of a molecule already known to bind with a receptor [8,9,10,11,12]. The principle behind this strategy is that the chemical and physical properties of a ligand-receptor system are contained in the electronic distribution, so ligands with a similar electronic density cloud shape have approximately the same probability of binding to a receptor [13,14,15,16,17]. The advantage of this approach is that complete knowledge of the receptor is not required. Both strategies attempt to solve an optimization problem, however, in this work, we focus on docking, whose objective is to minimize an energy function that describes the strength of the binding between the ligand and the receptor [18].

In docking, finding the global minimum of the energy function is hampered by the presence of local minima and energy barriers that prevent the exploration of the function (trapping problem). A second obstacle is the high dimensionality of the energy functions due to the degrees of freedom of the system, and thus the vast size of the space in which the solution resides.

In a nutshell, finding the global minimum is a hard computational task that requires advanced algorithms and techniques to optimize computational resources without losing accuracy. Ongoing research in this field has proposed a vast spectrum of methods and strategies to improve the accuracy and efficiency of docking algorithms. For instance, the programs GOLD [19] and AutoDock [20] use genetic algorithms, ICM [21] and QXP [22] use Monte Carlo minimization, PRO_LEADS [23] implements simulated annealing, evolutionary programming, and tabu search, and FlexX [24] and DOCK [25] use fragments algorithms.

In this article, we review the stochastic optimization method PLANTS (Protein-Ligand ANT System) [26] implemented in the software platform VirtualFlow [27, 28] for virtual screening and ligand preparation, and propose an augmented version of PLANTS, which we will refer to as PLANTS+. PLANTS is an Ant Colony Optimization algorithm [29], i.e. an algorithm inspired by the behavior of ants that search for short paths between the anthill and food sources, guided by pheromone trails. This kind of algorithm was first designed for discrete optimization problems that can be represented by a graph made of nodes and edges. A typical example is the traveling salesman problem, where the shortest path connecting two network nodes is sought. The application to continuous function minimization problems is possible by discretizing the domain of the function in disjoint subsets that are analogous to the network nodes in the traveling salesman problem. The artificial ants, however, do not search for the shortest path between two subsets, but rather search the subset of the domain that contains the global minimum, and then deposit the pheromone in areas with low energy values.

Given a set of ligand candidates for a specific receptor, PLANTS is used to determine the global minimum of each binding energy function. The ligands are then ranked according to their energy values when they are in their optimal position and orientation, and the best ligand for the receptor is the one that takes the lowest energy value. PLANTS+ extends the search for the global minimum from the space of degrees of freedom to the space of binding energy functions by analyzing all energy functions simultaneously, rather than individually. Indeed, the artificial ants deposit the pheromone in the regions of the space of degrees of freedom where the energy value is lowest among all energy functions, and the algorithm returns not only the coordinates of the global minimum but also the energy function that takes the lowest value from those coordinates. Then, the main difference between PLANTS and PLANTS+ is that the former solves as many minimization problems as the number of ligands under consideration, whereas the latter solves a single minimization problem, as illustrated by the workflows in Fig. 1.

In order to test the new algorithm, we studied sets of artificial potentials where the ligand and the receptor are assumed to be rigid and only translational and rotational degrees of freedom are taken into account. This is actually a simplification. Indeed, both the receptor and the ligand are flexible, and how the electron density clouds interact determines the chemical and physical properties of the system [30, 31]. However, the scope of this paper is to show how to improve the ligands classification process by optimizing the use of available information, regardless of how the binding free energy is calculated.

The article is outlined as follows. We review PLANTS and describe the new version PLANTS+ in Sect. 2. We present an illustrative example that highlights the differences between the two methods and present the results of a comparative analysis 3 that show under which conditions PLANTS+ is more accurate and more efficient than PLANTS. Section 4 concludes the article with a short summary of our findings as well as an outlook for future research.

Fig. 1
figure 1

Overview of the workflow of the algorithm PLANTS a and PLANTS+ b

2 Methods

Consider a ligand-receptor system, where the receptor is kept fixed in the Euclidean space, while the ligand can rotate or translate with respect to the receptor determining 3 rotational degrees of freedom and 3 translational degrees of freedom. Additionally, there are \(n_t\) torsional degrees of freedom due to molecules’ bonds that are not associated with a ring-chain. The system is therefore characterized by a \((6+n_t)\)-dimensional binding energy surface

$$\begin{aligned} E(\Psi _1,\Psi _2,\Psi _3, \Psi _{n_1},\dots ,\Psi _{n_t}, r_1,r_2,r_3): \Omega \subset [-\pi ,\pi ]^{3+n_t}\times {\mathbb {R}}_{\ge 0}^3 \rightarrow {\mathbb {R}} \,, \end{aligned}$$
(1)

where \(\Omega \) denotes the space of all possible positions and orientations of the ligand with respect to the receptor, \(\Psi \) denotes the 3 rotational and \(n_t\) torsional degrees of freedom, and r denotes the 3 translational degrees of freedom. Note that, in order to shorten the notation in eq. 1, from this point onwards we denote the energy function with \(E(\Psi _{i}, r_{j})\) with \(i=1,2,\dots ,3+n_t\) and \(j=1,2,3\).

Consider now a set of \(N_{\textrm{ligands}}\) ligands, each with an energy function

$$\begin{aligned} E_\alpha (\Psi _{\alpha ,i}, r_{\alpha ,j}),\quad \forall i=1,2,\dots ,3+n_t; \, \forall j=1,2,3\,, \end{aligned}$$
(2)

where the index \(\alpha =1,2,\ldots ,N_{\textrm{ligands}}\) denotes the \(\alpha \)th ligand of the set, to solve the docking problem means finding the energy function \(E_\alpha \) that takes the lowest value in its global minimum.

2.1 PLANTS

In PLANTS, the global minimum of a binding energy function E is determined using the Ant Colony Optimization algorithm, which was originally developed for discrete problems. Then, for a docking problem, the rotational and torsional degrees of freedom \(\Psi _i\), and the translational degrees of freedom \(r_j\) need to be discretized \(\forall i=1,2,\dots ,3+n_t\) and \(\forall j=1,2,3\). Various discretizations are possible and affect the efficiency and accuracy of the algorithm. However, when no a priori knowledge of the system is available, it is recommended that each degree of freedom is discretized into equal intervals. For example, a rotational degree of freedom \(\Psi \) with \(\Psi (0)=-\pi \) and \(\Psi (N_\Psi )=\pi \) can be discretized into \(N_{\Psi }\) equal disjoint subsets such that

$$\begin{aligned} \left[ -\pi , \pi \right] = \bigcup _{l=1}^{N_{\Psi }} \left[ \Psi (l-1),\, \Psi (l) \right] , \end{aligned}$$
(3)

while a translational degree of freedom r with \(r(0)=0\) and \(r(N_r)=r_\text {max}\) can be discretized into \(N_{r}\) disjoint subsets such that

$$\begin{aligned} \left[ 0,\, r_{\textrm{max}} \right] = \bigcup _{k=1}^{N_{r}} \left[ r(k-1), r(k) \right] , \end{aligned}$$
(4)

where \(r_{\textrm{max}} \in {\mathbb {R}}_{\ge 0}\) is the maximum distance between ligand and receptor appropriately chosen. This gives rise to a discretization of the space \(\Omega \) into \(N = N_{\Psi }^{3+n_t} \times N_{r}^3\) subsets \(A_1, A_2,\ldots ,A_{N} \in \Omega \) with

$$\begin{aligned} A_m = \prod _{i=1}^{3+n_t} \left[ \Psi _i(l-1),\, \Psi _i(l) \right] \times \prod _{j=1}^3 \left[ r_j(k-1), r_j(k) \right] , \ \forall m=1,2,\dots ,N \,, \end{aligned}$$
(5)

where \(l=1,2,\dots ,N_\Psi \) and \(k=1,2,\dots ,N_r\). The discretization subsets of the space \(\Omega \) of the degrees of freedom are analogs to the network nodes in the traveling salesman problem, and the artificial ants move from one subset to another one looking for the subset \(A^* \in \Omega \) that contains the coordinates \(\Psi _i^*, r_j^*\), such that the energy function is minimized:

$$\begin{aligned} E(\Psi _i^*, r_j^*) \le E(\Psi _i, r_j) \quad \forall \, \Psi _i,\, r_j \in \Omega \,. \end{aligned}$$
(6)

Consequently, an artificial ant, solution to the docking problem, is a specific combination of degrees of freedom that minimizes the energy function. In a nutshell, the algorithm works by generating certain pheromone vectors \(\tau _{\Psi _i}\) and \(\tau _{r_j}\) for each degree of freedom, which normalized give rise to probability vectors \(p_{\Psi _i}\) and \(p_{r_j}\) that are used by artificial ants to move around the domain of possible solutions.

2.1.1 Pheromone update rule

Initially, all pheromone vector entries are equal to one, then the probability vectors approximate uniform distributions and the initial \(N_{\textrm{ants}}\) solutions \(\Psi _i^a,r_j^a\) are generated with equal probability. Here the index a denotes one of \(N_{\textrm{ants}}\) possible solutions. These solutions are then locally minimized:

$$\begin{aligned}{} & {} {\left\{ \begin{array}{ll} \Psi _i^a =&{} \textrm{argmin}_{\Psi _i}\left( E\left( \Psi _i^a,r_j^a\right) \right) \\ r_j^a =&{} \textrm{argmin}_{r_j}\left( E\left( \Psi _i^a,r_j^a\right) \right) \\ \end{array}\right. } \quad , \nonumber \\{} & {} \forall a=1,2,\ldots ,N_{\textrm{ants}}, \, \forall i=1,2,\dots ,3+n_t, \, \forall j=1,2,3 \,. \end{aligned}$$
(7)

Local minimization can be achieved by means of several algorithms. PLANTS uses the Nelder-Mead algorithm [32], a simplex algorithm that does not need the calculation of derivatives, but other choices are available. Afterwards, the best artificial ant, i.e. the solution with coordinates \(\Psi _i^*\) and \(r_j^*\) that gives the lowest energy value, is identified and used to update the vectors \(\tau _\Psi \) and \(\tau _r\). This ensures that the global minimum is approached step by step by generating new solutions in accordance with the new probability vectors.

The rule for updating the pheromone vectors \(\tau _\Psi \) and \(\tau _r\) is the same as described in [28]. Given the best solutions \(\Psi ^*\) and \(r^*\), the lth and kth entries of the pheromone vectors respectively associated with the rotational degree of freedom \(\Psi _i\) and the translational degree of freedom \(r_j\), are updated as

$$\begin{aligned} \tau _{\Psi _i}(l)= & {} (1 - \rho ) \tau _{\Psi _i}(l) + \textbf{1}_{\Psi _i}(l) \nonumber \\ \tau _{r_j}(k)= & {} (1 - \rho ) \tau _{r_j}(k) + \textbf{1}_{r_j}(k) \,, \end{aligned}$$
(8)

where the functions \(\textbf{1}_{\Psi _i}(l)\) and \(\textbf{1}_{r_j}(k)\) are given by

$$\begin{aligned} \textbf{1}_{\Psi _i}(l)= & {} {\left\{ \begin{array}{ll} 1 &{} \textrm{if} \ \Psi _i^* \in \left[ \Psi _i(l-3), \Psi _i(l+2)\right] \\ 0 &{} \textrm{else} \end{array}\right. } \,, \nonumber \\ \textbf{1}_{r_j}(k)= & {} {\left\{ \begin{array}{ll} 1 &{} \textrm{if} \ r_j^* \in \left[ r_j(k-2), r_j(k+1)\right] \\ 0 &{} \textrm{else} \end{array}\right. } \,. \end{aligned}$$
(9)

In Eq. 8, \(\rho \) is an input parameter between 0 and 1 called evaporation rate. The function of the evaporation rate is to partially reset the pheromone vector to prevent the algorithm from being trapped in a local minimum. Finally, the corresponding probability vectors are obtained by normalization:

$$\begin{aligned} \begin{aligned} p_{\Psi _i}(l)= & {} \frac{\tau _{\Psi _i}(l)}{\sum _{l=1}^{N_{\Psi _i}} \tau _{\Psi _i}(l)} \,, \\ p_{r_j}(k)= & {} \frac{\tau _{r_j}(k)}{\sum _{k=1}^{N_{r}} \tau _{r_j}(k)} \,. \end{aligned} \end{aligned}$$
(10)

The procedure runs for \(N_{\textrm{steps}}\) iterative steps by generating new solutions which converge to the global minimum. The algorithm is finally applied to all of the ligands under consideration, which are ranked based on their global minimum energy value. Depending on the infrastructure, this can be implemented using a for loop or by parallelizing the process. The complete algorithm is described in alg. 1.

Algorithm 1
figure a

PLANTS algorithm

2.2 PLANTS+

The PLANTS algorithm searches for the optimal position and orientation of each candidate ligand by analyzing each energy function individually. The best candidate is finally determined by evaluating the energy value of each ligand in its global minimum. This corresponds to solving \(N_{\textrm{ligands}}\) optimization problems, i.e. the number of ligands considered, where each optimization problem consists of minimizing an energy function \(E(\Psi _{i}, r_{j})\) with \(6+n_t\) degrees of freedom.

Alternatively, here we propose to solve a single optimization problem in which the function to be minimized is constructed as the sum of all energy functions defined in eq. 2:

$$\begin{aligned} E(\Psi ,r)= & {} \sum _{\alpha = 1}^{N_{\textrm{ligands}}} E_\alpha (\Psi _{\alpha ,i}, r_{\alpha ,j}) \nonumber \\= & {} E_1(\Psi _{1,i}, r_{1,j}) + E_2(\Psi _{2,i}, r_{2,j}) + \ldots \nonumber \\{} & {} + E_{N_{\textrm{ligands}}}(\Psi _{N_{\textrm{ligands}},i}, r_{N_{\textrm{ligands}},j}) \,. \end{aligned}$$
(11)

This function, which we will refer to as the global energy function, has \((6+n_t)\times N_{\textrm{ligands}}\) degrees of freedom, so the new problem consists of minimizing a \((6+n_t)\times N_{\textrm{ligands}}\)-dimensional function.

To solve this problem, we propose an augmented version of the original PLANTS algorithm, which we will refer to as PLANTS+. In practice, PLANTS is modified as follows. The outermost for-loop, over the candidate ligands, is removed, and the simplex algorithm is applied to the global energy function defined in Eq. 11. Then, the pheromone and probability vectors are updated according to the rule defined in Eq. 8. The crucial difference from the original algorithm is that the solutions (artificial ants) are minimized with respect to the global energy function. This entails that the pheromone and probability vectors contain information on all ligands taken together, and not individually as in the original PLANTS. The algorithm is fully illustrated in alg. 2, where we denote in line 15 the best solution as \(\Psi ^*_{\textsf{L}}\) and \(r^*_{\textsf{L}}\) in Alg. 2 since it is calculated with respect to all ligands.

The limitation of this approach is the high number of dimensions of the energy function defined in Eq. 11, which grows with the number of ligands examined. It is in fact well known that the simplex algorithm loses accuracy with the dimensionality of the function to be minimized [33]. On the other hand, because the ligands’ energy functions (Eq. 1) are independent of each other, there is no need to apply the simplex algorithm to the global energy function (Eq. 11). Instead, it is more convenient to apply the local minimization algorithm to the individual energy functions either within a for loop, as in Alg. 2, or by paralleling the calculation.

Algorithm 2
figure b

PLANTS+ algorithm

3 Results

3.1 Illustrative example

To present the main differences between PLANTS and PLANTS+, we have studied sets of two-dimensional energy functions with one rotational and one translational degree of freedom, representing the binding energy functions of five ligands interacting with a receptor. This is a simplification, as realistic models should also include torsional degrees of freedom describing ligand and receptor flexibility. However, the purpose of the following numerical tests is to demonstrate the potential of PLANTS+ independently of how the energy functions are defined.

For each ligand, the energy function is written as

$$\begin{aligned} E(\Psi ,r)= & {} E_{\Psi }(\Psi ) + E_r(r) \nonumber \\= & {} \cos (\mu _1\Psi ) + \mu _2\cos (\Psi ) +\nonumber \\{} & {} + \mu _3 \sin (\mu _4 \pi \Psi ) + \mu _5\cos (\mu _6\pi \Psi ) + \nonumber \\{} & {} +\frac{1}{2} \left( r-\frac{7}{2}\right) ^2+ \epsilon \left[ \left( \frac{r_0}{r}\right) ^{12} - 2 \left( \frac{r_0}{r}\right) ^6 \right] + \nonumber \\{} & {} +\nu _1\sin (\nu _2\pi r) + \nu _3\cos (\nu _4\pi r) \,, \end{aligned}$$
(12)

where \(\mu _1,\mu _2,\mu _3,\mu _4,\mu _5,\mu _6;\,\epsilon , r_0, \nu _1,\nu _2,\nu _3,\nu _4\) are parameters randomly generated from a uniform distribution (see supplementary information for details). The function \(E(\Psi ,r)\) can be decoupled into two components \(E_{\Psi }(\Psi )\) and \(E_r(r)\) which depend on two degrees of freedom corresponding to a rotational and a translational degree of freedom. The pairs of five functions \(E_{\Psi }(\Psi )\) and \(E_r(r)\) are illustrated respectively on the left and the right column of Fig. 2 and are characterized by irregular sequences of valleys and ridges to make the search for the global minimum more difficult. In particular, the functions \(E_{\Psi }(\Psi )\) of the rotational degree of freedom are periodic and are realized by superposing sinusoidal functions with low and high frequencies. Similarly, the translational degree of freedom functions \(E_r(r)\) are realized by means of the Lennard–Jones potential, which well describes the interaction between non-bonding molecules, perturbed by sinusoidal functions to generate local minima. The functions greatly differ from each other due to the randomness of the parameters and the global minima, marked by the green dots, are located in different positions. We also mark that the height of the barriers of the functions \(E_{\Psi }(\Psi )\) are considerably higher than the barriers of the function \(E_r(r)\): approximately \(3\,\mathrm {kJ\, mol^{-1}}\) versus \(10\,\mathrm {kJ\, mol^{-1}}\).

PLANTS and PLANTS+ were applied with the same input parameters: the evaporation rate was \(\rho = 0.1\), the number of solutions, i.e. the artificial ants generated at each iteration was \(N_{\textrm{ants}} = 5\), and the total number of iteration was \(N_{\textrm{steps}} = 80\). The range \([-\pi ,\pi ]\,\textrm{rad}\) of the rotational degree of freedom and the range \([0,10]\,\textrm{nm}\) of the translational degree of freedom were both discretized into 200 equal subsets. In order to validate the results, we used the brute force algorithm scipy.optimize.brute, included in the SciPy library [34], to find the exact global minima of all the functions.

Fig. 2
figure 2

Binding energy functions of the illustrative example: \(E_{\Psi }(\Psi )\) component a, \(E_{r}(r)\) component b. The green dots mark the global minima

3.1.1 PLANTS

We applied PLANTS, in its original form, seeking the global minimum of all five functions. For each energy function, we generated \(N_{\textrm{ants}} = 5\) artificial ants, i.e. five solutions \(\Psi \) and r uniformly distributed respectively in the range \([-\pi , \pi ]\) rad and [0, 10] nm. The initial solutions are marked with red dots in Fig. 3a, where we also plot the solutions generated at each generation (black lines) and the coordinates of the best solutions \(\Psi ^*\) and \(r^*\) (blue lines), i.e. the solutions which take the lowest energy value after being minimized. The green dots denote the global minima. Correspondingly, Fig. 3b shows the time evolution of the energy \(E(\Psi ^*,r^*)\) of the best solutions.

Analyzing the results, we observe that the algorithm converges slower with rotational than translational degree-of-freedom functions. Indeed, the coordinates \(\Psi ^*\) stabilize after approximately 30 iterations, while the coordinates \(r^*\) need approximately 10–20 iterations. The different behavior is due to how the probability vectors \(p_{\Psi }(\Psi )\) and \(p_r(r)\), associated with the pheromone vectors, update during the search for minima. In the beginning, the probability vectors describe a uniform distribution, and ideally, they converge over time to a delta function, with the peak located in a neighborhood of the global minimum. Thus, solutions generated subsequently have a higher probability of belonging to a subset that contains the global minimum. However, if the function under consideration has several local minima that assume almost the same energy value as the global minimum, then the pheromone will be distributed over a wider spectrum and new solutions will be generated accordingly. This is what happens with the energy functions \(E_{\Psi }(\Psi )\) under consideration. As an example, we report in Fig. 4 the time evolution of the probability vectors \(p_{\Psi }(\Psi ;t)\) (left side) and \(p_r(r;t)\) (right side) related to the second energy function, where the index t denotes a specific iteration step. We observe that for the rotational degree of freedom, the convergence of the probability vector takes more time despite the average height of the barriers of \(E_{\Psi }(\Psi )\) being greater than \(E_{r}(r)\). What makes the determination of the global minimum of \(E_{\Psi }(\Psi )\) difficult is the presence of four local minima at \(\Psi \approx -2.2, -0.5, 0.7\), and \(2.5\, \textrm{rad}\) that take approximately the same energy value. Only after 40 iterations does the probability associated with the exact global minimum at \(\Psi \approx -0.5\,\textrm{rad}\) dominate the rest. In contrast, the global minimum of the function \(E_r(r)\) is less ambiguous, and the probability \(p_r(r)\) converges with less than 10 iterations, identifying the global minimum in the range \(r\in [2,4]\,\textrm{nm}\). Taking a closer look, we identify three close peaks in this interval due to the serrated pattern that characterizes the second function \(E_r(r)\), but, after a further 30 iterations, only the peak associated with the exact global minimum survives.

In this example, after about 40 iterations, the global minimum for each function is identified and the functions can be ranked according to their energy value shown in Fig. 3b. Thus, we conclude that the second ligand, represented by a red line in the figure, is the most suitable for the receptor in consideration.

Fig. 3
figure 3

PLANTS. Time evolution of the coordinates (black lines) for each potential: \(\Psi \)-coordinate a, r-coordinate b; one ligand per row. The blue line marks the evolution of the best solution at each iteration. The red dots mark the initial solutions, the green dots mark the global minima. c Evolution of the energy of the best solution for each ligand

Fig. 4
figure 4

PLANTS. Time evolution of the probability vectors \(p_{\Psi }(\Psi ;t)\) a and \(p_{r}(r;t)\) b of the second energy function of the illustrative example. Dark and light blue are associated respectively with a low and high probability

3.1.2 PLANTS+

We applied PLANTS+ to the same five functions \(E(\Psi ,r)\) examined in the previous section. However, unlike PLANTS, we did not use PLANTS+ for finding the global minimum of each energy function individually, but for the global minimum of the global energy function defined in Eq. 11. For this, we defined only one probability vector \(p_{\Psi }(\Psi )\) for the rotational degree of freedom, and one probability vector \(p_r(r)\) for the translational degree of freedom, which were updated at each iteration accordingly to the best solution \((\Psi ^*_{\textsf{L}}, r^*_{\textsf{L}})\) with respect to the orientation, the position, and the energy function. The probability vectors were used to generate 5 solutions \((\Psi , r)\) over the range \([-\pi , \pi ]\) rad and [0, 10] nm, that converge to the global minimum.

In Fig. 5a, we show the time evolution of the coordinate \(\Psi ^*_{\textsf{L}}\) of the best solution on the left side, and of the coordinate \(r^*_{\textsf{L}}\) on the right side. During each iteration, the lines change color to emphasize which energy function assumes the lowest energy value. In this example, initially, the lines are colored blue since the first ligand takes the least value, then the color becomes red between steps 2 and 7, then it turns blue again. After the 25th iteration step, the color remains red, as the second energy function takes the lowest value.

Fig. 5b shows the time evolution of the energy. Precisely, this graph shows the energy value taken by the best solution \((\Psi ^*_{\textsf{L}}, r^*_{\textsf{L}})\), at a given iteration step, using the energy function that returns the lowest value. In accordance with the graph depicting the evolution of the solution, the best energy function is used to color the line. At first, the algorithm identifies the first ligand as optimal for the receptor, but at the end of the execution, the algorithm returns the second ligand, in accordance with results obtained by PLANTS.

We also observe that between steps 0 and 25, the competition between energy functions involves ligands 2, 4, and 5. Similarly, we observed the same competition with PLANTS in Fig. 3. This is due to the fact that the global minima of each of these ligands assume approximately the same value, as shown in Fig. 2.

Fig. 5
figure 5

PLANTS+. Evolution of the \(\Psi \)-coordinate a and r-coordinate b of the best solution with respect to all energy functions. The color denotes the energy function which takes the lowest value during a specific iteration step. c Time evolution of the energy of the best solution

3.2 Comparative analysis

With the next numerical experiment, we investigate how PLANTS and PLANTS+ depend on the input parameters, and we seek under which settings PLANTS+ is more accurate and more efficient than PLANTS. For this purpose, we randomly generated a set of 100 energy functions \(E(\Psi ,r)\) using Eq. 12 and we searched for the energy function which takes the least energy value at its global minimum. The choice of the energy functions was made in order to make difficult the optimization problem, not only generating random sequences of local minima and barriers but distributing the global minima over a large range, as illustrated in Fig. 6. We studied 64 different sets of parameters defined by the combination of the following input parameters:

$$\begin{aligned} N_{\textrm{ants}}= & {} 1,\, 5,\, 10,\, 15\,, \\ \rho= & {} 0.1,\, 0.2,\, 0.3,\, 0.4\,, \\ N_{\textrm{steps}}= & {} 20,\, 30,\, 40,\, 50. \end{aligned}$$

A total of 20 runs of each algorithm were performed on each set of parameters in order to produce meaningful statistical results. For each set of parameters we measured and compared the execution time and the success rate. The execution time is the real-time in seconds, averaged over all 20 repetitions, required to complete the instructions described in Algs. 1 and 2. To evaluate the success rate, we first applied the brute force algorithm scipy.optimize.brute to each energy function to find the exact global minima. Then we defined a prediction, realized by PLANTS or PLANTS+, as “successful” if the relative error was smaller than 5%, and the success rate of a specific set of parameters as the percentage of successful predictions over all 20 repetitions.

Fig. 6
figure 6

Global minima of each energy function composing the benchmark dataset: \(\Psi \)-coordinate a, r-coordinate b

Fig. 7
figure 7

a Success rate (vertical axis) and execution time (horizontal axis) of PLANTS; b Success rate (vertical axis) and execution time (horizontal axis) of PLANTS+; c Difference in execution time and success rate between PLANTS+ and PLANTS. The points falling within the rectangle with dashed edges indicate that PLANTS+ is more accurate and more efficient than PLANTS using the same input parameters. The legend box of figure a applies also to figures b and c

3.2.1 PLANTS

Figure 7a reports the results for the algorithm PLANTS. The leftmost panel shows 64 points representing the execution time (horizontal axis) versus the success rate (vertical axis) of each set of parameters. The points have been colored according to the number of generated solutions \(N_{\textrm{ants}}\), thus we identify four clusters: using \(N_{\textrm{ants}}=1\), PLANTS never converges, with \(N_{\textrm{ants}}=5\) the success rate varies between 40% and 80%, with \(N_{\textrm{ants}}=10\) the success rate is between 80% and 90%, and with \(N_{\textrm{ants}}=20\) is between 85% and 95%. Correspondingly the execution time increases from approximately 10 s to 150 s. This result is explained by the fact that more solutions require more calculations, especially during the execution of the simplex algorithm. However, a large number of solutions also facilitates the exploration of the domain and the search for the global minimum.

Likewise, we could color the points to highlight the dependence on the parameters \(\rho \) and \(N_{\textrm{steps}}\), but for these two parameters, the figures would be unreadable. Thus, we decided to consider only the set of 16 algorithm executions realized with \(N_{\textrm{ants}}=5\) solutions, and we plot in the middle and rightmost panel respectively the dependence on the evaporation rate \(\rho \) and on the iteration steps \(N_{\textrm{steps}}\). We observe that \(\rho =0.4\) (green) and \(\rho = 0.3\) (red) have no impact on execution time, while the success rate is approximately \(60\%\) and \(70\%\). This suggests that small evaporation rate values favor accuracy. Intuitively, the reason for this is that if the evaporation rate is too high, the pheromone and probability vectors are reset too quickly, and the information acquired during the first few iterations is lost. By further decreasing the evaporation rate to \(\rho =0.2\), the success rate is improved to 80% only if \(N_{\textrm{steps}}=30,\,40,\,50\). With \(\rho =0.1\), the dependence on \(N_{\textrm{steps}}\) is further emphasized, and the success rate reaches 85% only if \(N_{\textrm{steps}}\) is equal to 50. Thus, low evaporation rate values require longer algorithm runs to get out of any local minima in which the system could be trapped. Analyzing the rightmost panel, we deduce that the number of iteration steps mainly impacts the execution time and the difference in success rate is due to the parameter \(\rho \).

In essence, we conclude the following:

  • Increasing the number of solutions improves accuracy, but the required execution time exponentially increases.

  • Small evaporation rates improve the accuracy, but only if the number of iteration steps is large enough.

  • The number of iteration steps affects the execution time, but it improves the accuracy only in combination with a small evaporation rate.

3.2.2 PLANTS+

We carried out the same analysis with PLANTS+, whose results are reported in Fig. 7b. The color of the points in the graphs highlights how success rate and execution time depend on the parameter \(N_{\textrm{ants}}\) (left panel), \(\rho \) (middle panel), and \(N_{\textrm{steps}}\) (right panel). As for PLANTS, we fixed the number of solutions \(N_{\textrm{ants}}=5\) to better illustrate the dependence on \(\rho \) and \(N_{\textrm{steps}}\).

With regard to the number of generated solutions \(N_{\textrm{ants}}\), we observe the same behavior as PLANTS: accuracy increases with \(N_{\textrm{ants}}\), but at the expense of an exponentially increased execution time. Despite the difficulty of reading the second panel, we can still discern a cluster associated with \(\rho =0.3\) (red) above \(\rho =0.4\) (green). Thus, reducing the evaporation rate increases accuracy, but execution time depends on the other parameters. Lastly, the number of iterations \(N_{\textrm{steps}}\) affects execution time primarily. Then, we conclude that PLANTS and PLANTS+ are dependent on the input parameters in the same manner.

In Fig. 7c, we compare the success rate and execution time of the two algorithms, in order to determine which algorithm is more efficient and accurate. The graph reports the difference

$$\begin{aligned} \mathrm {(success\,rate\,of\,PLANTS+)} - \mathrm {(success\,rate\,of\,PLANTS)} \,, \end{aligned}$$

on the vertical axis, and

$$\begin{aligned} \mathrm {(execution\,time\,of\,PLANTS+)} - \mathrm {(execution\,time\,of\,PLANTS)} \,, \end{aligned}$$

on the horizontal axis. Hence, a positive value on the vertical axis and a negative value on the horizontal axis indicate that PLANTS+ is respectively more accurate and more efficient than PLANTS using the same parameters \(N_{\textrm{ants}}\), \(\rho \) and \(N_{\textrm{steps}}\). In all cases, PLANTS+ executions were more efficient than PLANTS: the gain varies from 5 s with \(N_{\textrm{ants}}=5\) (black dots) to 20 s \(N_{\textrm{ants}}=15\) (green dots). Accuracy worsened in 16 cases, those below the dashed line, but improved in all the other 48 cases. In particular, we observe that in 5 cases with \(N_{\textrm{ants}} = 1\), in 12 cases with \(N_{\textrm{ants}} = 5\), in 15 cases with \(N_{\textrm{ants}} = 10\), and in all cases with \(N_{\textrm{ants}} = 15\), the success rate improves. Then, PLANTS+ benefits from increasing the number of solutions \(N_{\textrm{ants}}\) both in accuracy and efficiency. The rightmost panel reveals another important result. With the same settings, PLANTS+ is more efficient when the number of iteration steps is increased, and the gain in efficiency is proportional to \(N_{\textrm{steps}}\). In other words, with PLANTS+ the \(N_{\textrm{steps}}\) parameter has less impact on execution time than with PLANTS.

4 Conclusion and outlook

In this article, we reviewed the optimization method PLANTS and proposed an augmented version, referred to as PLANTS+ in the text, for finding the optimal orientation and position of a ligand at the receptor’s binding site. The main difference between the two methods is that PLANTS examines the binding energy functions of ligands individually and determines the best ligand for a given receptor by comparing the energy that each ligand takes at its optimal pose, while PLANTS+ solves a single optimization problem and searches for the optimal position and orientation by comparing the energy functions of the ligands at each iteration step. This modification permits better use of computational resources because the probability vector used to generate new possible solutions in PLANTS+ embeds more information than PLANTS. In fact, the probability vector is not updated by taking into account only the degrees of freedom of a single ligand, but of a set of ligands under investigation.

We studied how the input parameters affect the results and our analysis shows that PLANTS+ is always more efficient than PLANTS. The accuracy also improves in most of the cases, in particular when the number of solutions generated for each ligand-receptor system, i.e., the input parameter \(N_{\textrm{ants}}\), is sufficiently high.

However, we emphasize that in our numerical experiments we have considered the ligand and the receptor as static systems. This approximation is not justified from a chemical point of view, but the primary objective of this work is to show how the Ant Colony Optimisation algorithm can improve its performance with a different use of the available information. In further development of the algorithm, we will take into account also the flexibility of the ligand and receptor and how the electron density clouds interact. Additionally, we plan to take into account the inclusion of kinetic observables, e.g., transition rates, as a criterion for classifying ligands. This will provide a more accurate screening of ligands [35] and will make it possible to study the dependence of docking on external variables [36], e.g. the acidity of the cell membrane, a variable that is considered crucial in the development of undesirable effects [37, 38]. In this work, we have addressed the docking problem. However, as mentioned in the introduction, another important strategy in drug design is based on molecular similarity, i.e., the search for molecules with similar molecular structure. As this is also an optimisation problem that can be solved by heuristic algorithms, a further line of development of PLANTS+ is its application to virtual screening methods based on molecular similarity.