Multi-Objective Adaptive Whale Optimization Algorithm (MO-AWAOA)
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 ofSolutioninstances.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
numpymatplotlibscikit-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.
Metadata
Release files for mo-awaoa 1.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mo_awaoa-1.2.5.tar.gz | 9.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mo_awaoa-1.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.8 kB
Release files / mo_awaoa-1.2.5.tar.gz
| Download URL | mo_awaoa-1.2.5.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4a11db02ec24083d5dd9f0a0cf8d66d7853f6c6c1ddd618e98626e6056c33d1
|
|
BLAKE2b-256 checksum How to use checksums |
e84bc03cdb220598f5ff871e9af30066b5c10756e640538156bbd36ca5058db6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / mo_awaoa-1.2.5-py3-none-any.whl
| Download URL | mo_awaoa-1.2.5-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0fc1f59af8cae621c3ed3379303a6be21cc7fcfc4af222e804da5c8fe9f8051
|
|
BLAKE2b-256 checksum How to use checksums |
5b3e3ca86ee5fc36e7fc83e7ea475fcc6801d6f6c6067c21f906e34541b47a3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|