1 Introduction

Stigmergy is a method of communication that uses decentralized systems in which individuals can communicate with each other by changing their surroundings [1]. Stigmergy is commonly found in animal colonies that are able to realize distributed processing of information through many small and simple cognitive processes, all of which are generated by leaving signals in the environment [2,3,4,5,6]. A typical example is represented by the optimization of the trajectories that ants create when they go out on reconnaissance missions in search of food. Each ant leaves a pheromone trace along its exploratory path, in order to identify a specific trajectory, and thus be able to return to the anthill. Then, if food is found, on the way back it will follow the trace it had previously left behind, thereby reinforcing this pheromone-laced path. Every other ant casually crossing the reinforced trace of pheromones will be alerted to the path and begin to follow it, in turn reaching the food source, while simultaneously reinforcing the pheromone pathway themselves. After a intermediate period, all the ineffective traces that had been laid out will diminish in favor of the one pathway toward the food, as the increasing number of ants following said traces exponentially increases the signaling of the effective pheromone pathway. This process of optimizing the path toward the goal is based on three simple cognitive processes that the ant colony exercises at each point of the entire map: (1) leave a pheromone trace during the exploration, (2) follow a trace of pheromone, and (3) follow the most intense trace at every intersection. The stigmergic communication paradigm has also been used in the information technology field [7,8,9]. For example, many software codes optimize the trajectories followed by signals in complex Ethernet and Intranet communication networks, using algorithms that simulate the search for food by ants. Such software systems are indeed effective, but they require computation time to develop necessary algorithms, which increases exponentially with the complexity of the network. Hardware solutions, especially optical ones, have also shown greater potential in terms of energy management and large-scale implementation than software [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]. Recently, using photonic technology, a stigmergic logic gate [26] based on soliton waveguides has been created [27]. These waveguides exploit the refractive channels induced by laser beams that do not diffract (via self-confined beams, also called spatial solitons). They can be reached in photorefractive nonlinear materials [28, 29], taking advantage of the refractive index plasticity, i.e., the possibility of locally varying the material refractive index by the intensity of the used light. The optical stigmergy corresponds exactly to such modification: any optical feedback re-injected in the soliton channel would increase the refractive index contrast between the channel and the environment, acting like an enhancement of the pheromone trace and unbalancing any channel crossing. Thus, stigmergic optical gates can be addressed from 50–50 to 20–80 through optical feedback signals [26]. The present work aims to reproduce individual electronic gates with a stigmergic response based on that of the equivalent photonic gates [26], which has proven to be able to replicate the evolution of stigmergic processes. Therefore, this model aims to understand the physical processes underlying a stigmergic gate and to analyze how complex stigmergic networks, based on such gates, could work, starting from simple structures, characterized by few inputs and few outputs, up to more complex structures not yet realized in the photonic equivalent.

2 Stigmergic 2 × 2 gate

2.1 Conductance with linear saturation

The stigmergic paradigm can be shown through designing a gate whose switching efficiency between channels can be addressed by control signals. Consequently, any electronic stigmergic network which might be made using stigmergic 2 × 2 gates (ideal) will be composed by two circuitries: one dedicated to the management of the information signals, and another one dedicated to the management of feedback signals that control the switching rate of the gates. Information currents travel forward, while control currents propagate backward; such peculiarity ensures a top-down addressing of the stigmergic networks. Any control is launched from the output and propagates backward, using an external independent generator of current, in order to re-address the whole network as a function of the desired behavior.

Fig. 1
figure 1

Scheme of the 2 × 2 stigmergic gate. The forward signal circuit is represented in black, while the control feedback circuit is represented in red (color figure online)

The general scheme of a stigmergic 2 × 2 gate is shown in Fig. 1 where the signal circuit is represented in black, and the control circuit in red. Two input signal currents ISin1 and ISin2 pass across the central node and are switched in one or both the output signal currents ISout1 and ISout2; on the same way, two control currents ICin1 and ICin2, injected from the output, travel backward in the control circuit and are switched toward either ICout1 and ICout2. The practical implementation of the stigmergic 2 × 2 gate requires both analogical and digital signal processing as shown in Fig. 2. Stigmergic optical gates can be addressed from 50–50 to 20–80 through optical feedback signals [26].

