variable search optimization

This commit is contained in:
2026-04-27 09:37:36 +02:00
parent a6d4647105
commit 093a887358
3 changed files with 11 additions and 6 deletions
+1 -1
View File
@@ -3,4 +3,4 @@
__pycache__/
.pytest_cache/
*.egg-info/
*.txt
+3
View File
@@ -4,6 +4,9 @@ def pretty_print(poly):
x_terms = []
mixed_terms = []
if isinstance(poly, int):
return str(poly)
has_const = bool(poly.constant_coefficient())
for monom in poly:
+7 -5
View File
@@ -26,12 +26,14 @@ def apply_variable_change(model, coeffs):
return new_R
def run_exhaustive(steps: int, target_reg: int = 0):
for idx, coeffs in enumerate(iproduct([0, 1], repeat=4)):
model = Tea3Model()
for _ in range(steps):
model.step()
model = Tea3Model()
for _ in range(steps):
model.step()
new_R = apply_variable_change(model, coeffs)
snapshot = model
for idx, coeffs in enumerate(iproduct([0, 1], repeat=4)):
new_R = apply_variable_change(snapshot, coeffs)
label = "".join(map(str, coeffs))
print(f"\n[{idx:02d}] (a1,a2,a3,a4) = {label}")