PortfolioDiversification#

class PortfolioDiversification(similarity_matrix, num_assets, num_clusters)[source]#

Bases: OptimizationApplication

Optimization application for the “portfolio diversification” problem introduced in [1].

References

[1]: GG. Cornuejols and R. Tutuncu, Optimization methods in finance, 2006

Parameters:
  • similarity_matrix (ndarray) – An asset-to-asset similarity matrix, such as the covariance matrix.

  • num_assets (int) – The number of assets.

  • num_clusters (int) – The number of clusters of assets to output.

Attributes

num_assets#

Getter of num_assets

Returns:

The number of assets.

num_clusters#

Getter of num_clusters

Returns:

The number of clusters of assets to output

similarity_matrix#

Getter of similarity_matrix

Returns:

An asset-to-asset similarity matrix, such as the covariance matrix.

Methods

interpret(result)[source]#

Interpret a result as a list of asset indices

Parameters:

result (OptimizationResult | ndarray) – The calculated result of the problem

Returns:

The list of asset indices whose corresponding variable is 1

Return type:

List[int]

static sample_most_likely(state_vector)#

Compute the most likely binary string from state vector.

Parameters:

state_vector (QuasiDistribution | Statevector | ndarray | Dict) – state vector or counts or quasi-probabilities.

Returns:

binary string as numpy.ndarray of ints.

Raises:

ValueError – if state_vector is not QuasiDistribution, Statevector, np.ndarray, or dict.

Return type:

ndarray

to_quadratic_program()[source]#

Convert a portfolio diversification problem instance into a QuadraticProgram.

Returns:

The QuadraticProgram created from the portfolio diversification problem instance.

Return type:

QuadraticProgram