clean up display of old scoring method
This commit is contained in:
parent
cb01f794cd
commit
3365a182b5
1 changed files with 24 additions and 19 deletions
|
@ -189,6 +189,12 @@ def main(argv, display=True):
|
||||||
else " "
|
else " "
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def print_place(ind, names, which="best"):
|
||||||
|
color = "\033[32m" if which == "best" else "\033[31m"
|
||||||
|
reset, placed, tied = "\033[m", place_names[ind], " \033[90m(tied)\033[m"
|
||||||
|
for i, name in enumerate(sorted(set(names))):
|
||||||
|
print(tied if i else f" {color}{placed}:{reset}", name)
|
||||||
|
|
||||||
def fancy_output(opt_name, score, price):
|
def fancy_output(opt_name, score, price):
|
||||||
name = opt_name.removesuffix("_cube")
|
name = opt_name.removesuffix("_cube")
|
||||||
if type(score) is float:
|
if type(score) is float:
|
||||||
|
@ -243,9 +249,10 @@ def main(argv, display=True):
|
||||||
|
|
||||||
reset = "\033[m"
|
reset = "\033[m"
|
||||||
|
|
||||||
quieter = True
|
quieter = False
|
||||||
please_stop_the_spam = True
|
summarize_each_objective = True
|
||||||
no_summary = True
|
old_summary = True
|
||||||
|
note = (lambda s: None) if quieter else m36
|
||||||
|
|
||||||
if 1:
|
if 1:
|
||||||
multiple = 2
|
multiple = 2
|
||||||
|
@ -264,9 +271,9 @@ def main(argv, display=True):
|
||||||
budget = int(argv[3]) if len(argv) > 3 else fib(abs(size) + 4) * 10
|
budget = int(argv[3]) if len(argv) > 3 else fib(abs(size) + 4) * 10
|
||||||
|
|
||||||
place_names = ("1st", "2nd", "3rd", "4th")
|
place_names = ("1st", "2nd", "3rd", "4th")
|
||||||
|
place_scores = (5, 3, 2, 1)
|
||||||
assert size < 0, "unsupported in this version"
|
assert size < 0, "unsupported in this version"
|
||||||
size = abs(size)
|
size = abs(size)
|
||||||
place_scores = (5, 3, 2, 1)
|
|
||||||
objectives = GO_BENCHMARKS[size] # * multiple
|
objectives = GO_BENCHMARKS[size] # * multiple
|
||||||
optimizers = list(which) # copy
|
optimizers = list(which) # copy
|
||||||
ms = f" ({multiple}+{run_anyway-multiple} times)" if multiple != 1 else ""
|
ms = f" ({multiple}+{run_anyway-multiple} times)" if multiple != 1 else ""
|
||||||
|
@ -303,8 +310,6 @@ def main(argv, display=True):
|
||||||
fopt, xopt, history = cache
|
fopt, xopt, history = cache
|
||||||
results.setdefault(obj_name, []).append((fopt, opt_name, history))
|
results.setdefault(obj_name, []).append((fopt, opt_name, history))
|
||||||
|
|
||||||
note = (lambda s: None) if quieter else m36
|
|
||||||
|
|
||||||
once = False
|
once = False
|
||||||
while (
|
while (
|
||||||
run <= multiple
|
run <= multiple
|
||||||
|
@ -329,12 +334,12 @@ def main(argv, display=True):
|
||||||
run += 1
|
run += 1
|
||||||
|
|
||||||
all_results = results
|
all_results = results
|
||||||
results = prune_results(results, multiple, _check=not no_summary)
|
results = prune_results(results, multiple, _check=old_summary)
|
||||||
|
|
||||||
scores, prices = {}, {}
|
scores, prices = {}, {}
|
||||||
all_opt_names = set()
|
all_opt_names = set()
|
||||||
for obj_name, obj_res in results.items():
|
for obj_name, obj_res in results.items():
|
||||||
if display and not please_stop_the_spam:
|
if display and summarize_each_objective:
|
||||||
print()
|
print()
|
||||||
m1(f"{obj_name}:")
|
m1(f"{obj_name}:")
|
||||||
all_res = {}
|
all_res = {}
|
||||||
|
@ -358,21 +363,21 @@ def main(argv, display=True):
|
||||||
# break
|
# break
|
||||||
mi = len(all_res) - i - 1
|
mi = len(all_res) - i - 1
|
||||||
if i < len(place_scores):
|
if i < len(place_scores):
|
||||||
for opt_name in all_res[fopt]:
|
for opt_i, opt_name in enumerate(all_res[fopt]):
|
||||||
scores[opt_name] = (
|
scores[opt_name] += place_scores[i] / score_insignificance
|
||||||
scores[opt_name] + place_scores[i] / score_insignificance
|
if display and summarize_each_objective:
|
||||||
)
|
print_place(i, all_res[fopt], "best")
|
||||||
if mi < len(place_scores):
|
if mi < len(place_scores):
|
||||||
for opt_name in all_res[fopt]:
|
for opt_i, opt_name in enumerate(all_res[fopt]):
|
||||||
prices[opt_name] = (
|
prices[opt_name] += place_scores[mi] / price_insignificance
|
||||||
prices[opt_name] + place_scores[mi] / price_insignificance
|
if display and summarize_each_objective:
|
||||||
)
|
print_place(mi, all_res[fopt], "worst")
|
||||||
|
|
||||||
if display:
|
if display:
|
||||||
more_scores = perform_another_experimental_scoring_method(results)
|
more_scores = perform_another_experimental_scoring_method(results)
|
||||||
|
|
||||||
for blah, points in zip(("best", "worst"), (scores, prices)):
|
for blah, points in zip(("best", "worst"), (scores, prices)):
|
||||||
if display and not no_summary:
|
if display and old_summary:
|
||||||
print(
|
print(
|
||||||
f"\n\033[1m{blah} scoring optimizers:\033[m"
|
f"\n\033[1m{blah} scoring optimizers:\033[m"
|
||||||
f" (awards={place_scores})"
|
f" (awards={place_scores})"
|
||||||
|
@ -382,7 +387,7 @@ def main(argv, display=True):
|
||||||
for opt_name, opt_point in sorted(points.items(), key=lambda t: -t[1]):
|
for opt_name, opt_point in sorted(points.items(), key=lambda t: -t[1]):
|
||||||
# place = place_names[i] if i < len(place_names) else " "
|
# place = place_names[i] if i < len(place_names) else " "
|
||||||
# delta = scores.get(opt_name, 0) - prices.get(opt_name, 0)
|
# delta = scores.get(opt_name, 0) - prices.get(opt_name, 0)
|
||||||
if display and not no_summary:
|
if display and old_summary:
|
||||||
print(
|
print(
|
||||||
fancy_output(
|
fancy_output(
|
||||||
opt_name, scores.get(opt_name, 0), prices.get(opt_name, 0)
|
opt_name, scores.get(opt_name, 0), prices.get(opt_name, 0)
|
||||||
|
@ -400,7 +405,7 @@ def main(argv, display=True):
|
||||||
if opt_name not in negative:
|
if opt_name not in negative:
|
||||||
negative.append(opt_name)
|
negative.append(opt_name)
|
||||||
|
|
||||||
if display and no_summary:
|
if display and not old_summary:
|
||||||
print(
|
print(
|
||||||
f"\n\033[1malternatively scored optimizers:\033[m"
|
f"\n\033[1malternatively scored optimizers:\033[m"
|
||||||
f" (awards={place_scores})"
|
f" (awards={place_scores})"
|
||||||
|
|
Loading…
Add table
Reference in a new issue