py4design.pyoptimise package¶
Submodules¶
Module contents¶
Pyoptimise¶
Documentation is available in the docstrings and online at http://chenkianwee.github.io/py4design/
Submodules¶
analyse_xml --- Functions for analysing the generated xml from the optimisation.
dependencies: scipy, numpy, scikit-learn, pymf
draw_graph --- Functions for drawing graphs.
dependencies: matplotlib
nsga2 --- Classes and functions for performing NSGA2 optimisation.
-
py4design.pyoptimise.
empty_xml_files
(xml_filelist)¶ This function empties all the xml files.
Parameters: xml_filelist : list of str
The list of xml files to be emptied.
-
py4design.pyoptimise.
create_nsga2_population_class
(gene_dict_list, score_dict_list, mutation_rate, crossover_rate, init_population, live_file, dead_file)¶ This function creates a population class.
Parameters: gene_dict_list : list of dictionaries
Each dictionary contains the parameters for creating a Gene class instance. Each dictionay is in this format: {“type”: “int_range”, “range”: (0,4,1)}.
score_dict_list : list of dictionaries
Each dictionary contains the parameters for creating a ScoreMeta class instance. Each dictionay is in this format: {“name”: “solar”, “minmax”: “min”}.
mutation_rate : float
The mutation probability, the probability is between 0 to 1. The usual mutation probability is about 0.01.
crossover_rate : float
The crossover rate, the rate is between 0 to 1. The usual crossover rate is about 0.8.
init_population : int
The population size. The usual size is about 100.
live_file : str
The file path of the XML file that documents all the living individuals.
dead_file : str
The file path of the XML file that documents all the dead individuals.
Returns: population : Population class instance
The created population class instance.
-
py4design.pyoptimise.
initialise_nsga2
(gene_dict_list, score_dict_list, mutation_rate, crossover_rate, init_population, live_file, dead_file)¶ This function initialises the population and writes the xml files for an NSGA2 optimisation process.
Parameters: gene_dict_list : list of dictionaries
Each dictionary contains the parameters for creating a Gene class instance. Each dictionay is in this format: {“type”: “int_range”, “range”: (0,4,1)}.
score_dict_list : list of dictionaries
Each dictionary contains the parameters for creating a ScoreMeta class instance. Each dictionay is in this format: {“name”: “solar”, “minmax”: “min”}.
mutation_rate : float
The mutation probability, the probability is between 0 to 1. The usual mutation probability is about 0.01.
crossover_rate : float
The crossover rate, the rate is between 0 to 1. The usual crossover rate is about 0.8.
init_population : int
The population size. The usual size is about 100.
live_file : str
The file path of the XML file that documents all the living individuals.
dead_file : str
The file path of the XML file that documents all the dead individuals.
Returns: population : Population class instance
The created population class instance.
-
py4design.pyoptimise.
resume_nsga2
(gene_dict_list, score_dict_list, mutation_rate, crossover_rate, init_population, live_file, dead_file)¶ This function resumes a broken NSGA2 optimisation process based on the dead xml file.
Parameters: gene_dict_list : list of dictionaries
Each dictionary contains the parameters for creating a Gene class instance. Each dictionay is in this format: {“type”: “int_range”, “range”: (0,4,1)}.
score_dict_list : list of dictionaries
Each dictionary contains the parameters for creating a ScoreMeta class instance. Each dictionay is in this format: {“name”: “solar”, “minmax”: “min”}.
mutation_rate : float
The mutation probability, the probability is between 0 to 1. The usual mutation probability is about 0.01.
crossover_rate : float
The crossover rate, the rate is between 0 to 1. The usual crossover rate is about 0.8.
init_population : int
The population size. The usual size is about 100.
live_file : str
The file path of the XML file that documents all the living individuals.
dead_file : str
The file path of the XML file that documents all the dead individuals.
Returns: population : Population class instance
The resumed population class instance.
-
py4design.pyoptimise.
feedback_nsga2
(population)¶ This function performs the feedback process of a population.
Parameters: population : Population class instance
The function will perform the reproduction on this population and generate a new generation of individuals.