plots
¤
Plots of ORACLE results (plotly).
Functions:
-
plot_convergence–The ORACLE metric (largest distance between the inner and outer approximations) at each iteration.
-
plot_projection–Both approximations of the near-optimal space, projected on two dimensions.
-
plot_ranges–Near-optimal range of each dimension: guaranteed (inner approximation) and possible (outer approximation).
-
projected_outer–Outline of the projection of
{z : A z <= b}on dimensionsixandiy.
Attributes:
plot_convergence
¤
plot_convergence(
result: OracleResult,
log_y: bool = True,
title: Optional[str] = None,
) -> Figure
The ORACLE metric (largest distance between the inner and outer approximations) at each iteration.
The line is the certified upper bound on the metric. When the metric MILP stops at its optimality gap, the distance of the trial point actually explored (a lower bound) is shown as well.
Parameters:
-
(result¤OracleResult) –An
OracleResultwith at least one iteration. -
(log_y¤bool, default:True) –Logarithmic vertical axis (switched off automatically if the metric reaches 0).
-
(title¤Optional[str], default:None) –Figure title.
Source code in src/energyscope/oracle/plots.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
plot_projection
¤
plot_projection(
result: OracleResult,
x: str,
y: str,
show_points: bool = True,
show_outer: bool = True,
trial_point: Optional[dict] = None,
n_directions: int = 120,
title: Optional[str] = None,
) -> Figure
Both approximations of the near-optimal space, projected on two dimensions.
The true near-optimal space lies between the dark (inner) and the light (outer) region.
Parameters:
-
(result¤OracleResult) –An
OracleResult. -
(x¤str) –Dimension on the horizontal axis.
-
(y¤str) –Dimension on the vertical axis.
-
(show_points¤bool, default:True) –Show the near-optimal designs found.
-
(show_outer¤bool, default:True) –Show the outer approximation.
-
(trial_point¤Optional[dict], default:None) –Optional design to highlight, as a dict, a pandas Series or an array with one value per dimension (e.g. the point returned by
Oracle.furthest_point). -
(n_directions¤int, default:120) –Number of directions used to trace the outer projection in more than 2 dimensions.
-
(title¤Optional[str], default:None) –Figure title.
Source code in src/energyscope/oracle/plots.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
plot_ranges
¤
plot_ranges(
result: OracleResult, title: Optional[str] = None
) -> Figure
Near-optimal range of each dimension: guaranteed (inner approximation) and possible (outer approximation).
Source code in src/energyscope/oracle/plots.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
projected_outer
¤
projected_outer(
A: ndarray,
b: ndarray,
ix: int,
iy: int,
n_directions: int = 120,
) -> ndarray
Outline of the projection of {z : A z <= b} on dimensions ix and iy.
In 2-D the vertices are exact. In more dimensions the projection is traced with one LP per direction, which
finds every vertex of the projected polygon whose normal cone contains one of the n_directions directions.
Source code in src/energyscope/oracle/plots.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |