MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / add

Method add

alphageometry.py:466–478  ·  view source on GitHub ↗

Add a new node to this queue.

(self, node: object, val: float)

Source from the content-addressed store, hash-verified

464 self.max_size = max_size
465
466 def add(self, node: object, val: float) -> None:
467 """Add a new node to this queue."""
468
469 if len(self.queue) < self.max_size:
470 self.queue.append((val, node))
471 return
472
473 # Find the minimum node:
474 min_idx, (min_val, _) = min(enumerate(self.queue), key=lambda x: x[1])
475
476 # replace it if the new node has higher value.
477 if val > min_val:
478 self.queue[min_idx] = (val, node)
479
480 def __iter__(self):
481 for val, node in self.queue:

Callers 2

run_alphageometryFunction · 0.95
test_beam_queueMethod · 0.95

Calls

no outgoing calls

Tested by 1

test_beam_queueMethod · 0.76