def learn_DNF__recombination(): dnf = DNF() length = 58 epsilon = (2**-53) tau = (epsilon / length)**3 * log(1 / epsilon) tolerance = ConjunctionTolerance(length, epsilon) conjunction_performance_oracle = OneSidedPerformanceOracleWithTolerance( dnf, tau) performance_oracle = DNFOneSidePerformanceOracleWithTolerance( dnf, tau, epsilon, conjunction_performance_oracle) mutation_neighborhood = MonotoneConjunctionNeighborhood() recomb_rate = 0.176 natural_process = RecombinationProcess(recomb_rate) neighborhood = NeighborhoodWithOtherRepresentations( length, mutation_neighborhood, 0.1, natural_process) recombinator = Recombinator(neighborhood, performance_oracle, tolerance, epsilon) algorithm = ConstantPopulationMutationConjunctionAlgorithm( recombinator, length, epsilon, performance_oracle, 75) print algorithm.learn_ideal_function_until_match()
def learn_single_time__HGT(common_classes): neighborhood, performance_oracle, natural_process = get_params_for_mutator(common_classes) length, epsilon, mutation_neighborhood, tolerance = common_classes.get_common_classes() population_size, population_factor = common_classes.get_population_size_and_factor() HGT_mutator = HGT_Mutator(neighborhood, performance_oracle, tolerance, epsilon, natural_process) algorithm = ConstantPopulationMutationConjunctionAlgorithm(HGT_mutator, length, epsilon, performance_oracle, population_size, population_factor) return algorithm.learn_ideal_function_until_match()
def learn_single_time__HGT(common_classes): neighborhood, performance_oracle, natural_process = get_params_for_mutator( common_classes) length, epsilon, mutation_neighborhood, tolerance = common_classes.get_common_classes( ) population_size, population_factor = common_classes.get_population_size_and_factor( ) HGT_mutator = HGT_Mutator(neighborhood, performance_oracle, tolerance, epsilon, natural_process) algorithm = ConstantPopulationMutationConjunctionAlgorithm( HGT_mutator, length, epsilon, performance_oracle, population_size, population_factor) return algorithm.learn_ideal_function_until_match()
def learn_DNF__HGT(): dnf = DNF() length = 58 epsilon = (2**-53) tau = (epsilon / length)**3 * log(1/epsilon) tolerance = ConjunctionTolerance(length, epsilon) conjunction_performance_oracle = OneSidedPerformanceOracleWithTolerance(dnf, tau) performance_oracle = DNFOneSidePerformanceOracleWithTolerance(dnf, tau, epsilon, conjunction_performance_oracle) mutation_neighborhood = MonotoneConjunctionNeighborhood() natural_process = HGTProcess(0.176, length) neighborhood = NeighborhoodWithOtherRepresentations(length, mutation_neighborhood, 0.1, natural_process) HGT_mutator = HGT_Mutator(neighborhood, performance_oracle, tolerance, epsilon, natural_process) algorithm = ConstantPopulationMutationConjunctionAlgorithm(HGT_mutator, length, epsilon, performance_oracle, 75) print algorithm.learn_ideal_function_until_match()