1 Introduction
The worm Caenorhabditis elegans (C. elegans) is a model organism for neurobiology as it displays fairly sophisticated behavior despite having only 302 neurons. One such behavior of interest is chemotaxis: the ability to sense chemicals such as NaCl and to then move in response to the sensed concentration. The worm prefers certain concentrations of NaCl as it associates them with finding food, with these concentrations thus acting as setpoints for the worm. This ability to search for and follow the level set (which is an isocontour in 2D) for a particular setpoint concentration is called contour tracking, and has been observed experimentally in the worm
[9]. Remarkably, the worm is able to track contours in a highly resourceconstrained manner with just one concentration sensor and a small number of neurons. Contour tracking is also an important function for autonomously navigating robots, and it is thus of interest from an engineering standpoint to study the small yet efficient chemotaxis circuit of C. elegans. The emergence of energyefficient nanoscale Neuromorphic hardware [4] motivates mapping these compact chemotaxis circuits onto Spiking Neural Networks (SNNs) in order to instantiate autonomously navigating robots operating under severe resource and energy constraints.One of the strategies that the worm uses is called klinokinesis, wherein the worm makes abrupt turns away from its current direction. Klinokinesis requires the worm to compare the current sensed concentration with past samples to estimate the concentration gradient along its path of motion. It turns away when it is above the setpoint and senses a positive gradient, or if it is below the setpoint and senses a negative gradient. It thus corrects its path so that it is always moving towards the setpoint. A model for the sensory neurons used to compute temporal derivatives was proposed in
[1]. Santurkar and Rajendran added motor neurons to the model from [1] to propose an SNN for klinokinesis [10]. They also demonstrated hardware compatibility with standard CMOS circuitry. However, their SNN required external currents to operate correctly and thus was not an autonomous solution. Shukla, Dutta and Ganguly resolved this problem by designing SNNs for the ratecoded logic operations required by the klinokinesis circuit and ensuring correctness of operation [11]. Furthermore, they incorporated an additional subcircuit to allow the worm to escape local extrema, reduced the response latency of the SNN by incorporating anticipatory control and demonstrated feasibility on nanoscale neuromorphic hardware.An important limitation of klinokinesis is that it only uses the sign of the gradient and not its magnitude. Thus while klinokinesis ensures that the worm is always moving towards the setpoint, it does not ensure that it takes the shortest path. By definition, the direction with the highest gradient magnitude corresponds to the path of steepest ascent or descent. Indeed, the worm is known to align itself along (or against) the gradient via gradual turns in a process called klinotaxis. The worm performs klinotaxis by estimating the spatial gradient in the direction perpendicular to its current path by comparing concentration values to the left and right of its head while moving in a snakelike sinusoidal motion, using this estimate to gradually correct its path. Izquierdo and Lockery proposed a mechanistic model for gradient ascent using klinotaxis and learned model parameters via evolutionary algorithms
[8]. Izquierdo and Beer subsequently attempted to map this model onto the connectome of the worm [7].The first important contribution of this paper is to build upon the gradient ascent circuit in [8] to develop a novel adaptive klinotaxis circuit that can be autonomously configured to perform gradient ascent, gradient descent, and disabled upon reaching the setpoint. Second, we implement this adaptive klinotaxis circuit with spiking neurons and then integrate it with the klinokinesis SNN from [11]. It is important to note that these strategies serve complementary roles, with klinokinesis allowing for rapid turns to ensure that the worm always moves closer to the setpoint, and klinotaxis allowing the worm to gradually optimize its path [5, 6]. Indeed, the worm is known to use klinokinesis and klinotaxis in tandem [5]. However, in the context of contour tracking, it is important to understand how klinotaxis and klinokinesis can work together. In particular, the worm must align with the gradient until it reaches the setpoint and must subsequently move perpendicular to the gradient to follow the setpoint contour, thus requiring the worm to change its behavior based on how close it is to the setpoint. This problem was previously encountered in work by Skandari, Iino and Manton who proposed a nonadaptive, nonspiking model that attempts to extend Lockery’s work to perform contour tracking [12]. Their simulations show that their network for reaching the setpoint and their network for subsequently following the contour are incompatible with each other, leading to a failure in tracking contours near regions with large gradients. The adaptive nature of our klinotaxis circuit allows us to address this important problem. Furthermore, the gradual nature of klinotaxis steering leads to large deviations from the setpoint while following the desired contour, a problem that we are able to address by also including the klinokinesis circuit to enable faster turns. Our circuit thus allows us to seamlessly integrate the benefits of both these navigation strategies.
We also incorporate orthokinesis in our SNN model, wherein the bot can also regulate its speed as a function of sensed concentration [3]. This allows it to slow down near the setpoint and near regions with large gradients, leading to a further reduction in deviations from the setpoint while following the desired contour. To the best of our knowledge, this is the first circuit model that successfully integrates klinokinesis, klinotaxis and orthokinesis.
2 Proposed Algorithm
2.1 Adaptive Klinotaxis
Klinotaxis is the mechanism whereby, as the worm moves along its sinusoidal trajectory, it compares the values of sensed concentrations in one halfcycle to those in the next halfcycle, and then changes its course based on this information. Klinotaxis has typically been studied in the context of gradient ascent, wherein the worm will bias its motion towards the side which is better aligned with the local gradient direction, thus gradually aligning with the gradient and performing steepest ascent, and thus allowing the worm to reach the peak faster. Crucially, if the worm had two spatially separated concentration sensors, then it could compare the values from these sensors to estimate the gradient direction, which is called tropotaxis. However, the worm only has one concentration sensor, thus requiring it to use its own body motion to sample to the left and right of its path, as it does with its sinusoidal motion. Such a setting is of great interest for highly resource constrained bots that are too small to carry two bulky sensors and where the spatial separation between sensors is too small to enable tropotaxis. In this paper, we enable our bot to not only perform gradient ascent, but also enable gradient descent and the ability to switch off the klinotaxis mechanism entirely. Furthermore, this change in behavior is affected autonomously based on sensed concentration, and we thus call this adaptive klinotaxis.
The gradient detector and klinotaxis blocks are depicted in Fig. 3(a). Like the worm, our bot has a single concentration sensor whose output at time is the sensed concentration . This is used to compute an adaptive differenceestimate for the gradient, , given as:
(1) 
Here is the sensed concentration averaged over the past seconds, and thus is an estimate for the temporal derivative . This is dynamically scaled by to allow the gradient detector neurons to effectively utilize available signaling bandwidth and to make its response invariant to the average concentration, allowing our bot to operate in environments where the concentrations can vary over many orders of magnitude. This is thus a simple but important modification to the static scaling used in [10, 11, 8, 7]. This is in turn scaled by to convert the temporal derivative to a spatial derivative, in line with . This requires the existence of a feedback loop which gives the sensory neurons access to the bot’s velocity, as depicted in Fig. 2. Note that such divisive gain modulation has also been observed in neurons invivo [2, 13]. Also note that while operating with a constant speed, as was the case in [10, 11], the temporal and spatial gradients are linearly proportional to each other and thus there was no need for such speeddependent scaling in past work.
The positive and negative parts of this signal given are respectively denoted by , where is a deltafunction which is if the input condition is true and is otherwise. Next, and are respectively fed into neurons and , noting that was encoded this way using two neurons because neurons can only have positive firing rates. We model and as leaky integrateandfire (LIF) neurons with respective membrane potentials and which evolve as:
(2) 
Here and are respectively the membrane capacitance and resistance. The neurons and fire when and respectively cross the firing threshold , and the membrane voltage is then reset to for the duration of the refractory period. The spiketrains of and are convolved with the kernel to generate the respective output currents and . This is an instance of ratecoding wherein increases with . However this mapping is nonlinear due to the refractory period, and crucially, saturates for large values of . The refractory period and parameters of are chosen so that this maximum value of is , a fact that will be used in the klinotaxis circuit. Apart from this nonlinear response, the other advantage of using spiking neurons is that unlike analog neurons they are not always on and are thus much more energyefficient. Finallly, the ratecoded gradient estimate is given as .
Having discussed the gradient detector circuit, we now proceed to describe the klinotaxis circuit. The first component is the oscillator current with time period , which is used to generate two oscillatory signals with opposite phases as: and . The second component is the bias function which determines the mode of operation of the klinotaxis circuit and is denoted by . The third input, , comes from the gradient detector discussed above. Output from these three blocks is fed to the two nonlinear “phase” blocks, denoted by “Phase()” in Fig. 3. These phase blocks are the most important part of the circuit, yielding output currents . The net turning rate due to klinotaxis is given by the scaled difference in output of these two phase blocks, where is the bot’s steering angle. We choose the convention wherein a positive change in will correspond to turning clockwise.
(3)  
(4)  
(5)  
(6)  
(7) 
To understand (4), observe that if we wish to reach the setpoint concentration to within an tolerance , it is straightforward to see that we want (gradient ascent) for , for (gradient descent), and (disable klinotaxis) for . By disabling klinotaxis close to the setpoint, we allow klinokinesis to seamlessly take over, allowing the bot to follow the setpoint contour using klinokinesis as demonstrated in [11]. These mechanisms thus serve complementary roles, with klinotaxis used to reach the setpoint, and klinokinesis to subsequently follow the setpoint contour. In (6), the nonlinear response of the phase blocks, (for input ), is equal to for , for , and for . Thus it increases linearly between and and saturates outside this range. While we have used this piecewiselinear form for in subsequent analysis, we have used a smoother and more biologically feasible approximation in our final contour tracking simulations, given as . Also note that , and are positive scaling constants.
We now proceed to describe the adaptive klinotaxis mechanism for the halfcycle from to . We will first do this for , corresponding to gradient ascent. In this halfcycle is positive and thus , meaning that saturates to . On the other hand, as is negative during this cycle, and thus lies in the linear region. Note that these are approximate statements that ignore the contribution from . While it can be verified that these statements are exact for (by noting that both and have maximum amplitude of ), they will be assumed for the entire halfcycle for ease of analysis. We are thus interpreting as a small perturbation to the output. We then have . Thus we see that for the bot turns slower when aligned along the gradient () and turns faster when aligned against the gradient (). The bot’s net motion is thus biased and it tends to align along the gradient, thus performing gradient ascent. This is depicted in Fig. 4(c) wherein the turning rate is higher and lower respectively for the red part () and green part () of the trajectories.
Next, we consider gradient descent with . In the first halfcycle is negative and thus , and thus saturates to . On the other hand, as is positive during this cycle, and thus lies in the linear region. Again, treating as a perturbation that only affects the nonsaturated phase, we have . Thus we see that for the bot turns faster when aligned along the gradient () and turns slower when aligned against the gradient (). The bot’s net motion is thus biased and it tends to align against the gradient, thus performing gradient descent.
Finally, we discuss the case of disabling klinotaxis by setting . Furthermore, we choose hitherto unspecified constants as and . For all time we then have that , recalling that by design, both and have a maximum magnitude of . Thus for , neither nor saturate and both lie in the linear region. We then have . Thus in this case, has no effect on the turning rate of the bot and hence the klinotaxis mechanism stands disabled. We note that the amplitudes of and respectively for the oscillatory and gradient terms were chosen such that they sum up to . This was done to maximize the dynamic range of input in the linear output regime, while also not allowing this input to saturate. Also note that the larger value of was chosen for the oscillatory component to ensure that the bot swerves to the left and right with a large enough amplitude and thus samples it local environment, despite the modulatory effect of the gradient term. At the same time, the amplitude of for the gradient term is large enough to ensure that it does have a sufficiently large modulatory effect to enable klinotaxis. In summary, the turning rate in the first halfcycle is given as:
(8) 
It can be verified that in the next halfcycle from to , we get the same expression for as given in (8), but now with a negative sign. Thus the bot turns clockwise in one halfcycle and anticlockwise in the next. Note also that it suffices to describe one fullcycle as the same mechanism recurs over time.
2.2 Klinokinesis
Klinokinesis is a course correction algorithm, wherein the worm turns around when it senses that it is moving away from the desired setpoint concentration. This happens in two cases: when it senses or if . Note that this requires computing an AND operation over the sensed gradient and concentration values for which we use the SNN developed in [11]. While klinokinesis allows for rapid corrections to the bot’s path and is thus well suited to closely following the contour once it is reached, it is not capable of finding the shortest path to the setpoint as it only uses the sign of the gradient and does not seek out the direction of steepest descent, thus motivating the inclusion of the complementary mechanism of klinotaxis.
2.3 Orthokinesis
We incorporate orthokinesis to reduce overshoot whilst following the setpoint contour using klinokinesis. We describe the bot’s speed in discretetime for ease of understanding, while noting that it is straightforward to convert this to continuoustime. For discrete time , the bot speed is given as:
(9) 
Here is a constant that ensures that the worm continues to move along the setpoint contour despite the second term going to close to . Furthermore, the second term is proportional to as a means of enforcing continuity in the values of . The term is included so that the worm slows down close to the setpoint. Thus by allowing the worm to slow down near the setpoint concentration, we enable improved contour tracking. We would also like the bot to slow down near regions with high gradient magnitudes so that it does not overshoot the setpoint. This is ensured by including in the denominator, which is the output of the gradient detector in the previous time step. Finally, is a constant scaling factor while is a constant that ensures that the denominator is never .
3 Results and Conclusions
The algorithms are visually compared in Fig.5(a). Note that the bot was started from the same starting point and initial angle in all three plots. Using only klinokinesis (left), the bot takes a long route to reach the setpoint and exhibits large overshoots around the setpoint contour. Adding klinotaxis (middle) allows the bot to reach the setpoint using a much faster route while also reducing setpoint deviation. Adding orthokinesis (right) further reduces the setpoint deviation.
We now define the Time to Reach Ratio (TRR) of an algorithm for a setpoint as the time taken to first reach using divided by the time to first reach using klinokinesis. Clearly, the TRR also depends on the particular concentration landscape, starting point and initial angle. Here we consider the aggregated TRR obtained by averaging the TRR over 10 landscapes, 10 starting points for each landscape and 10 initial angles for each tuple of landscape and starting point. Also note that the TRR for klinokinesis will trivially be . The second metric is adopted from [10, 11] to quantify the deviation from the setpoint once the bot has reached the contour. This metric is the average deviation ratio from setpoint (ADR), defined as , where is the first time that the bot reaches , is the total simulation time, and are respectively the maximum and minimum concentrations values on the landscape. Thus the ADR measures the timeaveraged ratio of the absolute deviation to the landscape concentration range. We report the aggregated ADR by averaging over the same set of configurations as for the aggregrated TRR.
The algorithms are benchmarked using these two metrics in the left panel of Fig. 5
(b). We find that there is a drastic reduction in the TRR, by a factor of 2.6, due to the inclusion of klinotaxis, implying that the bot reaches the setpoint faster. Remarkably this improvement is achieved despite the bot’s effective speed being reduced by a factor of roughly 7.5 by moving along a sinusoidal path instead of a straight line. As expected, a second effect of this reduced effective velocity is that the inclusion of klinotaxis also reduces the ADR, by a significant factor of 3.8. The TRR is slightly larger with the inclusion of orthokinesis as the bot slows down near the setpoint. However we observe a larger reduction in ADR, demonstrating that orthokinesis can adaptively tradeoff speed for a significant reduction in setpoint overshoot. The TRR and ADR respectively reduced by a factor of 2.4 and 8.7 by including both klinotaxis and orthokinesis (w.r.t just klinokinesis). Also note that the standard deviation of the TRR for both the “klinokinesis + klinotaxis” and “klinokinesis + klinotaxis + orthokinesis” algorithms were found to be
. The standard deviation of the ADR for “klinokinesis only”, “klinokinesis + klinotaxis” and “klinokinesis + klinotaxis + orthokinesis” algorithms were respectively found to be , and .In the right panel of Fig.5(b), we quantitatively demonstrate the drastic improvement in robustness of chemotaxis due to the inclusion of in the denominator of (1). We plot the ADR for the “klinokinesis + klinotaxis + orthokinesis” algorithm as a function of average landscape concentration. Without adaptive scaling (red), the ADR is comparable to that with adaptive scaling (green) in a narrow range of average concentration, but degrades rapidly away from this optimal range. Similar plots were also obtained for the “klinokinesis only” and “klinokinesis + klinotaxis” algorithms. This shows that previously proposed chemotaxis algorithms in the literature (that did not incorporate dynamic scaling) are not robust to concenctration rescaling, highlighting the importance of the novel dynamic scaling proposed in this paper. Finally, we refer the reader to [10] for a demonstration of the SNNbased klinokinesisonly strategy achieving lower ADR compared to PID control while also being significantly more energy efficient, with these results holding transitively for the schemes proposed here.
In conclusion, we have presented a scaleinvariant, adaptive chemotaxis algorithm using spiking neurons that successfully combines klinotaxis, klinokinesis and orthokinesis. This allows us to perform robust, resource constrained and energy efficient contour tracking while achieving stateoftheart performance.
References

