propulate.utils
Submodules
Package Contents
Functions
|
Get Propulate's default evolutionary optimization propagator. |
|
Set up the logger. Should only need to be done once. Generally, logging should only be done on the master rank. |
- propulate.utils.get_default_propagator(pop_size: int, limits: Mapping[str, Tuple[float, float] | Tuple[int, int] | Tuple[str, Ellipsis]], crossover_prob: float = 0.7, mutation_prob: float = 0.4, random_init_prob: float = 0.1, sigma_factor: float = 0.05, rng: random.Random | None = None) propulate.propagators.Propagator
Get Propulate’s default evolutionary optimization propagator.
- Parameters:
pop_size (int) – The number of individuals in the breeding population.
limits (Dict[str, Tuple[float, float]] | Dict[str, Tuple[int, int]] | Dict[str, Tuple[str, ...]]) – The (hyper-)parameters to be optimized, i.e., the search space.
crossover_prob (float, optional) – The uniform-crossover probability. Default is 0.7.
mutation_prob (float, optional) – The point-mutation probability. Default is 0.4.
random_init_prob (float, optional) – The random-initialization probability. Default is 0.1.
sigma_factor (float) – The scaling factor for obtaining the standard deviation from the search-space boundaries for interval mutation. Default is 0.05.
rng (random.Random, optional) – The separate random number generator for the Propulate optimization.
- Returns:
A basic evolutionary optimization propagator.
- Return type:
- propulate.utils.set_logger_config(level: int = logging.INFO, log_file: str | pathlib.Path | None = None, log_to_stdout: bool = True, log_rank: bool = False, colors: bool = True) None
Set up the logger. Should only need to be done once. Generally, logging should only be done on the master rank.
- Parameters:
level (int) – The default level for logging. Default is
logging.INFO.log_file (str | Path, optional) – The file to save the log to.
log_to_stdout (bool) – A flag indicating if the log should be printed on stdout. Default is True.
log_rank (bool) – A flag for prepending the MPI rank to the logging message. Default is False.
colors (bool) – A flag for using colored logs. Default is True.