gadgit package

Submodules

gadgit.GAInfo module

class gadgit.GAInfo.GAInfo(generation=100, population=25, cross_chance=0.75, mut_chance=0.25, tourn_k=3, cross_meth='sdb', seed=datetime.datetime(2021, 8, 19, 17, 44, 15, 630495))[source]

Bases: object

This class stores information regarding evolutionary parameters.

gadgit.GeneInfo module

class gadgit.GeneInfo.GeneInfo(frame_path, obj_list, com_size=100, fixed_list=[])[source]

Bases: object

This class stores information regarding a specific problem’s biological parameters.

gadgit.gadgit module

gadgit.gadgit.cx_OPS(gene_info, ind1, ind2)[source]

Standard one-point crossover implemented for set individuals.

Self correction is handled by abstracted function.

Note that this function has no ability to make assertions on the individuals it generates.

gadgit.gadgit.cx_SDB(gene_info, ind1, ind2)[source]

SDB Crossover

Computes the intersection and asserts that after the intersection, the amount of genes left over to ‘deal’ between two new individuals is even.

Clears the set structures of their old information, updates with the intersection, and lastly hands out half of the shuffled dealer to each indiv.

ind1 and ind2 and kept as objects since they inherit from set, but have additional properties.

Note that this process is not destructive to the fixed genes inside of the individuals.

gadgit.gadgit.eaSoR(ga_info, gene_info, population, toolbox, cxpb, mutpb, ngen, stats=None, halloffame=None, verbose=True)[source]

This function runs an EA using the SoR fitness methodology.

It is essentially a fork of the eaSimple function from deap. It is not meant to be exposed to users and insstead is only used internally by the package.

gadgit.gadgit.ga_multi(gene_info, ga_info)[source]

Main loop which sets DEAP objects and calls a multi objective EA algorithm.

Parameters:
  • GeneInfo class (gene_info,) – See respective class documentation.
  • GAInfo class (ga_info,) – See respective class documentation.
Returns:

  • pop, DEAP object
  • stats, DEAP object
  • hof, DEAP object
  • See post_run function for examples of how to interpret results.

gadgit.gadgit.ga_single(gene_info, ga_info)[source]

Main loop which sets DEAP objects and calls a single objective EA algorithm.

Parameters:
  • GeneInfo class (gene_info,) – See respective class documentation.
  • GAInfo class (ga_info,) – See respective class documentation.
Returns:

  • pop, DEAP object
  • stats, DEAP object
  • hof, DEAP object
  • See post_run function for examples of how to interpret results.

gadgit.gadgit.indiv_builder(gene_info)[source]

Implementation of forcing fixed genes in creation of new individual.

gadgit.gadgit.multi_eval(gene_info, population)[source]

Helper function to implement the SoR table operations.

gadgit.gadgit.mut_flipper(gene_info, individual)[source]

Flip based mutation. Flip one off to on, and one on to off.

Must not allow the choice of a fixed gene to be turned off.

gadgit.gadgit.self_correction(gene_info, individual)[source]

This function takes a potentially broken individual and returns a correct one.

Procedure:
Add all fixed genes while size isn’t right; add or remove
gadgit.gadgit.single_eval(gene_info, individual)[source]

Single objective summation of the centrality of a particular frame’s chosen column.

Due to gene_info.obj_list obviously accepting a list for the purposes of extending to MOP, in the case of this single_eval, the head of the list is treated as the ‘single’ objective.

Note: does not correctly calculate the frontier.

gadgit.gadgit.valid_add(gene_info, individual)[source]

Based on gene info and current individual, return a valid index to add to an individual.

gadgit.gadgit.valid_remove(gene_info, individual)[source]

Based on gene info, removed an index from an individual that respects fixed genes

gadgit.post_run module

gadgit.post_run.post_run(gene_info, ga_info, pop, stats, hof)[source]

Takes in the results of some GA and displays information based on the problem definition.

Must contain GeneName in dataframe.

Parameters:
  • gene_info (GeneInfo class) –
  • ga_info (GAInfo class) –
  • pop (DEAP poplation from a succesful run) –
  • stats (DEAP stats object) –
  • hof (DEAP hall of fame object) –

Module contents

Top-level package for GADGIT.