Fig. 2
figure 2

Practical implementation of the electronic stigmergic 2 × 2 gate. The back circuit is the signal portion, while the red one concerns the gate control. Continuous or dotted lines represent analog or digital circuitry, respectively (color figure online)

The two input signals 1 and 2 should be directed toward output 1 or 2 according to the gate setting, which is decided by the control currents. Such currents, after passing through nonlinear limiters that allow to manage the currents and prevent them from exploding to infinity, are both translated into digital conductances and compared. Each control current is translated into a conductance value, then compared with the other and normalized. These two normalized values are then transported into the signal propagation circuit and multiply the two input currents \((I_ {{\rm Sin}1}\) and \(I_ {{\rm Sin}2})\), determining a percentage p of output current toward one channel and a percentage (1−p) to the other channel. Therefore, the whole control of the gate is driven by the nonlinear conductances that the two channels manifest. So, the switching efficiency of the signal currents depends on the value of the saturating conductances, in the same way, as it happens in photonic gates [28], in the corresponding arms:

$$\begin{aligned} {G_{i} (I_{C{\rm in}i})}= {G_{\infty } \over {1+{{G_{\infty } \over {\gamma \cdot (I_{C{\rm in}i}+ I_{0})}}}}} \end{aligned}$$
(1)

(with \(i=1,2\)). Here, \(G_{\infty }\) is the saturation limit conductance

$$\begin{aligned} G_{\infty }=\lim _{I_{C{\rm in}i} \rightarrow +\infty } G_i \end{aligned}$$
(2)

and \(\gamma\) is the conductance sensitivity to the feedback control changes. Both \(\gamma\) and \(G_{\infty }\) depend only on the network geometry and consequently are fixed values. \(I_{0}\) is the initializing network current, and in an ideal case, it might be considered null. In practice, \(I_0\) cannot be zero, since it fixes the symmetric behavior of the switching gate that will be re-addressed by the control currents, ultimately favoring either one exit or the other. This phenomenon is more evident in the photonic stigmergic gate [27] where a non-zero amount of control light must be present to realize the initial symmetric waveguide junction. Then, we can identify the total currents in the feedback circuit arms as \(I_{{\rm FB}i} = I_0+I_{C{\rm in}i}\). They are not affected by the signal potentials, and their values depend only on the intensity of the feedback signals and on the switching percentage p (percentage value that determines the distribution of the feedback currents, variable between 0.5 and 1), according to the relation:

$$\begin{aligned} I_{C{\rm out}i}=pI_{{\rm FB}i}+(1-p)I_{{\rm FB}j} \end{aligned}$$
(3)

(with \(j=1,2\) and \(j\ne i\)). The characteristic expressions for the two output currents are:

$$\begin{aligned} {I_{S{\rm out}_i} \over {I_{Sin_1} +I_{Sin_2}}} = {{(G_{\infty } + \gamma I_{{\rm FB}_j)}} \over {G_{\infty } + 2 \gamma I_{{\rm FB}_j} + G_{\infty } {{I_{{\rm FB}_j}}\over {I_{{\rm FB}_i}}}}} \end{aligned}$$
(4)

In the limit \(G_{\infty } \rightarrow \infty\), the output signal currents would depend only on the ratio of the two feedback currents, but would be independent of the sensitivity \(\gamma\):

$$\begin{aligned} \lim _{G_{\infty } \rightarrow +\infty } \left( I_{S{\rm out}_i} \over {I_{Sin_1}+I_{Sin_2}} \right) ={ {1} \over {1 + {I_{{\rm FB}_j} \over {I_{{\rm FB}_j}}}}} \end{aligned}$$
(5)

Thus, in non-degenerate cases, the action of the feedback currents is consistent with the required behavior, but it never allows a complete switching:

