Skip to content

Genetic Algorithm for Charging Stations

🧬 Genetic Algorithm Support

The directory simulation/genetic/ contains an MPI-enabled genetic algorithm that searches for optimal charging-station placements. Configure the run via config.py, which points to the JSON scenario consumed by simulation.py.

Example launch on 16 cores:

mpirun -n 16 python3 main.py

The optimisation targets reduced congestion and emissions for the Sevilla Este testbed. Conceptually, the workflow is:

Genetic Algorithm
    Initialize population P
    Evaluate fitness of individuals in P

    For generation = 1 to MaxGenerations do
        P ← EvolvePopulation(P)
        Evaluate fitness of individuals in P
    End For

    Return best solution found in P
End

Each individual encodes the IDs of candidate edges selected for charging stations. For a solution with five facilities, the chromosome looks like:

[6, 43, 78, 25, 11]

Keep iterating on the genome definition and evaluation metrics as the SANEVEC optimisation studies evolve.