-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
152 lines (116 loc) · 3.74 KB
/
plot.py
File metadata and controls
152 lines (116 loc) · 3.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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
95
96
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import matplotlib.pyplot as plt
# Lorenz-efficient set (same for all omegas)
lorenz_points = [
(4851, 11562),
(5136, 11432),
(5296, 11286),
]
lorenz_per_omega = {
(1.01, 1): [
(4851, 11562), # P1
(5136, 11432),
(5296, 11286),
],
(1.5, 1): [
(5136, 11432), # P1
(4851, 11562),
(5296, 11286),
],
(2, 1): [
(5296, 11286), # P1
(5136, 11432),
(4851, 11562),
],
(5, 1): [
(5296, 11286), # P1
(5136, 11432),
(4851, 11562),
],
(10, 1): [
(5296, 11286), # P1
(5136, 11432),
(4851, 11562),
],
}
lorenz_frontier = [
(4851, 11562),
(5136, 11432),
(5296, 11286),
]
# P1-selected Lorenz vector for each omega
omega_to_p1 = {
(1.01, 1): (4851, 11562),
(1.5, 1): (5136, 11432),
(2, 1): (5296, 11286),
(5, 1): (5296, 11286),
(10, 1): (5296, 11286),
}
L1 = [p[0] for p in lorenz_points]
L2 = [p[1] for p in lorenz_points]
import matplotlib.pyplot as plt
plt.figure(figsize=(7,5))
# Plot Lorenz-efficient frontier
L1, L2 = zip(*lorenz_frontier)
plt.plot(L1, L2, "--o", color="black", label="Lorenz-efficient frontier")
# Colors for each omega
colors = ["red", "blue", "green", "purple", "orange"]
for (omega, color) in zip(lorenz_per_omega.keys(), colors):
p1_point = lorenz_per_omega[omega][0]
plt.scatter(*p1_point, s=120, facecolors="none",
edgecolors=color, linewidths=2,
label=f"P1 for ω={omega}")
plt.xlabel(r"$L_1$ (minimum objective)")
plt.ylabel(r"$L_2$ (sum of objectives)")
plt.title("Lorenz-efficient frontier and P1 selections for different ω")
plt.legend()
plt.grid(alpha=0.3)
plt.tight_layout()
# plt.show()
import matplotlib.pyplot as plt
# Lorenz vectors per omega in the order you printed (Solution 0 = P1)
lorenz_per_omega = {
(1.01, 1): [(4851, 11562), (5136, 11432), (5296, 11286)],
(1.5, 1): [(5136, 11432), (4851, 11562), (5296, 11286)],
(2, 1): [(5296, 11286), (5136, 11432), (4851, 11562)],
(5, 1): [(5296, 11286), (5136, 11432), (4851, 11562)],
(10, 1): [(5296, 11286), (5136, 11432), (4851, 11562)],
}
# Optional: your OWA values (same order as above). Used only for labels if you want.
owa_per_omega = {
(1.01, 1): [11610.51, 11483.36, 11338.96],
(1.5, 1): [14000.00, 13987.50, 13934.00],
(2, 1): [16582.00, 16568.00, 16413.00],
(5, 1): [32470.00, 31976.00, 30966.00],
(10, 1): [58950.00, 57656.00, 55221.00],
}
# ---- Plot ----
plt.figure(figsize=(8, 6))
# Plot the Lorenz frontier once (order-independent)
frontier = sorted({pt for seq in lorenz_per_omega.values() for pt in seq})
fx, fy = zip(*frontier)
plt.plot(fx, fy, "--", color="gray", alpha=0.6, label="Lorenz-efficient frontier")
# Colors for each omega
omegas = list(lorenz_per_omega.keys())
colors = ["red", "blue", "green", "purple", "orange"]
for omega, color in zip(omegas, colors):
pts = lorenz_per_omega[omega]
xs = [p[0] for p in pts]
ys = [p[1] for p in pts]
# PL points (all enumerated Lorenz vectors for this omega)
plt.scatter(xs, ys, s=70, color=color, alpha=0.35)
# Connect in enumeration order (optional but useful)
plt.plot(xs, ys, "-", color=color, alpha=0.35)
# Highlight P1 (first point)
p1x, p1y = pts[0]
plt.scatter(p1x, p1y, s=170, facecolors="none", edgecolors=color,
linewidths=2.5, label=f"P1 for ω={omega}")
# Optional label at P1
plt.text(p1x + 12, p1y - 25, f"ω={omega}", fontsize=9)
# Axis labels and title
plt.xlabel(r"$L_1$ (minimum objective)")
plt.ylabel(r"$L_2$ (sum of objectives)")
plt.title("P1 selections vs PL enumerations in Lorenz space")
plt.grid(alpha=0.25)
plt.legend()
plt.tight_layout()
plt.show()