Skip to main content

Van Fish Optimization (VFO) algorithm

Project description

Van Fish Optimization (VFO) Algorithm

Van Fish Optimization (VFO) is a meta-heuristic optimization algorithm inspired by the unique migration behavior of the Pearl Mullet (Alburnus tarichi) living in Lake Van, Turkey. These fish swim against the current and jump over obstacles during migration, behaviours which VFO models to solve complex optimization problems.

Key features include:

  • Directional Search: Mimics swimming against the current towards a target.
  • Local Escape: Uses a jumping mechanism (Lévy flight) to escape local minima, modeled after fish jumping obstacles.
  • Adaptive Parameters: Uses energy-based and time-varying parameters to balance exploration and exploitation.

Installation

You can install the package via pip:

pip install vfo-optimizer

Usage

Here is a simple example of how to use VFO to minimize the Sphere function:

import numpy as np
import VFO

# 1. Define your objective function (must take a 1D array and return a scalar)
def sphere_function(x):
    return np.sum(x**2)

# 2. Define problem bounds (lower and upper limits for each dimension)
dim = 10
bounds = [[-100, 100]] * dim

# 3. Initialize the VFO optimizer
optimizer = VFO.VFO(
    objective_func=sphere_function,
    bounds=np.array(bounds),
    num_agents=30,      # Population size
    max_iter=100,       # Maximum iterations
    dimension=dim,      # Problem dimension
    verbose=True        # Print progress
)

# 4. Run optimization
best_position, best_fitness, history = optimizer.optimize()

print(f"Best Fitness Value: {best_fitness}")
# print(f"Best Position: {best_position}")

Hyperparameters

When initializing the VFO class, you can tune the following parameters:

Parameter Type Default Description
objective_func callable Required The objective function you want to minimize.
bounds array Required A list of [min, max] tuples for each dimension.
dimension int 2 The number of dimensions (variables) in the problem.
num_agents int 30 Population Size (N). Higher values check more areas but increase computation time.
max_iter int 100 Maximum Iterations. How many times the population updates itself.
stagnation_threshold int 5 Jump Trigger. If an agent doesn't improve for this many steps, it performs a Lévy flight to jump out of local minima.
verbose bool False If True, prints the best fitness value at each iteration.

Theoretical Model

The algorithm mathematically models the fish behavior using three main components:

  1. Position Update (Swimming): Fish move towards the leader ($X_{best}$) but are affected by the current ($A$) and randomness ($B$). $$X_{new} = X_{current} + A \cdot (X_{best} - X_{current}) + B \cdot R$$

  2. Adaptive Coefficients:

    • $A$ (Current Resistance): Decreases linearly from 2 to 0. Promotes exploration early on and exploitation later.
    • $B$ (Randomness): Decreases over time to reduce random scattering as the target is approached.
  3. Lévy Flight (Jumping): If a fish (agent) cannot improve its position for a certain number of steps (stagnation_threshold), it assumes it is stuck at an obstacle (local minimum) and performs a long-distance jump using a Lévy distribution.


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

vfo_optimizer-0.0.2.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

vfo_optimizer-0.0.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file vfo_optimizer-0.0.2.tar.gz.

File metadata

  • Download URL: vfo_optimizer-0.0.2.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for vfo_optimizer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5ecec5f21ace5159da2004cf0905f76361e62841b3da57b6d14a34a2a811e221
MD5 39eb3d05e7e1677479d52b7799dc9d0e
BLAKE2b-256 0ede866b49aeed191a7ae3b80bc651f8119ef5b6a2898049b11ef18f6af66be7

See more details on using hashes here.

File details

Details for the file vfo_optimizer-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: vfo_optimizer-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for vfo_optimizer-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d12aa3d35a42445c5553945291b671363fff0ee44ef45f844bdb4677c2de0047
MD5 daea18249f792787c799db4b53352adb
BLAKE2b-256 182197cafc7af42dd7738c116b864db669a599a3ccf4c6d59148288e1d374022

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