desdeo_emo.utilities
This module provides miscellaneous tools
Submodules
Package Contents
Classes
Functions

Plot the first (or zeroth) iteration of a population. 

Plot the next set of individuals in an animation. 
 desdeo_emo.utilities.IsNotebook() bool
Checks if the current environment is a Jupyter Notebook or a console.
 Returns:
True if notebook. False if console
 Return type:
bool
 desdeo_emo.utilities.animate_init_(data: numpy.ndarray  pandas.DataFrame  list, filename: str) dict [source]
Plot the first (or zeroth) iteration of a population.
Intended as a frames object. Plots Scatter for 2D and 3D data. Plots parallel coordinate plot for higher dimensional data.
 Parameters:
data (Union[np.ndarray, pd.DataFrame, list]) – Contains the data to be plotted. Each row is an individual’s objective values.
filename (str) – Contains the name of the file to which the plot is saved.
 Returns:
Plotly figure object
 Return type:
dict
 desdeo_emo.utilities.animate_next_(data: numpy.ndarray  pandas.DataFrame  list, figure: dict, filename: str, generation: int = None) dict [source]
Plot the next set of individuals in an animation.
Plots scatter for 2D and 3D data, parallel coordinate plot for 4D and up.
 Parameters:
data (Union[np.ndarray, pd.DataFrame, list]) – The objective values to be plotted
figure (dict) – Plotly figure object compatible dict
filename (str) – Name of the file to which the plot is saved
generation (int) – Iteration Number
 Returns:
Plotly Figure Object
 Return type:
dict
 class desdeo_emo.utilities.ReferenceVectors(lattice_resolution: int = None, number_of_vectors: int = None, number_of_objectives: int = None, creation_type: str = 'Uniform', vector_type: str = 'Spherical', ref_point: list = None)
Class object for reference vectors.
 _create(creation_type: str = 'Uniform')
Create the reference vectors.
 Parameters:
creation_type (str, optional) – ‘Uniform’ creates the reference vectors uniformly using simplex lattice design. ‘Focused’ creates reference vectors symmetrically around a central reference vector. By default ‘Uniform’.
 normalize()
Normalize the reference vectors to a unit hypersphere.
 neighbouring_angles() numpy.ndarray
Calculate neighbouring angles for normalization.
 adapt(fitness: numpy.ndarray)
Adapt reference vectors. Then normalize.
 Parameters:
fitness (np.ndarray) –
 interactive_adapt_1(z: numpy.ndarray, n_solutions: int, translation_param: float = 0.2) None
Adapt reference vectors using the information about prefererred solution(s) selected by the Decision maker.
 Parameters:
z (np.ndarray) – Preferred solution(s).
n_solutions (int) – Number of solutions in total.
translation_param (float) – Parameter determining how close the reference vectors are to the central vector
solution (**v** defined by using the selected) –
Returns:
 interactive_adapt_2(z: numpy.ndarray, n_solutions: int, predefined_distance: float = 0.2) None
Adapt reference vectors by using the information about nonpreferred solution(s) selected by the Decision maker. After the Decision maker has specified nonpreferred solution(s), Euclidian distance between normalized solution vector(s) and each of the reference vectors are calculated. Those reference vectors that are closer than a predefined distance are either removed or repositioned somewhere else.
Note
At the moment, only the removal of reference vectors is supported. Repositioning of the reference vectors is not supported.
Note
In case the Decision maker specifies multiple nonpreferred solutions, the reference vector(s) for which the distance to any of the nonpreferred solutions is less than predefined distance are removed.
Note
Future developer should implement a way for a user to say: “Remove some percentage of objecive space/reference vectors” rather than giving a predefined distance value.
 Parameters:
z (np.ndarray) – Nonpreferred solution(s).
n_solutions (int) – Number of solutions in total.
predefined_distance (float) – The reference vectors that are closer than this distance are either removed or
else. (repositioned somewhere) –
value (Default) – 0.2
Returns:
 iteractive_adapt_3(ref_point, translation_param=0.2)
Adapt reference vectors linearly towards a reference point. Then normalize.
The details can be found in the following paper: Hakanen, Jussi & Chugh, Tinkle & Sindhya, Karthik & Jin, Yaochu & Miettinen, Kaisa. (2016). Connections of Reference Vectors and Different Types of Preference Information in Interactive Multiobjective Evolutionary Algorithms.
 Parameters:
ref_point –
translation_param – (Default value = 0.2)
 interactive_adapt_4(preferred_ranges: numpy.ndarray) None
Adapt reference vectors by using the information about the Decision maker’s preferred range for each of the objective. Using these ranges, Latin hypercube sampling is applied to generate m number of samples between within these ranges, where m is the number of reference vectors. Normalized vectors constructed of these samples are then set as new reference vectors.
 Parameters:
preferred_ranges (np.ndarray) – Preferred lower and upper bound for each of the objective function values.
Returns:
 slow_interactive_adapt(ref_point)
Basically a wrapper around rotate_toward. Slowly rotate ref vectors toward ref_point. Return a boolean value to tell if the ref_point has been reached.
 Parameters:
ref_point (list or np.ndarray) – The reference vectors will slowly move towards the ref_point.
 Returns:
True if ref_point has been reached. False otherwise.
 Return type:
boolean
 add_edge_vectors()
Add edge vectors to the list of reference vectors.
Used to cover the entire orthant when preference information is provided.