**Begin** |

** 1: Initialization.** Set the generation counter ; Initialize the population randomly |

and each habitat corresponding to a potential solution to the given problem. |

**Step 2:** Evaluate the fitness for each individual in |

**Step 3: While** the termination criteria is not satisfied **do** |

Sort the population from best to worst. |

For each habitat, map the HSI to the number of species , |

Calculate the immigration rate and the emigration rate for each individual . |

Modify the population with the migration operator shown in Algorithm 3. |

Update the probability for each individual. |

Mutate the population with the mutation operation shown in Algorithm 4. |

Evaluate the fitness for each individual in . |

Sort the population from best to worst. |

; |

**Step 4: end while** |

**End.** |