Skip to main content

Multi-Objective Adaptive Whale Optimization Algorithm (MO-AWAOA)

Project description

Multi-Objective Adaptive Whale Optimization Algorithm (MO-AWAOA)

[API Documentation]

This repository contains the implementation of the Multi-Objective Adaptive Whale Optimization Algorithm (MO-AWAOA), a nature-inspired optimization algorithm designed to solve both single-objective and multi-objective optimization problems. The algorithm integrates several enhancements, including quasi-oppositional learning, Lévy flight mutation, Gaussian Barebone mutation, and population restart mechanisms to improve convergence and diversity in the solution set.


🔧 Features

  • Multi-Objective Support: Uses an external archive to store non-dominated solutions and applies crowding distance for diversity maintenance.
  • Quasi-Oppositional Learning (QOBL): Enhances exploration during initialization by generating opposite solutions.
  • Lévy Flight Mutation: Introduces long-range jumps to escape local optima.
  • Gaussian Barebone Mutation: Exploits promising regions using a normal distribution centered around the best solution.
  • Population Restart Strategy: Reinitializes part of the population when stagnation is detected.

📁 File Structure

  • base.py: Core classes (Solution, Problem, Population, Archive) representing individuals, objective functions, populations, and external archives.
  • utils.py: Utility functions for dominance checks, crowding distance calculation, performance metrics (hypervolume, IGD), visualization, and checkpointing.
  • algorithm.py: Main MO-AWAOA implementation with support for single and multi-objective optimization.

🧠 Classes and Functions

Base Classes

  • Solution: Encapsulates decision variables (x), objective values (f), rank, and crowding distance.
  • Problem: Wraps the objective function and problem bounds.
  • Population: Manages a collection of Solution instances.
  • Archive: Maintains a set of non-dominated solutions for multi-objective optimization.

Utilities

  • dominates: Determines whether one solution dominates another.
  • crowding_distance_assignment: Assigns crowding distances to solutions for diversity preservation.
  • hypervolume, igd: Performance indicators for evaluating multi-objective algorithms.
  • plot_pareto_front: Visualizes the Pareto front in 2D or 3D.
  • save_checkpoint, load_checkpoint: Supports saving and restoring algorithm states.

Algorithm

  • MOAWOA: Main optimizer class supporting both single and multi-objective problems.
    • _initialize_population_with_qobl: Initializes population using QOBL strategy.
    • _restart_population: Restarts part of the population to avoid stagnation.
    • levy_flight, quasi_opposite_learning: Mutation strategies for exploration and exploitation.

🚀 Usage Example

import numpy as np
from moawaoa.algorithm import MOAWOA

# Define your objective function
def obj_func(x):
    # Example: ZDT1 test function
    g = 1 + 9 * np.sum(x[1:]) / len(x)
    f1 = x[0]
    f2 = g * (1 - np.sqrt(f1 / g))
    return [f1, f2]

# Set up the problem
bounds = (0, 1)
dim = 30
num_objs = 2
pop_size = 50
max_iter = 100

# Run the optimizer
optimizer = MOAWOA(obj_func, bounds, dim, num_objs, pop_size, max_iter, verbose=True)
pareto_front = optimizer.optimize()

# Plot results
from moawaoa.utils import plot_pareto_front
plot_pareto_front(pareto_front)

📈 Performance Metrics

  • Hypervolume: Measures the volume of the objective space dominated by the approximation set.
  • Inverted Generational Distance (IGD): Evaluates both convergence and diversity of the obtained solutions compared to a reference set.

📦 Dependencies

  • numpy
  • matplotlib
  • scikit-learn (for IGD computation)
  • deap (for hypervolume calculation)

Install dependencies using:

pip install numpy matplotlib scikit-learn deap

📝 License

This project is licensed under the MIT License – see the LICENSE file for details.


📬 Contact

For questions, suggestions, or contributions, feel free to open an issue or contact us directly.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mo_awaoa-1.2.5.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mo_awaoa-1.2.5-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file mo_awaoa-1.2.5.tar.gz.

File metadata

  • Download URL: mo_awaoa-1.2.5.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for mo_awaoa-1.2.5.tar.gz
Algorithm Hash digest
SHA256 c4a11db02ec24083d5dd9f0a0cf8d66d7853f6c6c1ddd618e98626e6056c33d1
MD5 8e5839b4c4234491710956e4421ea547
BLAKE2b-256 e84bc03cdb220598f5ff871e9af30066b5c10756e640538156bbd36ca5058db6

See more details on using hashes here.

File details

Details for the file mo_awaoa-1.2.5-py3-none-any.whl.

File metadata

  • Download URL: mo_awaoa-1.2.5-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for mo_awaoa-1.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c0fc1f59af8cae621c3ed3379303a6be21cc7fcfc4af222e804da5c8fe9f8051
MD5 50c91778a968e50b48f10029cd4b7a88
BLAKE2b-256 5b3e3ca86ee5fc36e7fc83e7ea475fcc6801d6f6c6067c21f906e34541b47a3e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page