-
Notifications
You must be signed in to change notification settings - Fork 0
print_compare_solutions
Josh Fogg edited this page Jul 31, 2024
·
1 revision
print_compare_solutions(portfolio1, portfolio2, objective1, objective2, precision, z1, z2, name1, name2, tol)
Given two solutions to a optimal contribution selection problem (robust or non-robust) this prints a comparison of the two solutions to the terminal.
-
portfolio1 : ndarray
The portfolio vector$\mathbf{w}_1$ for the first solution to compare. -
portfolio2 : ndarray
The portfolio vector$\mathbf{w}_2$ for the second solution to compare. -
objective1 : float
Objective value associated with the first solution vector$\mathbf{w}_1$ . -
objective2 : float
Objective value associated with the second solution vector$\mathbf{w}_2$ . -
precision : int, optional
The number of decimal places to display values to, with a default of 5. -
z1 : float, optional
Auxiliary variable$z_1$ associated with uncertainty for the first solution$\mathbf{w}_1$ . Default isNone
, which corresponds to the non-robust problem. -
z2 : float, optional
Auxiliary variable$z_2$ associated with uncertainty for the second solution$\mathbf{w}_2$ . Default isNone
, which corresponds to the non-robust problem. -
name1: str, optional
Name to use for the first solution in output. Default value is"First"
. -
name2: str, optional
Name to use for the second solution in output. Default value is"Second"
. -
tol: float, optional
If both portfolios have an entry below this tolerance for a specific candidate, that candidate will be omitted from the output. Default isNone
, i.e. all values are shown.
This function does not have a return value, but when used it produces a terminal output like the following:
>>> print_compare_solutions(..., z2=z_rbs, name1="w_std", name2="w_rbs")
i w_std w_rbs
1 0.00000 0.38200
2 0.00000 0.38200
3 0.50000 0.11800
4 0.50000 0.11800
w_std objective: 1.87500
w_rbs objective: 0.77684 (z = 0.37924)
Maximum change: 0.38200
Average change: 0.38200
Minimum change: 0.38200
This documentation relates to the latest version of the package on GitHub. For past versions, download the zip bundled with the release from here. If anything in this wiki looks incorrect or you think key information is missing, please do open an issue.