Crow Search Algorithm for optimization and its use cases

Crow Search Algorithm is a swarm intelligence algorithm with diverse applications
Listen to this story

Sometimes real-world problems require an approach which is different from traditional mathematics, which is more inspired by nature. The metaheuristic algorithms, a type of optimization technique, uses a certain tradeoff of randomization and local search. There are a lot of nature-inspired metaheuristic algorithms, one of which is the Crow Search Algorithm (CSA).  There are reasons for selecting a specific bird which would be explained in the article. Following are the topics to be covered.

Table of contents

  1. What is a Metaheuristic algorithm?
  2. What is a Crow Search Algorithm?
  3. How does it work?
  4. Pseudo steps to implement CSA as an optimizer
  5. Applications of CSA

In metaheuristic algorithms, meta- means ‘beyond’ or ‘higher level’. Let’s understand more about metaheuristic algorithms.


Sign up for your weekly dose of what's up in emerging technology.

What is a Metaheuristic algorithm?

The goal is to create an efficient and practical algorithm that works most of the time and produces high-quality results. 

Every metaheuristic algorithm makes some sort of compromise between local search and global exploration. Randomization is frequently used to get a wide range of solutions. Randomization is an effective method for transitioning from local to global search. As a result, practically all metaheuristic algorithms are often appropriate for nonlinear modelling and global optimization.

Metaheuristics can be an effective method for producing acceptable solutions to complicated problems through trial and error in a reasonable amount of time. Because of the complexity of the problem at hand, it is difficult to search for every potential solution or combination; instead, the goal is to identify a good practicable answer within an acceptable time frame.

Intensification and diversity are the two most important components of every metaheuristic algorithm. Diversification refers to the generation of varied solutions to explore the search space on a global scale, whereas intensification refers to focusing on the search in a local location by utilising knowledge that a current good solution has been discovered in this region. 

This is in addition to selecting the finest solutions. The best solutions are chosen to guarantee that they converge to optimality. Diversification by randomization, on the other hand, prevents solutions from being stranded at local optima while enhancing solution variety. A solid mix of these two primary components will almost always ensure that the global solution is feasible.

Are you looking for a complete repository of Python libraries used in data science, check out here.

What is a Crow Search Algorithm?

Crows (corvids) are said to be the most intelligent of all birds. They have shown self-awareness in mirror tests and the capacity to make tools. Crows can recognise one other’s faces and warn one another when a hostile one approaches. Furthermore, they can utilise tools, communicate in sophisticated ways, and recall the location of their meal for many months afterwards.

Based on the Crow a nature-based algorithm is developed which is named as Crow Search Algorithm. This algorithm shares these four properties with the crow’s behaviour.

  • Crows live in groups.
  • Crows memorize the location of their food stashes.
  • Crows follow each other to steal 
  • Crows guard their stores against theft

Why is the Crow Search Algorithm used?

The property of independently gathering responses from distinct things and then computing all replies as a whole to find the optimal solution to the given challenge. As a result of this method, a better optimal solution for a specific issue is found, which is why CSA is employed. Simply said, the notion of collective behaviour of decentralized, self-organization is used to solve a particular issue. For example, Forecasting an optimal policy which is best suited to launch a new product in the market.

How does it work?

The goal of this meta-heuristic is for a given crow to be able to follow another crow in order to find its hidden food location. The crow’s position should be updated gradually throughout this procedure. Furthermore, when food is stolen, the crow must alter its location.

It is considered that there is a d-dimensional environment with many crows. A vector specifies the number of crows, which is the flock size, as well as the location of the crow at each iteration in the search space. Each crow has a memory that stores the location of its hiding spot. The location of the crow’s hiding spot is indicated at each iteration. This is the finest position that a crow has ever had. Indeed, each crow remembers the location of its finest encounter. Crows travel across the area looking for better food sources (hiding places).

Assume that in the next iteration, another crow wants to go to its hiding location, which the previous crow designated. In this iteration, the first crow decides to follow another crow to another crow’s hiding location. In this situation, two outcomes are possible.

  1. The other crow does not know that the first crow is following. As a result, the first crow will approach the hiding place of the other crow. In this case, the new position of the first crow is obtained with the help of a random number with a uniform distribution between 0 and 1 and the flight length of the first crow at iteration. 
  1. The other crow knows that the first crow is following. As a result, in order to protect its cache from being stolen, the other crow will fool the first crow by going to another position in the search space. 
Analytics India Magazine

In CSA, the parameter of Awareness Probability is primarily responsible for intensification and diversification (AP). CSA prefers to search for a local region where a current excellent answer is located by decreasing the awareness probability value. As a result, employing low AP levels enhances intensity. On the other hand, when the awareness probability value increases, the likelihood of searching in the area of already good solutions drops, and CSA tends to explore the search space with randomness. As a result, using high AP values enhances diversity.

Pseudo steps to implement CSA as an optimizer 

