Skip to content

SioKCronin/nature-inspired-optimisation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nature-Inspired Optimisation

My goal with this project is to celebrate optimization strategies from our blue planet. I see our collective documentation of strategies from nature as a heritage we can all observe, document, and celebrate together. My hope is we can use these algorithms as a meeting ground for refining our collective understanding.

Links to original papers introducing (or meta-analysis overviews of) the following algorithms/heuristics/methods:

Publications

Conferences

Research teams

Getting Started

Install the package locally. Once installed you can import nio from anywhere on your system.

EXAMPLE: Using the IWD-CO Algorithm

The Intelligent Water Drops - Continuous Optimization (IWD-CO) algorithm simulates water drops flowing through a landscape, where drops move toward areas with less soil (better solutions). The implementation includes multiple liquid and soil types, each with distinct physical properties that affect optimization behavior.

Basic usage:

from nio import IWDCO

optimizer = IWDCO(bounds=[(-5.12, 5.12)] * 5, population_size=40, seed=42)
best_position, best_value = optimizer.run(iterations=200)
print(best_value)

Using specific material types:

The algorithm supports 6 liquid types (H2O, OIL, ALCOHOL, GLYCEROL, MERCURY, HONEY) and 6 soil types (SAND, CLAY, SILT, GRAVEL, LOAM, PEAT), each with different properties affecting velocity, soil pickup, and deposition:

from nio import IWDCO, LiquidType, SoilType

# Use specific liquid and soil types
optimizer = IWDCO(
    bounds=[(-5.12, 5.12)] * 5,
    population_size=40,
    liquid_types=[LiquidType.OIL, LiquidType.ALCOHOL, LiquidType.HONEY],
    soil_types=[SoilType.SAND, SoilType.CLAY, SoilType.LOAM],
    liquid_distribution="uniform",  # or "random"
    seed=42
)
best_position, best_value = optimizer.run(iterations=200)

Material properties:

  • Liquid types affect velocity (viscosity, velocity multiplier) and soil carrying capacity
  • Soil types affect movement resistance, pickup difficulty, deposition rate, and erosion rate
  • Different combinations create diverse optimization behaviors

EXAMPLE: Using the Water Cycle Algorithm

The Water Cycle Algorithm (WCA) simulates the natural water cycle process, where streams flow toward rivers, rivers flow toward the sea, and evaporation/raining processes provide exploration.

Basic usage:

from nio import WaterCycleAlgorithm

optimizer = WaterCycleAlgorithm(
    bounds=[(-5.12, 5.12)] * 5,
    population_size=40,
    num_rivers=4,
    seed=42
)
best_position, best_value = optimizer.run(iterations=200)

Algorithm features:

  • Sea: Best solution (global best)
  • Rivers: Better solutions that streams flow toward
  • Streams: Population members that flow toward rivers or sea
  • Flow process: Streams and rivers move toward better solutions
  • Evaporation: When streams/rivers get close to sea, they evaporate
  • Raining: Evaporated water creates new random solutions for exploration

Parameters:

  • num_rivers: Number of rivers (better solutions), typically 3-5
  • evaporation_rate: Base probability of evaporation (controls exploration)
  • max_evaporation_distance: Maximum distance for evaporation to occur
  • flow_rate: Base rate at which water bodies move toward targets

Using specific liquid types:

The algorithm supports 7 liquid types (FRESH_WATER, SALTWATER, DISTILLED_WATER, HOT_WATER, COLD_WATER, HEAVY_WATER, STEAM), each with different properties affecting flow speed, evaporation rate, and boiling point:

from nio import WaterCycleAlgorithm, WCA_LiquidType

# Use specific liquid types
optimizer = WaterCycleAlgorithm(
    bounds=[(-5.12, 5.12)] * 5,
    population_size=40,
    num_rivers=4,
    liquid_types=[WCA_LiquidType.HOT_WATER, WCA_LiquidType.STEAM, WCA_LiquidType.FRESH_WATER],
    liquid_distribution="uniform",  # or "random"
    seed=42
)
best_position, best_value = optimizer.run(iterations=200)

Liquid properties:

  • Flow speed: Affects how fast water bodies move toward targets (STEAM is fastest, HEAVY_WATER is slowest)
  • Evaporation rate: Affects probability of evaporation (HOT_WATER/STEAM evaporate faster, COLD_WATER slower)
  • Boiling point: Affects distance threshold for evaporation (lower = evaporates at greater distances)
  • Density: Affects flow behavior

Different liquid types create diverse optimization behaviors - fast-flowing liquids like STEAM explore quickly, while slower liquids like HEAVY_WATER provide more controlled convergence.

Contributing

Contributions are welcome across algorithms, benchmarks, documentation, and examples.

  • Open an issue first for substantial feature work to align on scope.
  • Fork the repo and create a focused branch per change.
  • Add or update tests and examples where practical.
  • Keep algorithm references (paper links/citations) in the README or module docstrings.
  • Open a pull request with a clear summary of motivation, approach, and validation steps.

License

This project is licensed under the MIT License.

Copyright (c) 2018-present Nature-Inspired Optimisation contributors.

About

Library of swarm-intelligence algorithms

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages