Utils¶
Graphic¶
-
class
jmetal.util.graphic.
FrontPlot
(plot_title: str, axis_labels: list = None)¶ Bases:
jmetal.util.graphic.Plot
Creates a new
FrontPlot
instance. Suitable for problems with 2 or more objectives.Parameters: - plot_title – Title of the graph.
- axis_labels – List of axis labels.
-
export
(filename: str = '', include_plotlyjs: bool = False) → str¶ Export as a div for embedding the graph in an HTML file.
Parameters: - filename – Output file name (if desired, default to None).
- include_plotlyjs – If True, include plot.ly JS script (default to False).
Returns: Script as string.
-
plot
(front: typing.List[S], reference_front: typing.List[S] = None, normalize: bool = False) → None¶ Plot a front of solutions (2D, 3D or parallel coordinates).
Parameters: - front – List of solutions.
- reference_front – Reference solution list (if any).
- normalize – Normalize the input front between 0 and 1 (for problems with more than 3 objectives).
-
to_html
(filename: str = 'front') → str¶ Export the graph to an interactive HTML (solutions can be selected to show some metadata).
Parameters: filename – Output file name. Returns: Script as string.
-
update
(data: typing.List[S], normalize: bool = False, legend: str = '') → None¶ Update an already created graph with new data.
Parameters: - data – List of solutions to be included.
- legend – Legend to be included.
- normalize – Normalize the input front between 0 and 1 (for problems with more than 3 objectives).
-
class
jmetal.util.graphic.
Plot
(plot_title: str, axis_labels: list)¶ Bases:
object
-
static
get_objectives
(front: typing.List[S]) → <Mock name='mock.DataFrame' id='140475564615440'>¶ Get objectives for each solution of the front.
Parameters: front – List of solutions. Returns: Pandas dataframe with one column for each objective and one row for each solution.
-
static
-
class
jmetal.util.graphic.
ScatterStreaming
(plot_title: str, axis_labels: list = None)¶ Bases:
jmetal.util.graphic.Plot
Creates a new
ScatterStreaming
instance. Suitable for problems with 2 or 3 objectives in streaming.Parameters: - plot_title – Title of the diagram.
- axis_labels – List of axis labels.
-
plot
(front: typing.List[S], reference_front: typing.List[S], filename: str = '', show: bool = True) → None¶ Plot a front of solutions (2D or 3D).
Parameters: - front – List of solutions.
- reference_front – Reference solution list (if any).
- filename – If specified, save the plot into a file.
- show – If True, show the final diagram (default to True).
-
update
(front: typing.List[S], reference_front: typing.List[S], rename_title: str = '', persistence: bool = True) → None¶ Update an already created plot.
Parameters: - front – List of solutions.
- reference_front – Reference solution list (if any).
- rename_title – New title of the plot.
- persistence – If True, keep old points; else, replace them with new values.
Lab of experiments¶
-
class
jmetal.util.laboratory.
Experiment
(algorithm_list: list, n_runs: int = 1, m_workers: int = 6)¶ Bases:
object
Parameters: - algorithm_list – List of algorithms as Tuple(Algorithm, dic() with parameters).
- m_workers – Maximum number of workers for ProcessPoolExecutor.
-
compute_metrics
(metric_list: list) → dict¶ Parameters: metric_list – List of metrics. Each metric should inherit from Metric
or, at least,contain a method compute.
-
export_to_file
(base_directory: str = 'experiment', function_values_filename: str = 'FUN', variables_filename: str = 'VAR')¶
-
run
() → None¶ Run the experiment.
-
jmetal.util.laboratory.
jMetalPyLogger
= <Logger jMetalPy (DEBUG)>¶
Solution list output¶
-
jmetal.util.solution_list_output.
S
= ~S¶
-
class
jmetal.util.solution_list_output.
SolutionList
¶ Bases:
typing.Generic
-
static
print_function_values_to_file
(solution_list: list, file_name)¶
-
static
print_function_values_to_screen
(solution_list: list)¶
-
static
print_variables_to_file
(solution_list: list, file_name)¶
-
static
print_variables_to_screen
(solution_list: list)¶
-
static