$$\begin{aligned} \lim _{I_{{\rm FB}_i} \rightarrow +\infty } \left( I_{S{\rm out}_i} \over {I_{Sin_1}+I_{Sin_2}} \right) ={ {1 + {\gamma \over {G_{\infty }}} I_{{\rm FB}_j}} \over {1 + {2\gamma \over {G_{\infty }}} I_{{\rm FB}_j}}} \end{aligned}$$
(6)

and the fraction is always lower than 1. This limiting effect on the switching efficiency is the consequence of the saturating trend of the conductance. Trying to reach the maximum possible imbalance of the gate by doubling the feedback current

$$\begin{aligned} G_i \left( I_{{\rm FB}_j}= 2 I_0 \right) = nG_i\left( I_{{\rm FB}_i} = I_0 \right) \end{aligned}$$
(7)

we obtain:

$$\begin{aligned} I_0 = {G_{\infty } \over {\gamma }} {{2-n} \over {2(n-1)}} \end{aligned}$$
(8)

However, considering \(I_0 \>0\), the conductance ratio n cannot exceed 2 (\(n<2\)). Consequently, the largest normalized output signal for any arm of the gate, when the total control currents in the two arms are \(I_0\) and \(2I_0\), respectively, is limited to:

$$\begin{aligned} I_{S{\rm out}_i}= {2 \over {2+1}} = 0.66 \end{aligned}$$
(9)

The result of this electronic model does not reproduce the experimental results obtained in the photonic case, where the switching ratio obtained by doubling the control signal reached a larger value, up to about 0.8. Thus, the linear saturation model should be replaced by a nonlinear saturation one, in order to induce faster switches.

2.2 Conductance with quadratic saturation

As mentioned, more efficient switching can be reached adopting conductances with quadratic saturations:

$$\begin{aligned} G_i \left( I_{{\rm FB}_i} \right) ={ G_{\infty } \over {1+ {\left( G_{\infty } \over {\gamma I_{{\rm FB}_i}}\right) }}^2} \end{aligned}$$
(10)

In the limit \(G_{\infty } \rightarrow \infty\), the output signal currents would depend only on the ratio of the two feedback currents, but would be independent of the sensitivity \(\gamma\): The fundamental difference, with respect to the previous case, is the parabolic rise at low intensities that induces higher switches at lower current values. Figure 3 gives a comparison between the linear and nonlinear conductance responses. The nonlinear 2 × 2 gate now evidences the new characteristic curves for the output signals:

$$\begin{aligned} I_{S{\rm out}_i} \left( I_{Sin}, I_{FB}\right) ={ {I_{Sin_1}+I_{Sin_2}} \over {1+{ {{1+ {\left( G_{\infty } \over {\gamma I_{{\rm FB}_i}}\right) }}^2} \over {{1+ {\left( G_{\infty } \over {\gamma I_{{\rm FB}_j}}\right) }}^2}}}} \end{aligned}$$
(11)

with \(i \ne j\).

The maximum switching values asymptotically reachable for very high feedbacks are expressed by the quantities:

$$\begin{aligned} \lim _{I_{{\rm FB}_i} \rightarrow +\infty } \left( I_{S{\rm out}_i} \over {I_{Sin_1}+I_{Sin_2}} \right) = { 1 \over {1+{ {{1 \over {{1+ {\left( G_{\infty } \over {\gamma I_{{\rm FB}_j}}\right) }}^2}}}} }} \end{aligned}$$
(12)

These relationships are only the function of the structural parameters and of the amplitude of the overall write signal to the other output branch of the junction. As seen in the linear saturating case, also here, we can notice that if the conductance did not suffer from the saturating behavior, but could instead grow to infinity, it would be possible to obtain complete switching. The switching sensitivity to the feedback currents is much improved using a nonlinear conductance saturation. In fact, increasing the control feedback current up to doubling the initializing value and imposing again the condition (7) we obtain:

$$\begin{aligned} I_0 ={G_{\infty } \over {\gamma }} \sqrt{{4-n} \over {4(n-1)}} \end{aligned}$$
(13)

which provides the limits for the ratio n between the channel conductances, which can be in range 1:4.

Fig. 3
figure 3

Switching of the normalized output currents driven by an increasing of the control current of the 1 terminal using linearly saturating (dotted lines) and quadratically saturating (continuous lines) conductances

