Exemple #1
0
 def __init__(self,
              transitions_C=None,
              transitions_D=None,
              emission_probabilities=None,
              initial_state=0,
              initial_action=C,
              num_states=None,
              mutation_probability=None) -> None:
     transitions_C, transitions_D, emission_probabilities, initial_state, initial_action, num_states, mutation_probability = self._normalize_parameters(
         transitions_C, transitions_D, emission_probabilities,
         initial_state, initial_action, num_states, mutation_probability)
     self.mutation_probability = mutation_probability
     HMMPlayer.__init__(self,
                        transitions_C=transitions_C,
                        transitions_D=transitions_D,
                        emission_probabilities=emission_probabilities,
                        initial_state=initial_state,
                        initial_action=initial_action)
     EvolvablePlayer.__init__(self)
     self.overwrite_init_kwargs(
         transitions_C=transitions_C,
         transitions_D=transitions_D,
         emission_probabilities=emission_probabilities,
         initial_state=initial_state,
         initial_action=initial_action,
         num_states=num_states,
         mutation_probability=mutation_probability)
Exemple #2
0
 def __init__(
     self,
     lookup_dict: dict = None,
     initial_actions: tuple = None,
     pattern: Any = None,  # pattern is str or tuple of Action's.
     parameters: Plays = None,
     mutation_probability: float = None
 ) -> None:
     lookup_dict, initial_actions, pattern, parameters, mutation_probability = self._normalize_parameters(
         lookup_dict, initial_actions, pattern, parameters, mutation_probability
     )
     LookerUp.__init__(
         self,
         lookup_dict=lookup_dict,
         initial_actions=initial_actions,
         pattern=pattern,
         parameters=parameters,
     )
     EvolvablePlayer.__init__(self)
     self.mutation_probability = mutation_probability
     self.overwrite_init_kwargs(
         lookup_dict=lookup_dict,
         initial_actions=initial_actions,
         pattern=pattern,
         parameters=parameters,
         mutation_probability=mutation_probability,
     )
Exemple #3
0
 def __init__(self,
              cycle: str = None,
              cycle_length: int = None,
              mutation_probability: float = 0.2,
              mutation_potency: int = 1,
              seed: int = None) -> None:
     EvolvablePlayer.__init__(self, seed=seed)
     cycle, cycle_length = self._normalize_parameters(cycle, cycle_length)
     Cycler.__init__(self, cycle=cycle)
     # Overwrite init_kwargs in the case that we generated a new cycle from cycle_length
     self.overwrite_init_kwargs(cycle=cycle, cycle_length=cycle_length)
     self.mutation_probability = mutation_probability
     self.mutation_potency = mutation_potency
Exemple #4
0
 def __init__(
     self, num_features: int, num_hidden: int,
     weights: List[float] = None,
     mutation_probability: float = None,
     mutation_distance: int = 5,
 ) -> None:
     num_features, num_hidden, weights, mutation_probability = self._normalize_parameters(
         num_features, num_hidden, weights, mutation_probability)
     ANN.__init__(self,
                  num_features=num_features,
                  num_hidden=num_hidden,
                  weights=weights)
     EvolvablePlayer.__init__(self)
     self.mutation_probability = mutation_probability
     self.mutation_distance = mutation_distance
     self.overwrite_init_kwargs(
         num_features=num_features,
         num_hidden=num_hidden,
         weights=weights,
         mutation_probability=mutation_probability)
 def __init__(self,
              transitions: tuple = None,
              initial_state: int = None,
              initial_action: Action = None,
              num_states: int = None,
              mutation_probability: float = 0.1,
              seed: int = None) -> None:
     """If transitions, initial_state, and initial_action are None
     then generate random parameters using num_states."""
     EvolvablePlayer.__init__(self, seed=seed)
     transitions, initial_state, initial_action, num_states = self._normalize_parameters(
         transitions, initial_state, initial_action, num_states)
     FSMPlayer.__init__(self,
                        transitions=transitions,
                        initial_state=initial_state,
                        initial_action=initial_action)
     self.mutation_probability = mutation_probability
     self.overwrite_init_kwargs(transitions=transitions,
                                initial_state=initial_state,
                                initial_action=initial_action,
                                num_states=self.num_states)