risk.rearrange()
The Rearrangement Algorithm (Puccetti and Rueschendorf): orders each
Usage
risk.rearrange(
columns,
rotate=None,
seed=None,
tolerance=1e-06,
)column opposite to the sum of the others until the smallest row sum stops rising by tolerance. Its answer depends on the start: as given, column j rotated down by rotate * j places, or each column shuffled from seed.
Parameters
columns: list of list of float-
Equal lengths.
rotate: int = Noneseed: int = Nonetolerance: float = 1e-6
Returns
dict- value (the smallest row sum), columns (the final arrangement) and iterations.
Examples
>>> from prospicio.risk import rearrange
>>> rearrange([[1.0, 2.0, 3.0, 4.0], [1.0, 2.0, 3.0, 4.0]])["value"]5.0