In particular, considering the generic output, we have for \(1<n <4\):

$$\begin{aligned} {I_{S{\rm out}_i} \over {I_{Sin_1}+I_{Sin_2}}} = {4 \over {4+1}}=0.8 \end{aligned}$$
(14)

This value best reproduces the experimental result obtained with the experimental photonic gate [27].

3 Multi-gate complex networks

3.1 3 × 3 channel network

Using 2 × 2 stigmergic gates, 3 × 3 channel networks can be designed, as shown in Fig. 4a. The analysis of more complex gates is indeed more difficult due to the large number of possible paths that the information might follow within the electronic network. Considering 3 × 3 channel networks, one possible scheme is represented in Fig. 4, where the three conductances have been numbered with the z index ranging from 1 to 3.

Fig. 4
figure 4

a Scheme of a 3 × 3 stigmergic network based 2 × 2 on gates and its implementation b in Simulink environment

By focusing on the output channel 1 as a reference, the current arriving to it is:

$$\begin{aligned} \begin{aligned} I_{S{\rm out}_1} = I_{Sin_1} \left( {G_{1,1} \over {G_1}} {G_{3,1} \over {G_3}} + {G_{1,2} \over {G_1}} {G_{2,1} \over {G_2}} {G_{3,1} \over {G_3}} \right)&+ \\ I_{Sin_2} \left( {G_{1,1} \over {G_1}} {G_{3,1} \over {G_3}} + {G_{1,2} \over {G_1}} {G_{2,1} \over {G_2}} {G_{3,1} \over {G_3}} \right) + I_{Sin3} \left( {G_{1,2} \over {G_1}}\right) \end{aligned} \end{aligned}$$
(15)

where \(G_{z,1}\) is the z-th conductance in the arm 1 of the z-th gate, while \(G_z = G_{z,1} +G_{z,2}\) is the total conductance of the z-th gate. Generalizing, the output current on the m-th output arm gets the form:

$$\begin{aligned} I_{S{\rm out}_m} = \sum _{n=1}^{3} I_{Sin_n} \sum _{r=1}^{k(n,m)} \prod _{s=1}^{3} {G(r)_{s,1} \over {G(r)_s}} \end{aligned}$$
(16)

where m is the selected output, n the input, k(nm) is the number of paths that connects the n-th input with the m-th output, r is the path taken into consideration, s is the gate in the path, and G(r) is the conductance along the r-th path. The network performances have been tested using a MATLAB code, whose sketch is shown in Fig. 4b. Reinforcing the input control current \(I_{Cin_1}\) would result in a reinforcement of the corresponding signal output \(I_{S{\rm out}_1}\), as shown in Fig. 5. A steep slope carries this current at almost \(80\%\) of the total input current for a tripling of the corresponding control current. We found the same control current value for all three ports on the network. In this case, a higher control current was necessary to get the same switching ratio found for the single gate 2 × 2. This finding highlights an important phenomenon: As the number of internal junctions increases, the feedback current, necessary to reach a certain fixed value at a normalized output, increases.

Fig. 5
figure 5

Switching of the normalized output currents driven by an increasing of the control current of the 1 terminal. Simulation refers to the 3 × 3 network

The increase is not only a function of the number of internal nodes, but it also depends also on how these nodes are distributed and on the proximity of the channels, so as to achieve the conductance saturation.

3.2 10 × 10 channel network

The simulation of the 3 × 3 network showed the low sensitivity when routing the entire network to a specific output which was appropriately highlighted by a feedback signal. The increase in control current, needed to switch the network, augments itself according to its dimensionality. This is a critical factor for the development of a complex system with many gates. The transition from a single 2 × 2 port to a 3 × 3 network implies an increase about 2–4 times of the necessary feedback current. This important influence of complexity on the required control values has led us to study a more complex network, 10 × 10, to highlight a functional dependence on feedback. Figure 6 shows the configured 10 × 10 network. Figure 7 shows the currents at the output ports for a control sent from port 1 (Fig. 7a) or from port 5 (Fig. 7b) or from port 10 (Fig. 7 c). In all three cases, the necessary increase in feedback current to switch the whole network is very high: Port 1 requires 56-fold increase, 8fold for port 5 and 12-fold for port 10. The large variability between the values of the control currents depends on the network complexity along the trajectories, in order to achieve a specific output. Such complexity is strongly influenced by the number of nodes involved and by how deep they lie within the network, i.e., the distance of a certain node from the reinforced output. For the values of k prime close to the reinforced channel, the decreasing trend of the feedback current required for switching the network is justified by the presence of an increasing number of nodes involved in the trajectories followed by the feedback.

