BioSystemsUM / MEWpy

Metabolic Engineering Workbench
https://mewpy.readthedocs.io
GNU General Public License v3.0
37 stars 12 forks source link

Simplify solutions #7

Closed cdanielmachado closed 3 years ago

cdanielmachado commented 3 years ago

Hi Vitor,

Is there an option to simplify the solution pool after optimization? In the final population I often see many solutions with same fitness value and different number of knockouts.

Best regards, Daniel

vmspereira commented 3 years ago

Hi Daniel.

There is. Problem classes have a simplify method to perform such a task. It takes as an argument a solution and an optional tolerance value for the difference of fitness values (1e-6 by default). To simplify an entire population, you might want to use the simplify_population method also available in the problem class. Also, you may want to filter the final population keeping only non dominated solutions and filter duplicated ones. Both methods are available in the mewpy.optimization.ea module as non_dominated_population and filter_duplicates methods respectively. The non dominated method also allows the filtering of duplicated solutions as an option. Filtering dominated solutions might lead to a loss of potentially interesting solutions, so you might want to consider only simplifying and removing duplicated solutions.

Cheers

vmspereira commented 3 years ago

As an addon, filtering and simplification of a solution pool are automatically performed when saving the final population to csv file, population_to_csv method in mewpy.util.io module. Some examples are provided in the examples/scripts folder.

cdanielmachado commented 3 years ago

Perfect, thanks a lot!