def __init__(self, is_neigh_precomp=True, is_using_output_one_neigh=True): self.length = 100 self.epsilon = Fraction(2**-55) self.number_of_activations = 20 self.number_of_mutations_from_mutator = 50 self.population_size = 75 self.tolerance = ConjunctionTolerance(self.length, self.epsilon) self.tau = 0 # (self.epsilon / Decimal(self.length))**Decimal(3) * log(1/self.epsilon) self.representation_class = None if is_neigh_precomp: self.representation_class = get_set_of_all_representations_with_length( self.length) self.mutation_neighborhood = PrecompMonotoneConjunctionNeighborhood( self.representation_class) elif is_using_output_one_neigh: self.mutation_neighborhood = ConjunctionNeighborhoodOutputOne() else: self.mutation_neighborhood = MonotoneConjunctionNeighborhood() self.mutation_probability = ConjunctionMutationProbability( self.mutation_neighborhood) self.recombination_factor = 1
def get_perf(self, concept_class): if self.representation_class is None: self.representation_class = get_set_of_all_representations_with_length( self.length) return PerformanceOracleWithPrecomp(concept_class, self.tau, self.representation_class)
def __init__(self, is_neigh_precomp=True, is_using_output_one_neigh=True): self.length = 100 self.epsilon = Fraction(2**-55) self.number_of_activations = 20 self.number_of_mutations_from_mutator = 50 self.population_size = 75 self.tolerance = ConjunctionTolerance(self.length, self.epsilon) self.tau = 0 # (self.epsilon / Decimal(self.length))**Decimal(3) * log(1/self.epsilon) self.representation_class = None if is_neigh_precomp: self.representation_class = get_set_of_all_representations_with_length(self.length) self.mutation_neighborhood = PrecompMonotoneConjunctionNeighborhood(self.representation_class) elif is_using_output_one_neigh: self.mutation_neighborhood = ConjunctionNeighborhoodOutputOne() else: self.mutation_neighborhood = MonotoneConjunctionNeighborhood() self.mutation_probability = ConjunctionMutationProbability(self.mutation_neighborhood) self.recombination_factor = 1
def get_perf(self, concept_class): if self.representation_class is None: self.representation_class = get_set_of_all_representations_with_length(self.length) return PerformanceOracleWithPrecomp(concept_class, self.tau, self.representation_class)