Fig. 6
figure 6

Geometrical scheme of a 10 × 10 networks that points out the complexity of connection nodes

Fig. 7
figure 7

Switching of the normalized output currents driven by an increasing of the control current of terminal 1 (a), terminal 5 (b) or terminal 10 (c). Simulation refers to the 10 × 10 network

This means that multiple nodes are able to individually unbalance, contributing to a greater flow of current coming from the inputs to that particular output. The mechanism described above is valid as long as the ports receive a feedback signal of sufficient amplitude for a significant imbalance. When the involved gates are too deep, or distant, even if in increasing numbers, the feedback control current encounters too many splits, thus rendering themselves to weak to function. Therefore, individual imbalances are too small to actively contribute to a general switching of the whole network toward the particular reinforced output.

3.3 Energy management

The problem of sustaining the amplitude of feedback signals, which becomes more critical as the number of inputs/outputs of networks increases, can be theoretically solved by amplifying the stimuli each time they cross a junction. Therefore, an alternative compromise may require an efficient system to monitor the feedback at each point of the network with sensors and to provide a local amplification when the amplitudes fall below a specific threshold. However, there might be a topological optimization that could keep the management energy at reasonable levels. Let’s consider the general expression for the control current reaching the gate z-th:

$$\begin{aligned} I_{Cin_{z,l}} =\sum _{j=1}^{n(R)} I_{{\rm FB}_j} \sum _{r=1}^{k(j,z,l)} \prod _{s=1}^{k(j,z,l)} f(j,z,l,r,s) \end{aligned}$$
(17)

where f is a function whose codomain is defined by the set p, \(1-p\) , 1 and it has the task to select one of these factors depending on the analyzed node and path. Fixing \(p=1/2\) and considering the j-th active feedback, the control current at the l-th arm of the z-th gate becomes:

$$\begin{aligned} I_{Cin_{z,l}} =\sum _{j=1}^{n(R)} I_{{\rm FB}_j} \sum _{r=1}^{k(j,z,l)} \prod _{s=1}^{k(j,z,l)} {1 \over {2}} = \sum _{j=1}^{n} I_{{\rm FB}_j} \sum _{r=1}^{k} {1\over 2}^k \end{aligned}$$
(18)

The worst case, i.e., the lowest control current, can be estimated as:

$$\begin{aligned} I_{Cin_{z,l}} \ge \sum _{j=1}^{n} I_{{\rm FB}_j} \sum _{r=1}^{k} {1\over 2}^k = \sum _{j=1}^{n} I_{{\rm FB}_j} {k \over {2^{k_{max}}}} \end{aligned}$$
(19)

Two important points should be stressed: 1. the k term at the numerator gives a linear dependence of the control current by the number of paths which connect the z-th node with the j-th output. Increasing the number of paths would enhance the corresponding control current at the z-th node; 2. instead, the power term \(2^{k_{max}}\) at the denominator describes how the trajectories with a larger number of nodes are a limitation. They require a high increase in the feedback current and therefore exert little control on the gearing the entire network toward the j-th output. The power term dominates when the order of the network increases, thus leading to the creation of the worst possible outcomes, regardless of the number of accessible paths, i.e., of the number of nodes that the feedback signal can unbalance. This analysis points out that adopting single gates with a number of outputs greater than 2, (for example, 3 × 3 or 10 × 10 gates), would allow for a great improvement across the entire network. This process is decisive for large networks, since a variable-base power is definitely lower than a power term with variable to the exponent. Here, the management of complex systems becomes accessible with controlled levels of energy using an innovative technology based on junctions with an arbitrary number of tributary channels. A practical example is represented by the neurons [30,31,32,33], which act as logic gates with N synaptic inputs and outputs. The development of complex reasoning is therefore ensured by the ability to manage single switching ports with many inputs and many outputs, with a well-controlled energy management plan, uniformly distributed across the entire processing network.

