it works now?
This commit is contained in:
parent
df7a41c21b
commit
41fc07e6ee
2 changed files with 7 additions and 7 deletions
|
|
@ -82,6 +82,12 @@ def run_ga_qas(
|
|||
mutation_rate: float,
|
||||
seed: int,
|
||||
) -> list[tuple[int, int, int, int, int, float, float, float]]:
|
||||
|
||||
print(
|
||||
f"running GA QAS {seed} with {qubits} qubits, {depth} depth, for {generations} generations of size {generation_size}, with {parent_amount} parents and {mutation_rate:.3f} mutation rate",
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
seed_rng = random.Random(seed)
|
||||
initial_population: list[QuantumCircuit] = (
|
||||
Stream(
|
||||
|
|
@ -159,7 +165,6 @@ def run_ga_qas(
|
|||
best_circuits.append(offspring[0])
|
||||
population = offspring
|
||||
print(f"finished seed {seed}", file=sys.stderr)
|
||||
print(f"finished seed {seed}", flush=True, file=sys.stdout)
|
||||
return return_data
|
||||
|
||||
|
||||
|
|
@ -168,7 +173,7 @@ def run_from_point(pnt: tuple[tuple[int, int, int, int, float], int]):
|
|||
return run_ga_qas(
|
||||
point[0],
|
||||
point[1],
|
||||
2,
|
||||
20,
|
||||
point[2],
|
||||
point[3],
|
||||
point[4],
|
||||
|
|
|
|||
|
|
@ -34,20 +34,15 @@ def par_map(stream: Stream[T], fn: Callable[[T], U], cores: int = 0) -> Stream[U
|
|||
|
||||
for _ in range(inflight):
|
||||
x = next(it)
|
||||
print(f"adding {x}")
|
||||
pending.add(ex.submit(fn, x))
|
||||
print(f"added stuff to pending {pending}")
|
||||
|
||||
while True:
|
||||
done, pending = wait(pending, return_when=FIRST_COMPLETED)
|
||||
print(f"wait finished, {done}, {pending}")
|
||||
|
||||
for fut in done:
|
||||
print(f"yielding: {fut}", file=sys.stderr)
|
||||
print(fut.result())
|
||||
yield fut.result()
|
||||
x = next(it)
|
||||
print(f"adding {x}")
|
||||
pending.add(ex.submit(fn, x))
|
||||
|
||||
return Stream(gen())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue