opensbt.utils package

Submodules

opensbt.utils.duplicates module

opensbt.utils.duplicates.duplicate_free(population, precision=8)[source]
opensbt.utils.duplicates.remove_duplicates(M, precision=8)[source]

opensbt.utils.encoder_utils module

class opensbt.utils.encoder_utils.NumpyEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: JSONEncoder

default(obj)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)

opensbt.utils.evaluation module

opensbt.utils.evaluation.evaluate_individuals(population: Population, problem: Problem)[source]

opensbt.utils.fps module

class opensbt.utils.fps.FPS[source]

Bases: Sampling

_do(problem, n_samples, **kwargs)[source]
opensbt.utils.fps.fps(problem, n_samples=1, verbose=False)[source]
opensbt.utils.fps.fps_by_bounds(n_var, xl, xu, n_samples=1, verbose=False)[source]

opensbt.utils.geometric module

opensbt.utils.geometric.dist(p1, p2)[source]
opensbt.utils.geometric.distPair(a, b)[source]
opensbt.utils.geometric.intersection(P, Q)[source]
opensbt.utils.geometric.line(p1, p2)[source]

opensbt.utils.log_utils module

opensbt.utils.log_utils.disable_pymoo_warnings()[source]
opensbt.utils.log_utils.setup_logging(log_to)[source]

opensbt.utils.path module

opensbt.utils.path.get_subfolders_from_folder(folder_name)[source]

opensbt.utils.result_utils module

opensbt.utils.result_utils.create_result(problem, hist_holder, inner_algorithm, execution_time)[source]

Generates a result object from generation data to adhere to pymoos result model. Consider the implementation of NSGA-II-DT optimizer for reference.

opensbt.utils.result_utils.create_result_from_generations(path_generations, problem)[source]

Generates a result object from recorded generation files which contain test inputs from the specific generations in human readable format.

opensbt.utils.sampling module

class opensbt.utils.sampling.CartesianSampling[source]

Bases: Sampling

_do(problem, n_samples_one_axis=10, **kwargs)[source]
opensbt.utils.sampling.cartesian_by_bounds(n_var, xl, xu, n_samples_one_axis)[source]

Generates aequidistant points in a grid shape.

Input:

n_var: number of axis x_l: lower bound for each axis x_u: upper_bound for each axis n_samples_one_axis: number of samples for one axis

Output: aequidistant points in a grid shape where space is defined by axis with lower/upper bounds xl/xu ((TODO Pass number of samples for each axis via algorithm definition))

opensbt.utils.sampling.cartesian_reference_set(problem, n_evals_by_axis=None)[source]

opensbt.utils.sorting module

opensbt.utils.sorting.calc_nondominated_individuals(population: Population)[source]
opensbt.utils.sorting.get_nondominated_population(population: Population)[source]

opensbt.utils.time_utils module

opensbt.utils.time_utils.convert_pymoo_time_to_seconds(pymoo_time: str) int[source]

Module contents