Skip to content

Repository files navigation

MetaJul

Test StatusVersionJulia ≥ 1.10License: MIT

MetaJul is a component-based metaheuristics framework written in Julia. Algorithms are built by composing interchangeable components (selection, variation, replacement, …), making it straightforward to configure, extend, and experiment with new designs without subclassing.

The project is described in the paper Experiences Using Julia for Implementing Multi-objective Evolutionary Algorithms, presented at MIC 2024.

Installation

using Pkg
Pkg.add(url="https://github.com/jMetal/MetaJul")

Quickstart

using MetaJul
# Solve ZDT1 with NSGA-II (default settings: 100 solutions, 25 000 evaluations)
problem =ZDT1()
algorithm =NSGAII(problem)
optimize!(algorithm)
solutions =foundSolutions(algorithm)

More complete examples are in the examples/ folder. Jupyter notebooks with step-by-step explanations are in notebooks/.

Running NSGA-II from the REPL

Julia compiles code on first use (JIT), so the initial run includes compilation overhead. To measure true execution time, run the algorithm twice and time the second call:

julia>using MetaJul
julia> problem =ZDT1()
# First call: triggers JIT compilation (~1–2 s overhead)
julia> algorithm =NSGAII(problem); optimize!(algorithm)
# Second call: compiled, reflects actual runtime
julia> algorithm =NSGAII(problem); @timeoptimize!(algorithm)
0.384 seconds (3.04 M allocations:289.114 MiB, 6.34% gc time)

For repeated benchmarking, BenchmarkTools.jl handles warm-up automatically:

julia>using BenchmarkTools
julia>@benchmarkoptimize!(NSGAII(ZDT1()))
BenchmarkTools.Trial:13 samples with 1 evaluation per sample.
Range (min  max):373 ms 410 ms
Median:384 ms

Features

Encodings

  • Continuous (Float64, Integer), Binary, Permutation

Problems

FamilyProblems
Single-objective continuousSphere
Single-objective binaryOneMax
Multi-objective continuousFonseca, Schaffer, Kursawe, ZDT1–4/6, DTLZ1, UF1
Multi-objective binaryOneZeroMax
Multi-objective permutationTSP
ConstrainedSrinivas, ConstrEx, Binh2, Tanaka, Osyczka2, Golinski, multi-objective Knapsack
Real-world problemsSubasi 2016 (RWA)

Operators

  • Mutation: Uniform, Polynomial, Bit-flip, Permutation swap
  • Crossover: BLX-α, Simulated Binary (SBX), Single-point, PMX
  • Selection: Random, Binary tournament

Algorithms

  • Local search
  • Genetic algorithm (single-objective)
  • NSGA-II
  • SMPSO (multi-objective PSO)

Quality indicators

  • Inverted Generational Distance (IGD)
  • Inverted Generational Distance Plus (IGD+)
  • Additive Epsilon Indicator (ε+)
  • Hypervolume (HV)

Other

  • Archives: unbounded non-dominated, bounded crowding-distance
  • Evaluation: sequential, multithreaded (MultithreadedEvaluation)
  • Observers:EvaluationObserver, FitnessObserver, FrontPlotObserver
  • CLI utility:bin/quality_indicator.jl

Running the tests

julia --project=. -e 'using Pkg; Pkg.test()'

How to cite

If you use MetaJul in your research, please cite:

@inproceedings{Nebro2024MetaJul,
author = {Nebro, Antonio J.},
title = {Experiences Using Julia for Implementing Multi-objective Evolutionary Algorithms},
booktitle = {Metaheuristics International Conference (MIC 2024)},
series = {Lecture Notes in Computer Science},
volume = {14753},
pages = {168--181},
publisher = {Springer},
year = {2024},
doi = {10.1007/978-3-031-62922-8_12}
}

Open issues and roadmap

Planned work is tracked on the open issues page.

About

Metaheuristics in Julia

Resources

Stars

7 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages