Skip to content

Releases: Mojiajun2022/MPAOP

v0.4.0 — one entry point: MOMPA (num_objectives = 1 for single objective)

Choose a tag to compare

@Mojiajun2022 Mojiajun2022 released this 26 Jul 18:33

Breaking: SOMPA was removed. MOMPA is now the only solver entry point:

# single objective — num_objectives defaults to 1
best, pos, curve = MOMPA(fobj = f, lb = lb, ub = ub,
                         SearchAgents_no = 40, Max_iter = 200)

# multi objective
AP, AO, curve = MOMPA(fobj = zdt1, lb = zeros(30), ub = ones(30),
                      SearchAgents_no = 100, Max_iter = 200,
                      num_objectives = 2)

With num_objectives = 1 the classic single-objective MPA runs and returns the same (best_fitness, best_position, convergence_curve) triple SOMPA returned. Every SOMPA keyword (opposition, ftol, patience, round_digits, …) is accepted and applies to the single-objective path. Migrating a v0.3 script is a rename:

sed -i '' 's/\bSOMPA(/MOMPA(/g' *.jl

Also in this release

  • Default output filenames unified: mpa_so_log.csv / mompa_log.csv → mpa_log.csv, mpa_so_history.h5 / mompa_history.h5 → mpa_history.h5.
  • A vector-valued objective run with the default num_objectives = 1 now raises an ArgumentError that names the keyword to set, instead of failing obscurely.
  • MIT LICENSE added (the repository previously had no license file).
  • README, tutorial, changelog and examples updated for the unified API.
  • The v0.1 positional API (MPA, MPA_MPI, confidence_interval) is unchanged and forwards to the new engine.

All the v0.3.0 performance work carries over unchanged — see the v0.3.0 release for the 38–48× speed-ups, the MPI fix, and the full benchmark table.

📖 Tutorial · Changelog

Tests: 257 passing, plus an MPI test verifying a 17-agent population on 4 ranks reproduces the serial result bit for bit.

v0.3.0 — rewritten core: 38–48× faster, multi-objective, MPI fixed

Choose a tag to compare

@Mojiajun2022 Mojiajun2022 released this 26 Jul 18:16

Complete rewrite of the compute core. The keyword interface of SOMPA and MOMPA is unchanged — existing scripts run unmodified and faster.

📖 Full tutorial · Changelog

Performance (Apple M-series, 12 cores, Julia 1.11)

Benchmark v0.2.1 v0.3.0 Gain
Single objective, 30-D sphere, 100 agents × 200 iter 0.480 s / 262 MiB 0.010 s / 0.1 MiB 48× faster, 2600× less memory
Multi objective ZDT1, 30-D, 100 agents × 200 iter 0.875 s / 3038 MiB 0.023 s / 3.5 MiB 38× / 870×
Non-dominated sort, n=2000, M=2 0.850 s / 3147 MiB 0.002 s / 0.5 MiB 425×
update_archive, 20 calls 0.030 s / 129 MiB 0.0002 s / 1.0 MiB ~150×
Thread speed-up (4 threads, heavy objective) 1.27× 3.63× —
Multi objective MPI, 4 ranks 0.323 s 0.042 s 7.7×
using MPAOP load time ≈ 21 s ≈ 5 s 4×

Solution quality on ZDT1/ZDT2/ZDT3 is unchanged within one standard deviation over 15 independent runs.

How

  • Column-major population layout (dim × nagents) — one agent per contiguous column, so extracting it is a memcpy and every kernel is stride-1.
  • Allocation-free hot loops — random draws generated where used instead of three N × dim matrices per half-iteration; repeat, clamp. and copy replaced by in-place kernels.
  • Type-stable core via a parametric EvalCtx{F,B,C} (comm = nothing previously forced dynamic dispatch through the whole main loop).
  • ENS-SS non-dominated sorting instead of the textbook O(M·n²) sort with quadratic allocation.
  • Incremental Pareto archive instead of vcat-in-a-loop plus a full re-sort each iteration.
  • Real MPI collectives — 2 Bcast! + 2 Allgatherv! per iteration on raw Float64 buffers, replacing nagents/nprocs Scatter/Gather round trips and six serialising MPI.bcast calls.
  • Dependencies cut from 15 to 7.

Bug fixes

  • SOMPA(parallelism = :mpi) crashed on MPI.jl 0.20 (MPI.Gather(Ref(x), …) → ArgumentError: Type must be isbitstype).
  • SOMPA(saveHDF = true) with the default history_save_interval threw BoundsError at the end of every run.
  • The MPI population was silently padded to a multiple of the rank count, wasting objective evaluations.
  • MOMPA(variant = :nmpa) double-counted the current position in phase 1.
  • SaveMPAHistory deleted the output file and slept 50 ms before every checkpoint.
  • The single-objective result was silently rounded to 4 digits, printing a genuine residual of 1.76e-9 as 0.0.

New features

Hybrid :mpi_threads · batch/GPU objectives (fobj_batch) · seeding that is bit-identical across serial, threads and any rank count · early stopping (ftol, patience, max_time) · callbacks · Latin-hypercube and opposition-based initialisation · strictly non-dominated archive · crowding-distance leader selection · quality indicators (hypervolume, igd, gd, spacing_metric, max_spread, pareto_filter) · HDF5 compression · a 250-test suite plus an MPI correctness test.

Behaviour changes

Item v0.2 v0.3 Restore
SOMPA return precision rounded (4 / 8 digits) full precision round_digits = 4
MOMPA archive may contain dominated solutions strictly non-dominated archive_mode = :fronts
MOMPA leader selection uniform random crowding tournament elite_selection = :random

The v0.1 positional API (MPA, MPA_MPI, confidence_interval) still works and forwards to the new engine.