rapidhouse.algorithm package

Submodules

rapidhouse.algorithm.alg module

class rapidhouse.algorithm.alg.Algorithm(ranges)[source]

Bases: object

This class is abstracting that algorithm for searching the solution of a combination.

get_group()[source]

Getter for the group of solution.

Returns:the group of solution.
init_group(idb, basic)[source]

Initialize a group of solution.

Parameters:
  • idb – Instance of informationdb.InformationDb.
  • basic (tuple) – the basic[0] is list of the basic groups. the basic[1] is the group length.
mutate_gauss(lst, sigma)[source]

Mutate with a normal random number.

Parameters:
  • lst (list) – a list.
  • sigma (int) – Standard deviation.
Return type:

list

Returns:

the mutated list.

random_indexes(lst)[source]

Return list of random indexes.

Parameters:lst (list) – a list.
Return type:list
Returns:list of random indexes.

rapidhouse.algorithm.ga module

class rapidhouse.algorithm.ga.GaSuneko(ranges, mutprob=0.3, elite=0.2, ranran=0.3)[source]

Bases: rapidhouse.algorithm.alg.Algorithm

This class is using GA as that algorithm for searching the solution of a combination.

Parameters:
  • ranges (list) – Pass to the parent class.
  • mutprob (float) – the mutation probability.
  • elite (float) – the percentage of surviving a elite.
  • step (float) – the amount of change for the mutation.
crossover(pop1, pop2)[source]

Crossover the populations.

Parameters:
  • pop1 (list) – a population.
  • pop2 (list) – a population.
Return type:

list

Returns:

the crossedover population.

mutate(pop)[source]

Mutate the population.

Parameters:pop (list) – the population.
Return type:list
Returns:the mutated population.
next(scores)[source]

Generate the population of the next generation.

Parameters:scores (tuple) – set of the population and the cost of the population.
undx(parent1, parent2, parent3)[source]

Reproduce with UNDX algorithm. http://mikilab.doshisha.ac.jp/dia/research/person/takapy/2001/semi/Weekly_Report/06_20010716/report/report.html

Parameters:
  • parent1 (list) – a population.
  • parent2 (list) – a population.
  • parent3 (list) – a population.
Return type:

list

Returns:

the reproduced population.

Module contents