Skip to content

Two parallel implementations of the Gorilla Troops Optimizer meta-heuristic algorithm

Notifications You must be signed in to change notification settings

elenaferr0/parallel-gorilla-troops-optimizer

Repository files navigation

Artificial Gorilla Troops Optimizer (GTO)

The Artificial Gorilla Troops Optimizer (GTO) is a metaheuristic optimization algorithm inspired by the social behavior and foraging strategies of gorilla troops. It mimics the hierarchical structure and cooperative dynamics of gorillas, where a dominant "Silverback" leads the troop, and individuals engage in exploration and exploitation phases to find optimal solutions in the search space.

Algorithm Overview

GTO operates through a population-based approach with the following key phases:

  1. Initialization: A population of gorillas (candidate solutions) is randomly initialized within the problem bounds. The best individual is identified as the Silverback.

  2. Exploration Phase: Gorillas explore the search space using three strategies:

    • R1: Random migration to new positions.
    • R2: Movement towards other gorillas with adaptive perturbations.
    • R3: Collective movement based on differences between gorillas.
  3. Exploitation Phase: Gorillas exploit promising areas using two strategies:

    • R4: Following the Silverback with power-law based movements.
    • R5: Co-existence strategy balancing between following the Silverback and maintaining diversity.
  4. Group Formation: After each phase, the algorithm updates the population and Silverback based on fitness evaluations.

The algorithm uses control parameters like p (exploration probability), beta, and w to balance exploration and exploitation, with adaptive parameters F, C, and L that change over iterations.

Building the Code

The project can be built using CMake for the full project or Make for individual implementations.

Full Build with CMake

mkdir build
cd build
cmake ..
make

Individual Builds with Make

Alternatively, build each implementation separately:

make -C serial
make -C parallel/mpi_island
make -C parallel/mpi_master_slave
make -C parallel/hybrid_island
make -C parallel/hybrid_master_slave

Executables will be built in the bin/ directory.

Reproducing Benchmarks

To reproduce the benchmarks, use the benchmark.sh script. This script submits jobs to a PBS/Torque scheduler for running the GTO implementations with various configurations.

Benchmark Script Flags

  • -p project: Filter by project name (e.g., serial, mpi_island, mpi_master_slave, hybrid_island, hybrid_master_slave)
  • -s: Skip existing runs (checks for exec_timings* files)
  • -d: Dry run mode (prints commands without executing)

Example usage:

./benchmark.sh -p serial -d  # Dry run for serial implementation
./benchmark.sh -s            # Run all, skipping existing

The script runs benchmarks for population sizes 256, 512, 1024 with various processor configurations and topologies.

Checking Status

Use check_status.sh to monitor benchmark progress. It checks for missing runs, errors, and missing timing files.

Check Status Flags

  • -p project: Filter by project name (same as benchmark.sh)

Example:

./check_status.sh -p mpi_island

Colors indicate status:

  • Yellow: Missing run
  • Red: Error in run
  • Cyan: Missing timings

Results and Analysis

Benchmark results are saved in the output/ directories under each project folder (e.g., serial/output/run_pop256/).

To analyze performance and generate plots, run the analysis script:

python3 results/analyze_performance.py

This generates performance comparisons, scalability plots, and data files in results/output/plots/ and results/output/data/.


Parallel Implementations of the Artificial Gorilla Troops Optimizer (GTO)

1. Island Model (MPI)

This model is focused on improving solution quality by maintaining diversity through independent search and periodic, controlled migration.

Component GTO Role Implementation Steps Migration Policy
Island (Processor $i$) Independent GTO Troop 1. Creates an independent sub-population ($N_{local}$). 2. Runs full sequential GTO for $R$ iterations. 3. Maintains its own Local Silverback. Frequency: Typically every $R$ iterations (epoch).
Communication Layer Migration Coordination Emigration: Selects a migrant(s) (e.g., the $\mathbf{Local \ Silverback}$) and sends a copy to destination island(s). Selection (Emigration): Choose the $\mathbf{Local \ Silverback}$ (Exploitation focus) OR Random/Diverse individuals (Exploration focus).
Synchronization Information Exchange Immigration: Receives migrant(s) from neighbors and integrates them into the local troop's population. Topology: Ring, Star, or Fully Connected (defines who receives from whom).
Population Update Diversity Injection None (Migration is separate from GTO updates). Integration (Immigration): $\mathbf{Replace \ Worst}$ (Exploitation focus) OR $\mathbf{Replace \ Random}$ (Exploration focus).

2. Master-Slave (MPI)

This is the fastest model for convergence, focusing on distributing computation (updates and fitness) across slaves while centralizing the population and $\mathbf{X_{Silverback}}$ management on the Master.

Phase Master Rank (0) Action Slave Ranks (1 to P-1) Action Communication Type & Timing
Pre-Loop Initializes total population ($N$), evaluates fitness, identifies Global Silverback ($\mathbf{X_{Silverback}}$). None Initialization
Loop Start 1. Distribution (Scatter): Sends subset of gorilla positions ($X_{subset}$) and current $\mathbf{X_{Silverback}}$ to all slaves. 2. Receive: Gets $X_{subset}$ and $\mathbf{X_{Silverback}}$. Master $\to$ Slaves (Every Iteration)
Slave Computation 3. Wait/Synchronize. 4. Compute Full GTO Logic: Executes both Exploration and Exploitation phases using the received $\mathbf{X_{Silverback}}$ for guidance. Performs Boundary Checks and all Fitness Evaluations. Local Computation
Return Results 5. Wait/Receive (Gather): Blocks until all slaves send back their final $GX_{final}$ positions and fitnesses. 6. Send: Returns the final $GX_{final}$ positions and fitnesses to the Master. Slaves $\to$ Master (Every Iteration)
Post-Loop 7. Update Global Silverback: Aggregates all $GX_{final}$ results, updates $\mathbf{X_{Silverback}}$, and prepares for the next scatter. Loops back to Step 1 (Receive). Centralized Update

About

Two parallel implementations of the Gorilla Troops Optimizer meta-heuristic algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published