4 Modified stigmergic gates and power consumption

The diagram of a single 3 × 3 gate is shown in Fig. 8a, whose behavior is shown in Fig. 8b. The new single 3 × 3 junction network is more sensitive to the feedback. In fact, to obtain a total switching of \(80\%\), it requires less variation (about \(50 \%\) less of the control current compared to a similar 3 × 3 network realized by 2 × 2 ports.

Fig. 8
figure 8

a Scheme of a 3 × 3 stigmergic gate and b its switching of the normalized output currents driven by an increasing of the control current of the 1 terminal

This drastic reduction is a significant advantage in complex networks and is crucial for the total network order increase. To highlight the importance of reducing control current in complex networks, we have implemented a network with 10 inputs and 10 outputs in order to make a direct comparison with the same configuration based on 2 × 2 ports shown previously in Figs. 1, 2. The network behavior was analyzed by Simulink, and the result of the simulation is shown in Fig. 8, where the output currents of the 10 terminals are shown after a control feedback has been injected to channel 1. Corresponding with an increasing of the output 1 current, a notable decrease in all of the currents in the remaining channels is found. An interesting feature to point out here is the perfect symmetry of the output channels. They have an identical behavior, Fig. 9, and it is not possible to distinguish the different curves, which are shown to be perfectly superimposed on each other. The entire network of 10 inputs and 10 outputs fully switches (\(70\%\)) for control current values only 4 times greater than the initial feedback (2 × 2 gate), which means more than \(50 \%\) of the power needed. For the same switching ratio, the 2 × 2 gates network required a control current up to 15 times higher (more than one order of magnitude). Thus, an increase in the number of channels at the single gate is reflected in a much lower level of control current needed to switch complex networks.

Fig. 9
figure 9

Switching of the normalized output currents driven by an increasing of the control current of the 1 terminal in a 10 × 10 stigmergic network based on 3 × 3 gates. In this case, all the inhibited terminals show exactly the same dynamics, and consequently, all trends are represented by a single curve

5 Conclusion

In the present work, electronic 2 × 2 stigmergic gates have been designed to simulate the behavior found in the equivalent photonic stigmergic junctions. The proposed gates are indeed innovative and can be efficiently applied in existing networks. The use and application of stigmergic technology have proved extremely effective for the optimization of complex problems, and its hardware implementation allows for the simplifying of the management of these networks, without having to resort to the use of time-consuming software processing. This work studies energy management in stigmergic structures and in particular has highlighted how the use of complex logic gates (i.e., with many inputs and many outputs) can drastically reduce the percentage of energy required. To achieve this goal, we started from a simple circuit made up of 2 × 2 gates and then progressively increased its complexity, in terms of the number of gates used or the number of inputs and outputs for each. The simulation of large circuits based on 2 × 2 gates has shown a major limitation in the high power required for control, which increases with network complexity. A great improvement is evidenced by the use of single gates with a large number of input and output channels, indeed larger than the simple 2 × 2 X junctions: the replacement of 3 × 3 ports to 2 × 2 ones used in networks with 10 parallel channels has led to a substantial reduction in the need for control current power of one order of magnitude. Therefore, this work suggests that the improvement of complex signal processing networks can be performed using neuromorphic stigmergic systems, where multichannel ports with an extremely high number of inputs and outputs (quite similar to neurons) can be implemented. The increase in processing channels provides the best possible outcome, by many orders of magnitude, to simplify complex networks and drastically reduce the energy consumption needed to control them. Future evolutions of the presented work will concern the quantification of the maximum number of IN / OUT ports and / or gates necessary to ensure reliable operating of the system and of the maximum number of path splits above which the system cannot work properly. Moreover, we are currently working on adding meta-heuristic optimization methods to the model to make it more general and flexible.