def pareto_front(vals1, vals2, round_val=3):
# butter and guns pareto front. Removes points not on
# the pareto frontier
# round very similar vals
vals1 = round(vals1, round_val)
vals2 = round(vals2, round_val)
v1_out = []
v2_out = []
idx_out = []
for idx in range(0, len(vals1)):
is_better = np.find(vals1 >= vals1[idx] and vals2 >= vals2[idx])
if is_better is None:
v1_out.append(vals1[idx])
v2_out.append(vals2[idx])
idx_out.append(idx)
return v1_out, v2_out, idx_out
评论列表
文章目录