| BGMCTS_state |
Ran ran on a synthesized input · constructed an object; no result was computed |
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py code served (permissive licence) · get_code("19afe23fd43d683f") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BGMCTS_state: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import numpy as np
from dataclasses import dataclass, field
from typing import Dict, Generic, List, Optional, Tuple, TypeVar
# Set seed for reproducibility
torch.manual_seed(0)
NodeStateT = TypeVar('NodeStateT')
StateT = TypeVar('StateT')
# Define a simple state type
@dataclass
class SimpleState:
value: int
data: torch.Tensor
# Create a minimal Tree instance
from dataclasses import dataclass as dc, field as dcfield
@dc
class Node(Generic[StateT]):
state: Optional[StateT] = None
score: float = -1.0
scores: list = dcfield(default_factory=list)
cost: float = 0
total_cost: float = 0
output_cost: float = 0
total_output_cost: float = 0
input_cost: float = 0
total_input_cost: float = 0
prm_output_cost: float = 0
prm_total_output_cost: float = 0
prm_input_cost: float = 0
prm_total_input_cost: float = 0
expand_idx: int = -1
parent: Optional['Node[StateT]'] = None
children: List['Node[StateT]'] = dcfield(default_factory=list)
def is_root(self) -> bool:
return self.parent is None
def get_subtree_nodes(self) -> List['Node[StateT]']:
nodes: List['Node[StateT]'] = []
stack: List['Node[StateT]'] = [self]
while stack:
current = stack.pop()
nodes.append(current)
stack.extend(current.children)
return nodes
@property
def depth(self) -> int:
depth = 0
current_node = self
while current_node.parent is not None:
current_node = current_node.parent
depth += 1
return depth
@dc
class Tree(Generic[StateT]):
root: Node[StateT]
size: int
def __init__(self):
self.root = Node[StateT]()
self.size = 1
def get_nodes(self) -> List[Node[StateT]]:
nodes = self.root.get_subtree_nodes()
nodes.sort(key=lambda x: x.expand_idx)
return nodes
def get_node(self, expand_idx: int) -> Node[StateT]:
return self.get_nodes()[expand_idx + 1]
def add_node(self, state_score_cost: Tuple, parent: Node[StateT]) -> Node[StateT]:
state, score, scores, cost, total_cost, output_cost, total_output_cost, input_cost, total_input_cost, prm_output_cost, prm_total_output_cost, prm_input_cost, prm_total_input_cost = state_score_cost
node = Node(state=state, score=score, scores=scores, cost=cost, total_cost=total_cost, output_cost=output_cost, total_output_cost=total_output_cost, input_cost=input_cost, total_input_cost=total_input_cost, prm_output_cost=prm_output_cost, prm_total_output_cost=prm_total_output_cost, prm_input_cost=prm_input_cost, prm_total_input_cost=prm_total_input_cost, parent=parent, expand_idx=self.size - 1)
parent.children.append(node)
self.size += 1
return node
# Create a tree with some nodes
tree = Tree[SimpleState]()
# Add a few nodes to the tree
state1 = SimpleState(value=1, data=torch.randn(2, 4))
parent = tree.root
node1 = tree.add_node(
(state1, 0.5, [0.5], 1.0, 1.0, 0.2, 0.2, 0.1, 0.1, 0.05, 0.05, 0.03, 0.03),
parent
)
state2 = SimpleState(value=2, data=torch.randn(2, 4))
node2 = tree.add_node(
(state2, 0.7, [0.7], 0.8, 1.8, 0.15, 0.35, 0.08, 0.18, 0.04, 0.09, 0.02, 0.05),
parent
)
# Construct BGMCTS_state arguments
ARGS = {
"tree": tree,
"visit_counts": {0: 1, 1: 2, 2: 3},
"value_sums": {0: 0.5, 1: 1.4, 2: 2.1},
"priors": {0: 0.3, 1: 0.5, 2: 0.2},
"next_nodes": [(node1, "expand"), (node2, "backprop")],
"subtree_node": {0: [1, 2], 1: [3, 4]},
"depth_node": {0: 2, 1: 3, 2: 4},
"cost_used": 5.5,
"ans_depth_list": [1, 2, 3],
"ans_depth": 2.33,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type BGMCTS_state — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BGMCTS_state output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| Node |
Ran ran on a synthesized input · constructed an object; no result was computed |
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py code served (permissive licence) · get_code("c75dbc1227c763cf") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Node: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import dataclasses
from typing import Dict, Generic, List, Optional, Tuple, TypeVar
StateT = TypeVar('StateT')
@dataclasses.dataclass
class Node(Generic[StateT]):
state: Optional[StateT] = None
score: float = -1.0
scores: list = dataclasses.field(default_factory=list)
cost: float = 0
total_cost: float = 0
output_cost: float = 0
total_output_cost: float = 0
input_cost: float = 0
total_input_cost: float = 0
prm_output_cost: float = 0
prm_total_output_cost: float = 0
prm_input_cost: float = 0
prm_total_input_cost: float = 0
expand_idx: int = -1
parent: Optional['Node[StateT]'] = None
children: List['Node[StateT]'] = dataclasses.field(default_factory=list)
def __post_init__(self) -> None:
if not self.is_root():
if not (self.score <= 1.0 and self.score >= 0.0):
raise RuntimeError(f'The score value should be between 0 and 1, while {self.score} is set.')
if self.state is None:
raise RuntimeError('The node state for non-root node should not be None.')
def get_subtree_nodes(self) -> List['Node[StateT]']:
"""
Get all the nodes of the subtree starting from self, including self itself.
"""
nodes: List['Node[StateT]'] = []
stack: List['Node[StateT]'] = [self]
while stack:
current = stack.pop()
nodes.append(current)
stack.extend(current.children)
return nodes
def is_root(self) -> bool:
return self.parent is None
@property
def depth(self) -> int:
depth = 0
current_node = self
while current_node.parent is not None:
current_node = current_node.parent
depth += 1
return depth
# Create a valid root node (no parent, state can be None for root)
root_node = Node(
state=None,
score=-1.0,
scores=[0.1, 0.2, 0.3],
cost=0.0,
total_cost=0.0,
output_cost=0.0,
total_output_cost=0.0,
input_cost=0.0,
total_input_cost=0.0,
prm_output_cost=0.0,
prm_total_output_cost=0.0,
prm_input_cost=0.0,
prm_total_input_cost=0.0,
expand_idx=-1,
parent=None,
children=[]
)
# Create a valid child node (has parent, must have valid score between 0-1, must have state)
child_node = Node(
state="child_state_1",
score=0.75,
scores=[0.5, 0.75],
cost=1.5,
total_cost=1.5,
output_cost=0.5,
total_output_cost=0.5,
input_cost=1.0,
total_input_cost=1.0,
prm_output_cost=0.3,
prm_total_output_cost=0.3,
prm_input_cost=0.7,
prm_total_input_cost=0.7,
expand_idx=0,
parent=root_node,
children=[]
)
# Add child to parent
root_node.children.append(child_node)
ARGS = {
'state': "example_state",
'score': 0.85,
'scores': [0.1, 0.2, 0.85],
'cost': 2.0,
'total_cost': 2.0,
'output_cost': 1.0,
'total_output_cost': 1.0,
'input_cost': 1.0,
'total_input_cost': 1.0,
'prm_output_cost': 0.6,
'prm_total_output_cost': 0.6,
'prm_input_cost': 0.4,
'prm_total_input_cost': 0.4,
'expand_idx': 1,
'parent': root_node,
'children': []
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Node — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Node output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| Tree |
Ran ran on a synthesized input · constructed an object; no result was computed |
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py code served (permissive licence) · get_code("a21665ea9499d759") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Tree: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import dataclasses
from typing import Dict, Generic, List, Optional, Tuple, TypeVar
torch = None
numpy = None
scipy = None
NodeStateT = TypeVar('NodeStateT')
StateT = TypeVar('StateT')
StateScoreCostType = Tuple[NodeStateT, float, list, float, float, float, float, float, float, float, float, float, float]
StateScoreType = Tuple[NodeStateT, float]
@dataclasses.dataclass
class Node(Generic[StateT]):
state: Optional[StateT] = None
score: float = -1.0
scores: list = dataclasses.field(default_factory=list)
cost: float = 0
total_cost: float = 0
output_cost: float = 0
total_output_cost: float = 0
input_cost: float = 0
total_input_cost: float = 0
prm_output_cost: float = 0
prm_total_output_cost: float = 0
prm_input_cost: float = 0
prm_total_input_cost: float = 0
expand_idx: int = -1
parent: Optional['Node[StateT]'] = None
children: List['Node[StateT]'] = dataclasses.field(default_factory=list)
def __post_init__(self) -> None:
if not self.is_root():
if not (self.score <= 1.0 and self.score >= 0.0):
raise RuntimeError(f'The score value should be between 0 and 1, while {self.score} is set.')
if self.state is None:
raise RuntimeError('The node state for non-root node should not be None.')
def get_subtree_nodes(self) -> List['Node[StateT]']:
"""
Get all the nodes of the subtree starting from self, including self itself.
"""
nodes: List['Node[StateT]'] = []
stack: List['Node[StateT]'] = [self]
while stack:
current = stack.pop()
nodes.append(current)
stack.extend(current.children)
return nodes
def is_root(self) -> bool:
return self.parent is None
@property
def depth(self) -> int:
depth = 0
current_node = self
while current_node.parent is not None:
current_node = current_node.parent
depth += 1
return depth
@dataclasses.dataclass
class Tree(Generic[StateT]):
"""
Utility data structure for handling tree.
"""
root: Node[StateT]
size: int
def __init__(self):
self.root = Node[StateT]()
self.size = 1
@classmethod
def with_root_node(cls) -> 'Tree[StateT]':
"""
Create a new tree with a properly initialized root node.
The root node follows the convention of having:
- state: None
- score: -1.0
- expand_idx: -1
Returns:
A new Tree instance with the root node initialized
"""
return cls()
def __len__(self) -> int:
return self.size
def get_nodes(self) -> List[Node[StateT]]:
"""
Returns the node in ascending order of their expand_idx.
"""
nodes = self.root.get_subtree_nodes()
nodes.sort(key=lambda x: x.expand_idx)
return nodes
def get_node(self, expand_idx: int) -> Node[StateT]:
"""
Returns the node with the given expand_idx.
"""
return self.get_nodes()[expand_idx + 1]
def get_state_score_pairs(self) -> List[StateScoreType[StateT]]:
return [(node.state, node.score) for node in self.get_nodes() if not node.is_root() and node.state is not None]
def add_node(self, state_score_cost: StateScoreCostType[StateT], parent: Node[StateT]) -> Node[StateT]:
state, score, scores, cost, total_cost, output_cost, total_output_cost, input_cost, total_input_cost, prm_output_cost, prm_total_output_cost, prm_input_cost, prm_total_input_cost = state_score_cost
node = Node(state=state, score=score, scores=scores, cost=cost, total_cost=total_cost, output_cost=output_cost, total_output_cost=total_output_cost, input_cost=input_cost, total_input_cost=total_input_cost, prm_output_cost=prm_output_cost, prm_total_output_cost=prm_total_output_cost, prm_input_cost=prm_input_cost, prm_total_input_cost=prm_total_input_cost, parent=parent, expand_idx=self.size - 1)
parent.children.append(node)
self.size += 1
return node
# Create ARGS dict for Tree initialization
ARGS = {}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tree — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Tree output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| softmax |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py code served (permissive licence) · get_code("b36903455b4e0393") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
from math import exp, log, sqrt
# The softmax function takes a list of floats and computes softmax probabilities
# It uses: max(values), iteration over values, sum, and division
# No complex objects needed - just a simple list of floats
ARGS = {
"values": [1.0, 2.0, 3.0, 4.0]
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| Algorithm |
Not yet run unverified (harvested, no recorded run) |
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py code served (permissive licence) · get_code("f00978caea326175") How it ran |
| BGMCTS |
Not yet run unverified (harvested, no recorded run) |
Sora-Miyamoto/bg-mcts/treesearch/src/treesearch/algos/bg_mcts.py code served (permissive licence) · get_code("3264d0b68d801bb2") How it ran |