platypus.filters module

feasible(solutions)

Filters out any infeasible solutions, returninig only feasible solutions.

Parameters

solutionsiterable of Solution

The solutions to filter.

group(solutions, key=<function objectives_key>)

Groups solutions by the given key.

Returns a mapping from each unique key to a list of solutions with that key value.

Parameters

solutionsiterable

The collection of solutions being grouped.

keycallable

Returns the key used for grouping, where solutions with identical values are grouped together.

infeasible(solutions)

Filters out any feasible solutions, returning only infeasible solutions.

Parameters

solutionsiterable of Solution

The solutions to filter.

matches(solutions, value, key=<function objectives_key>)

Returns only those solutions matching the given value.

Parameters

solutionsiterable

The collectioin of solutions being filtered.

valueobject

The value being matched.

keycallable

Returns the key used for filtering.

truncate(solutions, size, key=<function objectives_key>, reverse=False)

Truncates the population down to the given size.

Parameters

solutionsiterable

The collection of solutions being truncated.

sizeint

The number of solutions to return.

keycallable

Returns the key used for truncation.

reversebool

If True, reverse the ordering to truncate the smallest keys first.

unique(solutions, key=<function objectives_key>)

Returns the unique solutions.

Parameters

solutionsiterable of Solution

The list of solutions.

keycallable

Returns the key used to identify unique solutions.