2 Commits

Author SHA1 Message Date
  Forest Belton 74c5812a59 Add a note about synthesis 2 years ago
  Forest Belton d1d364b5dc Add example testcase that includes carry set 2 years ago
2 changed files with 6 additions and 7 deletions
Split View
  1. +3
    -6
      ex.py
  2. +3
    -1
      gbso/optimize.py

+ 3
- 6
ex.py View File

@ -19,18 +19,15 @@ prgm = Program(
)
outputs = [R8.A]
test_cases = [TestCase()]
test_cases = [TestCase(), TestCase(state=CPUState(carry=1))]
params = OptimizationParameters(max_size=4)
initial_cost = cost(prgm, test_cases, outputs, prgm)
initial_cycles = prgm.perf()
print("Program to optimize:")
prgm.display()
print(f"Cost: {initial_cost[0]}")
print(f"Cycles: {initial_cycles}")
print(f"Cost: 0.0")
print(f"Cycles: {prgm.perf()}")
start_time = time()

+ 3
- 1
gbso/optimize.py View File

@ -10,8 +10,10 @@ from gbso.program.program import Program
EPSILON = 0.00001
DEFAULT_ANNEALING_CONSTANT = 0.5
DEFAULT_SYNTHESIS_ITERS = 0
DEFAULT_OPTIMIZE_ITERS = 5_000_000
# By default, we set synthesis iters = 0 and num candidates = 1 to skip synthesis
DEFAULT_SYNTHESIS_ITERS = 0
DEFAULT_NUM_CANDIDATES = 1
DEFAULT_PROB_OPCODE = 0.25

Loading…
Cancel
Save