GC_Jakus2020 module

class GC_Jakus2020.Jakus2020(grid=None, TieLines=None, PopulationSize=10, MutationProbability=0.02, ElitePopulation=4, Niter=10, fitness_ratio=1, loss_factor=2, verbose_logging=30)[source]

Bases: object

Implements the Jakus 2020 algorithm for distribution network reconfiguration (DNR).

This class utilizes a genetic algorithms to optimize the distribution network reconfiguration by minimizing fitness (power losses/voltage drop) and ensuring radial connectivity.

net

The distribution network instance.

Type:

DistributionNetwork

PopulationSize

Size of the population for the genetic algorithm.

Type:

int

TieLines

List of Tie lines Lists. [previously was a single Tie Lines list for supplying Baran algorithm]

Type:

list

MutationProbability

Probability of mutation during the genetic process.

Type:

float

#discarted

PopulationSize_SBEA (int): Population size for the SBEA. #this parameter is not in use, ç the SBEA candidates will be generated externally and added in the TieLines parameter

ElitePopulation

Number of elite individuals to retain.

Type:

int

Niter

Number of iterations for the genetic algorithm.

Type:

int

NumParentPairs

Number of parent pairs for crossover.

Type:

int

OffspringSize

Size of the offspring population.

Type:

int

Candidates

List of candidate solutions.

Type:

list

verbose

Logging level for verbose output.

Type:

int

BaranCandidateGenerator()[source]
CalculateFitness(configuration)[source]

Calculates the fitness of a candidate configuration.

Parameters:

candidate – List of selected configurations to evaluate.

Returns:

A tuple containing the fitness value and a boolean indicating if the configuration is valid.

InitialPopulationGeneration()[source]

Generates the initial population combining SBEA and Kruskal’s algorithm.

This method combines candidates generated from SBEA and Kruskal’s algorithms and sorts them based on their fitness values.

MutationProcess(candidate)[source]

Processes mutation on a given candidate configuration.

If a mutation occurs, a random disabled line is activated and a new minimum spanning tree is generated based on the modified configuration.

Parameters:

candidate (list) – A candidate configuration of the network.

Returns:

The modified candidate configuration after mutation.

Return type:

list

OffspringCrossOver(Parents)[source]

Performs crossover between parent candidates to generate offspring.

Parameters:

Parents (list) – A list containing two parent candidate configurations.

Returns:

The candidate configuration of the offspring generated.

Return type:

list

ParentsSelection()[source]

Generates offspring candidates from the current population.

The method calculates the fitness for each candidate in the current population and selects parent pairs based on their fitness values.

Returns:

A list of parent pairs for generating offspring.

Return type:

list

RandomCandidateGenerator(n=1)[source]
Solve()[source]

Solves the distribution network reconfiguration problem.

This method runs the genetic algorithm for a specified number of iterations, generating offspring and selecting the best candidates from the population.

Returns:

The best candidate configuration found after the iterations.

Return type:

list

SortCandidates(Candidates, Loops)[source]
__init__(grid=None, TieLines=None, PopulationSize=10, MutationProbability=0.02, ElitePopulation=4, Niter=10, fitness_ratio=1, loss_factor=2, verbose_logging=30)[source]

Initializes the Jakus2020 class.

Parameters:
  • net (DistributionNetwork) – The distribution network instance.

  • TieLines (list) – List of tie lines in the network.

  • PopulationSize (int) – Size of the population for the genetic algorithm.

  • MutationProbability (float) – Probability of mutation during the genetic process.

  • PopulationSize_SBEA (int) – Population size for the SBEA.

  • ElitePopulation (int) – Number of elite individuals to retain.

  • Niter (int) – Number of iterations for the genetic algorithm.

  • verbose_logging (int) – Logging level for verbose output.