pyRVEA.OtherTools

pyRVEA.OtherTools.IsNotebook module

pyRVEA.OtherTools.IsNotebook.IsNotebook() → bool

Checks if the current environment is a Jupyter Notebook or a console.

Returns

True if notebook. False if console

Return type

bool

pyRVEA.OtherTools.ReferenceVectors module

class pyRVEA.OtherTools.ReferenceVectors.ReferenceVectors(lattice_resolution: int, number_of_objectives: int, creation_type: str = 'Uniform', vector_type: str = 'Spherical', ref_point: list = None)

Bases: object

Class object for reference vectors.

adapt(fitness: numpy.ndarray)

Adapt reference vectors. Then normalize.

Parameters

fitness (np.ndarray) –

add_edge_vectors()

Add edge vectors to the list of reference vectors.

Used to cover the entire orthant when preference information is provided.

iteractive_adapt_1(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)

neighbouring_angles() → numpy.ndarray

Calculate neighbouring angles for normalization.

normalize()

Normalize the reference vectors to a unit hypersphere.

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

pyRVEA.OtherTools.ReferenceVectors.householder(vector)

Return reflection matrix via householder transformation.

pyRVEA.OtherTools.ReferenceVectors.normalize(vectors)

Normalize a set of vectors.

The length of the returned vectors will be unity.

Parameters

vectors (np.ndarray) – Set of vectors of any length, except zero.

pyRVEA.OtherTools.ReferenceVectors.rotate(initial_vector, rotated_vector, other_vectors)

Calculate the rotation matrix that rotates the initial_vector to the rotated_vector. Apply that rotation on other_vectors and return. Uses Householder reflections twice to achieve this.

pyRVEA.OtherTools.ReferenceVectors.rotate_toward(initial_vector, final_vector, other_vectors, degrees: float = 5)

Rotate other_vectors (with the centre at initial_vector) towards final_vector by an angle degrees.

Parameters
  • initial_vector (np.ndarray) – Centre of the vectors to be rotated.

  • final_vector (np.ndarray) – The final position of the center of other_vectors.

  • other_vectors (np.ndarray) – The array of vectors to be rotated

  • degrees (float, optional) – The amount of rotation (the default is 5)

Returns

  • rotated_vectors (np.ndarray) – The rotated vectors

  • reached (bool) – True if final_vector has been reached

pyRVEA.OtherTools.ReferenceVectors.shear(vectors, degrees: float = 5)

Shear a set of vectors lying on the plane z=0 towards the z-axis, such that the resulting vectors ‘degrees’ angle away from the z axis.

z is the last element of the vector, and has to be equal to zero.

Parameters
  • vectors (numpy.ndarray) – The final element of each vector should be zero.

  • degrees (float, optional) – The angle that the resultant vectors make with the z axis. Unit is radians. (the default is 5)

pyRVEA.OtherTools.newRV module

pyRVEA.OtherTools.plotlyanimate module

pyRVEA.OtherTools.plotlyanimate.animate_2d_init_(data: Union[numpy.ndarray, pandas.core.frame.DataFrame, list], filename: str) → dict

Initiate a 2D scatter animation.

Only for 2D data.

Parameters
  • data (Union[np.ndarray, pd.DataFrame, list]) – Objective values

  • filename (str) – Name of the file to which plot is saved

Returns

Plotly Figure Object

Return type

dict

pyRVEA.OtherTools.plotlyanimate.animate_2d_next_(data: Union[numpy.ndarray, pandas.core.frame.DataFrame, list], figure: dict, filename: str, generation: int) → dict

Plot the next set of individuals in a 2D scatter animation.

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

pyRVEA.OtherTools.plotlyanimate.animate_3d_init_(data: Union[numpy.ndarray, pandas.core.frame.DataFrame, list], filename: str) → dict

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

Intended as a frames object. Plots Scatter 3D 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

pyRVEA.OtherTools.plotlyanimate.animate_3d_next_(data: Union[numpy.ndarray, pandas.core.frame.DataFrame, list], figure: dict, filename: str, generation: int) → dict

Plot the next set of individuals in an animation.

Plots scatter for 3D data.

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

pyRVEA.OtherTools.plotlyanimate.animate_init_(data: Union[numpy.ndarray, pandas.core.frame.DataFrame, list], filename: str) → dict

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

pyRVEA.OtherTools.plotlyanimate.animate_next_(data: Union[numpy.ndarray, pandas.core.frame.DataFrame, list], figure: dict, filename: str, generation: int) → dict

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

pyRVEA.OtherTools.plotlyanimate.animate_parallel_coords_init_(data: Union[numpy.ndarray, pandas.core.frame.DataFrame, list], filename: str) → dict

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

Intended as a frames object. Plots parallel coordinate plot for >3D 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

pyRVEA.OtherTools.plotlyanimate.animate_parallel_coords_next_(data: Union[numpy.ndarray, pandas.core.frame.DataFrame, list], figure: dict, filename: str, generation: int) → dict

Plot the next set of individuals in an animation.

Plots 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

pyRVEA.OtherTools.plotlyanimate.test()
pyRVEA.OtherTools.plotlyanimate.test2()

pyRVEA.OtherTools.symmetric_vectors module