[1]
(2012)
A model of chemotaxis and associative learning in c. elegans
. Biological cybernetics 106 (67), pp. 373–387. Cited by: §1.  [2] (1986) Gain control in the electrosensory system: a role for the descending projections to the electrosensory lateral line lobe. Journal of Comparative Physiology A 158 (4), pp. 505–515. Cited by: §2.1.
 [3] (1989) How animals use their environment: a new look at kinesis. Animal Behaviour 38 (3), pp. 375–383. Cited by: §1.
 [4] (2017) Leaky integrate and fire neuron by chargedischarge dynamics in floatingbody mosfet. Scientific reports 7 (1), pp. 8257. Cited by: §1.
 [5] (2009) Parallel use of two behavioral mechanisms for chemotaxis in caenorhabditis elegans. Journal of Neuroscience 29 (17), pp. 5370–5380. Cited by: §1.
 [6] (2018) Concerted pulsatile and graded neural dynamics enables efficient chemotaxis in c. elegans. Nature communications 9 (1), pp. 2866. Cited by: §1.
 [7] (2013) Connecting a connectome to behavior: an ensemble of neuroanatomical models of c. elegans klinotaxis. PLoS computational biology 9 (2), pp. e1002890. Cited by: §1, §2.1.
 [8] (2010) Evolution and analysis of minimal neural circuits for klinotaxis in caenorhabditis elegans. Journal of Neuroscience 30 (39), pp. 12908–12917. Cited by: §1, §1, §2.1.
 [9] (2006) Sensorimotor control during isothermal tracking in caenorhabditis elegans. Journal of experimental biology 209 (23), pp. 4652–4662. Cited by: §1.
 [10] (2015) C. elegans chemotaxis inspired neuromorphic circuit for contour tracking and obstacle avoidance. In 2015 International Joint Conference on Neural Networks (IJCNN), pp. 1–8. Cited by: §1, §2.1, §3, §3.
 [11] (2018) Design of spiking rate coded logic gates for c. elegans inspired contour tracking. In International Conference on Artificial Neural Networks, pp. 273–283. Cited by: §1, §1, §2.1, §2.1, §2.2, §3.
 [12] (2016) On an analogue signal processing circuit in the nematode c. elegans. In 2016 38th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), pp. 965–968. Cited by: §1.
 [13] (2015) Divisive gain modulation of motoneurons by inhibition optimizes muscular control. Journal of Neuroscience 35 (8), pp. 3711–3723. Cited by: §2.1.
Comments
There are no comments yet.