Skip to main content

Event-Driven Metaheuristic Optimization: dynamic resource allocation & scheduling

A Python project for changing constrained optimization problems, combining GA and Differential Evolution with event-driven coordination, warm-start state, and reproducible recovery benchmarks.

Context

Resource allocation and scheduling problems can change while the optimizer is running: jobs can be added or removed, deadlines and priorities can change, and resource capacity can be rescaled. The engineering question is therefore not only how to find a good solution, but how to measure recovery after a change.

Problem

The project models a time-varying constrained optimization problem and asks whether adapting an existing optimizer state differs from restarting from scratch after a problem change. Benchmarks compare the two strategies across seeds; the project explicitly avoids claiming that warm-start is always better.

Dynamic optimization formulation
minxft(x)s.t.gi,t(x)≤0\min_x f_t(x)\quad\text{s.t.}\quad g_{i,t}(x)\le 0

Constraints & requirements

  • Objective and constraints may change during execution
  • Genetic Algorithm and Differential Evolution as the current algorithmic scope
  • A shared evaluation and repair path for constraint handling
  • Stateful warm-start across problem versions
  • Reproducible benchmarks with fixed seeds and recovery metrics
  • Separation between events, optimization logic, and transport

Approach

The algorithmic core keeps GA and DE alongside a deterministic Random Search baseline. GAState makes optimizer state explicit: unchanged jobs keep their genes, new jobs are initialized, and resource changes trigger resampling where needed.

text
Problem Change Event
        -> Apply Change
        -> Adapt GA State
        -> Continue Optimization
        -> Record Evaluation / Metrics
        -> Publish Completion Event

Key decisions & trade-offs

DecisionReason
Keep two metaheuristics in scopeMakes GA and DE comparison explicit without unnecessary algorithm sprawl.
Treat warm-start as a testable hypothesisPrevious state is adapted explicitly; any advantage must come from benchmark evidence.
Seeded deterministic benchmarksRecovery and comparison experiments can be reproduced.
Event-driven orchestrationProblem changes and optimization remain independent from a specific transport.
Kafka at the infrastructure boundaryKafka is not used to turn every internal optimizer step into a message.

Outcome

The result is an executable framework for dynamic optimization combining GA, DE, Random Search, explicit state adaptation, an event bus, a Kafka adapter, and recovery benchmarks. Runs capture metrics such as success rate, iterations-to-target, mean/median recovery, and feasible fraction so comparisons remain evidence-based.

Technical depth

  • Mixed-integer chromosomes for GA and DE/rand/1/bin over real-valued vectors
  • Shared evaluation, repair, and termination paths
  • Versioned events with event_id, event_type, timestamp, and aggregate_id
  • Kafka at-least-once delivery with consumer-level deduplication
  • RunRecord and GenerationMetric telemetry for reproducibility

Evidence

The design, benchmarks, and implementation are publicly inspectable on GitHub.

GitHub — Event-Driven Metaheuristic Optimization

The repository README documents the problem, architecture, recovery benchmarks, and explicit scope boundaries.

Open source

Does your optimization problem change over time?

The problem structure, recovery strategy, and comparison metrics can be defined before choosing a precise algorithmic path.