70 lines
2.3 KiB
Python
70 lines
2.3 KiB
Python
|
#!/usr/bin/env python3
|
||
|
from types import ModuleType
|
||
|
import solutions_1680721604
|
||
|
import solutions_1680730206
|
||
|
import solutions_1680730206
|
||
|
import solutions_1680975848
|
||
|
|
||
|
solutions = {}
|
||
|
loaded = []
|
||
|
for local_k in tuple(locals().keys()):
|
||
|
local_v = locals()[local_k]
|
||
|
if local_k.startswith("solutions_") and isinstance(local_v, ModuleType):
|
||
|
loaded.append(local_k)
|
||
|
for k, v in local_v.solutions.items():
|
||
|
solutions.setdefault(k, {})
|
||
|
solutions[k] |= v
|
||
|
|
||
|
dims_seen = set()
|
||
|
totally_fine = {}
|
||
|
too_variable = {}
|
||
|
too_centered = {}
|
||
|
too_far_away = {}
|
||
|
too_positive = {}
|
||
|
for k, v in solutions.items():
|
||
|
fopt = sorted(v)[0]
|
||
|
xopt = v[fopt]
|
||
|
dims = len(xopt)
|
||
|
dims_seen.add(dims)
|
||
|
alpha = [0, 256, 200, 100, 64][dims]
|
||
|
name = k.removeprefix("go_").removesuffix(str(dims)).removesuffix("_on_cube__")
|
||
|
is_too_centered = all(round(x * alpha) == alpha // 2 for x in xopt)
|
||
|
is_too_positive = sum(abs(x - sum(xopt) / dims) for x in xopt) / dims <= 1e-3
|
||
|
is_too_far_away = any(abs(0.5 - x) > 0.49 for x in xopt)
|
||
|
is_inconsistent = name in ("stochastic", "xinsheyang01")
|
||
|
if name == "csendes":
|
||
|
pass # skip; this is basically equivalent to "infinite"
|
||
|
elif is_inconsistent:
|
||
|
too_variable.setdefault(dims, []).append(name)
|
||
|
elif is_too_centered:
|
||
|
too_centered.setdefault(dims, []).append(name)
|
||
|
elif is_too_far_away:
|
||
|
too_far_away.setdefault(dims, []).append(name)
|
||
|
elif is_too_positive:
|
||
|
too_positive.setdefault(dims, []).append(name)
|
||
|
else:
|
||
|
totally_fine.setdefault(dims, []).append(name)
|
||
|
|
||
|
|
||
|
def dump_list(name, rows):
|
||
|
print()
|
||
|
print(f"{name} = [")
|
||
|
for row in rows:
|
||
|
print(f" {repr(row)},")
|
||
|
print("]")
|
||
|
|
||
|
|
||
|
print("# this file was automatically generated by generate_lists.py,")
|
||
|
print("# any changes may be overwritten!")
|
||
|
for name in loaded:
|
||
|
print(f"# loaded {name}.py")
|
||
|
for dims in sorted(dims_seen):
|
||
|
dump_list(f"too_variable_{dims}", too_variable.get(dims, []))
|
||
|
dump_list(f"too_centered_{dims}", too_centered.get(dims, []))
|
||
|
dump_list(f"too_far_away_{dims}", too_far_away.get(dims, []))
|
||
|
dump_list(f"too_positive_{dims}", too_positive.get(dims, []))
|
||
|
dump_list(f"totally_fine_{dims}", totally_fine.get(dims, []))
|
||
|
|
||
|
# print(len(totally_fine))
|
||
|
# print(len(totally_fine) + len(too_centered) + len(too_positive))
|