desdeo_emo.utilities.ReferenceVectors

Module Contents

Classes

ReferenceVectors

Class object for reference vectors.

Functions

normalize()

Normalize the reference vectors to a unit hypersphere.

shear(vectors[, degrees])

Shear a set of vectors lying on the plane z=0 towards the z-axis, such that the

rotate(initial_vector, rotated_vector, other_vectors)

Calculate the rotation matrix that rotates the initial_vector to the

householder(vector)

Return reflection matrix via householder transformation.

rotate_toward(initial_vector, final_vector, other_vectors)

Rotate other_vectors (with the centre at initial_vector) towards final_vector

desdeo_emo.utilities.ReferenceVectors.normalize(vectors)[source]

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.

desdeo_emo.utilities.ReferenceVectors.shear(vectors, degrees: float = 5)[source]

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)

desdeo_emo.utilities.ReferenceVectors.rotate(initial_vector, rotated_vector, other_vectors)[source]

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.

desdeo_emo.utilities.ReferenceVectors.householder(vector)[source]

Return reflection matrix via householder transformation.

desdeo_emo.utilities.ReferenceVectors.rotate_toward(initial_vector, final_vector, other_vectors, degrees: float = 5)[source]

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

class desdeo_emo.utilities.ReferenceVectors.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)[source]

Class object for reference vectors.

_create(creation_type: str = 'Uniform')[source]

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()[source]

Normalize the reference vectors to a unit hypersphere.

neighbouring_angles() numpy.ndarray[source]

Calculate neighbouring angles for normalization.

adapt(fitness: numpy.ndarray)[source]

Adapt reference vectors. Then normalize.

Parameters:

fitness (np.ndarray) –

interactive_adapt_1(z: numpy.ndarray, n_solutions: int, translation_param: float = 0.2) None[source]

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[source]

Adapt reference vectors by using the information about non-preferred solution(s) selected by the Decision maker. After the Decision maker has specified non-preferred 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 re-positioned 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 non-preferred solutions, the reference vector(s) for which the distance to any of the non-preferred 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) – Non-preferred 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. (re-positioned somewhere) –

  • value (Default) – 0.2

Returns:

iteractive_adapt_3(ref_point, translation_param=0.2)[source]

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[source]

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)[source]

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()[source]

Add edge vectors to the list of reference vectors.

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