def get_performance_rate_of_single_run(common_classes, population_factor=1, mutation_factor=0.1):
    length, epsilon, mutation_neighborhood, tolerance = common_classes.get_common_classes()
    natural_process = common_classes.get_natural_process()

    concept_class = MonotoneConjunction(length)

    performance_oracle = common_classes.get_perf(concept_class)
    neighborhood = common_classes.get_neighborhood_with_other_representations(mutation_factor)
    HGT_mutator = HGT_Mutator(neighborhood, performance_oracle, tolerance, epsilon, natural_process)
    algorithm = HGTConjunctionAlgorithm(HGT_mutator, length, epsilon, performance_oracle, population_factor)

    return algorithm.get_learning_rate()
def get_performance_rate_of_single_run(common_classes,
                                       population_factor=1,
                                       mutation_factor=0.1):
    length, epsilon, mutation_neighborhood, tolerance = common_classes.get_common_classes(
    )
    natural_process = common_classes.get_natural_process()

    concept_class = MonotoneConjunction(length)

    performance_oracle = common_classes.get_perf(concept_class)
    neighborhood = common_classes.get_neighborhood_with_other_representations(
        mutation_factor)
    HGT_mutator = HGT_Mutator(neighborhood, performance_oracle, tolerance,
                              epsilon, natural_process)
    algorithm = HGTConjunctionAlgorithm(HGT_mutator, length, epsilon,
                                        performance_oracle, population_factor)

    return algorithm.get_learning_rate()
def HGT_main():
    common_classes = CommonClassesCreator()

    length, epsilon, mutation_neighborhood, tolerance = common_classes.get_common_classes()
    mutation_factor = 0.1
    HGT_factor = 1

    concept_class = MonotoneConjunction(length)
    performance = common_classes.get_perf_without_precomp(concept_class)

    HGT_process = HGTProcess(HGT_factor, length)
    neighborhood = NeighborhoodWithOtherRepresentations(length, mutation_neighborhood,
                                                        mutation_factor, HGT_process)
    HGT_mutator = HGT_Mutator(neighborhood, performance, tolerance, epsilon, HGT_process)
    mutation = HGTConjunctionAlgorithm(HGT_mutator, length, epsilon, performance)

    final_population = mutation.learn_ideal_function(concept_class)

    if len(final_population) <= 30:
        print final_population