Skip to main content

Another Numeric optimization and Metaheuristics Library

Project description

Another Numeric optimization and Metaheuristics Library

A library to do your metaheuristics and numeric combinatorial stuff.

To install use:

pip install anmetal

See /test folder for examples of use.

Content

Numeric optimization

Iterative optimization functions (one solution)

  • Euler method
  • Newton method

Metaheuristics

Real input (Population-based)

  • Artificial Bee Colony (ABC)
  • Ant Colony Optimization (ACO)
  • Artificial Fish Swarm Algorithm (AFSA)
  • Bat Algorithm
  • Blackhole Algorithm
  • Cuckoo Search
  • Firefly Algorithm
  • Harmony Search (HS)
  • Particle Swarm Optimization (PSO)
  • Particle Swarm Optimization with Leap
  • Greedy
  • Greedy with Leap

Categorical input

  • Genetic Algorithm
  • Genetic Algorithm with Leap

Problems and gold-standard functions

NP-hard problems

  • Real problems

    • Partition problem
    • Subset problem
  • Categorical problems

    • Knapsack
    • Sudoku (without initial matrix, just random)

Non linear functions

Additional Features

Binarization functions

  • sShape1
  • sShape2
  • sShape3
  • sShape4
  • vShape1
  • vShape2
  • vShape3
  • vShape4
  • erf

Binarization strategies

  • standard
  • complement
  • static_probability
  • elitist

Example Usage

See the /test folder for complete examples. Here's a quick overview of running different metaheuristics:

# Example with Partition Problem
from anmetal.problems.nphard_real import Partition_Real
from anmetal.population.PSO.PSOMH_Real import PSOMH_Real

# Create problem instance
problem = Partition_Real(seed=0, num_dims=200)

# Create and run metaheuristic
mh = PSOMH_Real(problem.min_x, problem.max_x, problem.ndim, False,
                problem.objective_function, problem.repair_function,
                problem.preprocess_function)

# Run optimization
fitness, solution = mh.run(verbose=True, iterations=100, population=30,
                         omega=0.8, phi_g=1, phi_p=0.5, seed=115)

Algorithm Parameters

Each metaheuristic has its own set of parameters. Here are some common ones:

  • Common Parameters

    • iterations: Number of iterations
    • population: Population size
    • seed: Random seed for reproducibility
    • verbose: Whether to print progress
  • Algorithm-Specific Parameters

    • ABC: limit
    • ACO: evaporation_rate, alpha, beta
    • BAT: fmin, fmax, A, r0
    • CUCKOO: pa
    • FIREFLY: alpha, beta0, gamma
    • GA: mutation_rate, crossover_rate
    • HS: hmcr, par, bw
    • PSO: omega, phi_g, phi_p

For detailed parameter descriptions and recommended values, see the respective algorithm implementations in the source code.

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

anmetal-0.1.0.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

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

anmetal-0.1.0-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

Details for the file anmetal-0.1.0.tar.gz.

File metadata

  • Download URL: anmetal-0.1.0.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.4

File hashes

Hashes for anmetal-0.1.0.tar.gz
Algorithm Hash digest
SHA256 13557c4be07fbc102f04ca2d6b7a706880b323cb5995650ca1bb2cba3c89add7
MD5 1b25c673daf11fd9ad185c5070f798f8
BLAKE2b-256 11a14a082a02571355cf3ce35e3529a858750a08f298cf659ec2a2a74276a30a

See more details on using hashes here.

File details

Details for the file anmetal-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: anmetal-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.4

File hashes

Hashes for anmetal-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c206b9a53bbcdc32065184dda7bcfeba360c12ed77b6886ef5280d63c53398a3
MD5 291310a43fc3fcb053135b85f7ac709c
BLAKE2b-256 4d3165e6155a8894089920f1b6ac1b683781188f9797c5ce229a0619ed632fa9

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