Skip to main content
. 2025 Aug 5;25(15):4804. doi: 10.3390/s25154804
Algorithm 1: Modified Crow Search Algorithm (MCSA)
//Problem Initialization
OBjF: The objective function(minimize the distance error)
Fit(F): The fitness Function
DeciVar: Decision variable lir
FLsize: The flock size
Maxitr: maximum number of iterations
xi,iter: A vector for the position of crow i at time iter in the search space obtained from the mathematical approach
FLen(i)itr: The length of flight of crow i in specific iteration
P(w): The probability of awareness
Crownum: Number of crows of the flock
FSvector: The feasible solution vector(the intermediate area obtained from the CBA)
ri: A random number with uniform distribution between 0 and 1
FeasbTH:The feasability threshold
1. Positions and memories Initialization
          For Each i in Crownum
          Generate (FSvector)
          Fill(PosinitialMemory)
//2. Fitness function Evaluation
          Calculate (Fit(F))
//3. New position Generation
          For Each i in Crown
          Rand_Select (jCrownum)
          If rj > P(w)j 
          Generate (NewPos)
          xi,iter+1=xi,iter+rj×FLen(i)itr×mj,iterxi,iter
          else Generate (RandPos)
//4. Check feasibility of new positions
          For Each i in Crownum
          Check-Feasibility (NewPos)
          If NewPos FeasbTH
                NewPosUpdate(Pos)
          else No-Update(Pos)
//5. Evaluate fitness function for new positions
          For Each i in Crownum
          Calculate (Fit(F))
//6. Update memory
          For Each i in Crownum
          If Fit(F)i+1>Fit(F)i
          NewPosUpdate(Pos)
          Else No-Update(Pos)
//7. Check termination criterion
          If i Maxitr Repeat step 1