The pseudo-step-wise procedure for the implementation of CSA as an optimization algorithm. 

  1. Setting up the problem and its parameters. The problem, decision variables, and restrictions are all defined. The customizable CSA parameters flock size, the maximum number of iterations, flight duration, and awareness probability are then evaluated. 
  2. Crows’ location and memory should be reset. As flock members, certain numbers of crows are randomly placed in a d-dimensional search area. Each crow represents a viable issue solution, and d is the number of choice factors. Each crow’s memory is set to zero. Because the crows have no experience in the first iteration, it is believed that they have concealed their meals at their initial position.
  3. Assess the objective function The quality of each crow’s location is calculated by entering the choice variable values into the objective function.
  4. Create a new position for crows. To create new positions in the search space by doing the following: Assume the first crow wishes to create a new role. This crow chooses one of the flock crows at random and follows it to find the location of the meals hidden by this crow. This procedure is done for each crow. 
  5. Examine the viability of a new viewpoint. The viability of each crow’s new position is examined. If a crow’s new position is viable, the crow changes its position. Otherwise, the crow remains in its present place rather than moving to the created new position.
  6. Determine the fitness/objective function of new places. The fitness function value for each crow’s new location is computed.
  7. The crows’ memories are updated based on the value of the objective function. If the fitness function value of a crow’s new position is greater than the fitness function value of the remembered position, the crow updates its memory with the new position. 
  8. Steps 4 through 7 are performed until the maximum number of iterations is achieved. When the termination requirement is fulfilled, the optimal memory position in terms of objective function value is presented as the optimization problem solution.

Applications of Crow Search Algorithm

CSA has been used effectively in a variety of application sectors. 

Optimal Power Flow 

Using the novel population-based optimization method, CSA, to solve the optimal power flow issue to reduce total fuel cost, total active power loss, voltage deviation, voltage stability index, and total emission. The study of the data produced using CSA reveals that the method is particularly efficient in handling various single objective functions. It is also discovered that this technique can achieve very quick convergence in all circumstances. It passed the Wilcoxon signed-rank test with very low p-values, proving its statistical significance. As a result, it is possible to infer that CSA is a potential approach for achieving a variety of goals in the field of power systems.

Feature Selection 

The process of picking the most crucial dataset and discarding extraneous ones is known as feature selection. If it is a wrapper technique, its application aspect is frequently connected to neural networks. To tackle the FS problem, a binary variant of CSA called BCSA with the V-shape is utilised. Six distinct datasets were employed, and their findings were compared to BBA, BPSO, SFS, and SBS. Another variant, in conjunction with K-nearest neighbour and CSA, was utilised to address the FS problem in text document classification.

Image Processing

Based on Kapur’s entropy, CSA is used to determine multilayer threshold optimum values of pictures. They ran their model through several threshold levels (2, 4, 8, 16, and 32). In terms of PSNR, SSIM, and FSIM measures, they claimed that CSA outperformed PSO, DE, GWO, MFO, and CS.

Similarly, in image segmentation, CSA is employed to determine the best cost of cross-entropy. The model is tested in multidimensional environments.

CSA is used to distinguish faces in low-resolution photos by integrating the Gabor filter, wavelet, and texture (GWTM).

Neural Network and Support Vector Machine 

Combined CSA with Support Vector Machine (SVM), neural network, and fraction theory to classify tuberculosis patients. The paper mentioned that their combination increased the speed of computation and decreased the time and cost spent on test samples. 

A dragonfly-crow algorithm called D-Crow hybridized with Support Vector Regression (SVR). It was applied to Virtual Machine Migration (VMM). The task of migrating a virtual computer from one real hardware environment to another is known as virtual machine migration. It is a component of maintaining hardware virtualization systems and something that providers consider while providing virtualization services. Teleportation is another term for virtual machine migration. The main difference between virtualization and virtual machine migration is that only the migration module is inculcated with the hypervisor.

Cloud computing

The deployment of virtual machines (VMs) in cloud data centres is a difficult undertaking. With the growing popularity of cloud computing throughout the world, a high number of virtual machines (VMs) will be concentrated on a small number of data centres (DCs) to maximize energy usage and data centre utilisation.  

CSA is used to present a resource-aware solution for consolidating large numbers of Virtual Machines (VMs) on a small scale in the cloud data centre. The CSA-based travel salesman problem (TSPCS) and the Greedy Crow Search were both employed (GCS).

A 2-tier VM placement strategy was presented to address a similar problem. The first was a queuing structure for scheduling VMs, whereas the second (CSAVMP) CSA-based VM problem was created to minimize power usage in data centres.


A revolutionary metaheuristic algorithm dubbed CSA is based on the cognitive behaviour of crows. CSA is a population-based optimization approach with only two configurable parameters, flight length and awareness probability, making it particularly appealing for applications in various technical fields. In CSA, the awareness probability parameter is directly utilised to adjust the algorithm’s variety. With this article, we have understood the concept and functionality of the Crow Search Algorithm.


More Great AIM Stories

Sourabh Mehta
Sourabh has worked as a full-time data scientist for an ISP organisation, experienced in analysing patterns and their implementation in product development. He has a keen interest in developing solutions for real-time problems with the help of data both in this universe and metaverse.

Our Upcoming Events

Masterclass, Virtual
How to achieve real-time AI inference on your CPU
7th Jul

Masterclass, Virtual
How to power applications for the data-driven economy
20th Jul

Conference, in-person (Bangalore)
Cypher 2022
21-23rd Sep

Conference, Virtual
Deep Learning DevCon 2022
29th Oct

3 Ways to Join our Community

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Telegram Channel

Discover special offers, top stories, upcoming events, and more.

Subscribe to our newsletter

Get the latest updates from AIM

What can SEBI learn from casinos?

It is said that casino AI technology comes with superior risk management systems compared to traditional data analytics that regulators are currently using.

Will Tesla Make (it) in India?

Tesla has struggled with optimising their production because Musk has been intent on manufacturing all the car’s parts independent of other suppliers since 2017.

Now Reliance wants to conquer the AI space

Many believe that Reliance is aggressively scouting for AI and NLP companies in the digital space in a bid to create an Indian equivalent of FAANG – Facebook, Apple, Amazon, Netflix, and Google.