| animate_gridworld |
Ran ran on a synthesized input |
andrschl/cirl/visualization/gridworld_vis.py code served (permissive licence) · get_code("53c17c6603d9d565") 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 FuncAnimation. 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 numpy as np
import matplotlib.pyplot as plt
# Create minimal valid arguments for animate_gridworld
width = 5
height = 4
# Create a state trajectory as a list of (x, y) tuples
# Starting at (1, 1) and moving through a few positions
states = [
(1, 1),
(2, 1),
(2, 2),
(3, 2),
(3, 3)
]
# Create values array - should be flattened and will be reshaped to (height, width)
values = np.random.rand(width * height).astype(np.float32)
# Number of frames per action
nsteps = 2
# Create constraints as a 3D array
# Shape: (num_constraints, 2, 2) where each constraint has [bottom_left, (width, height)]
constraints = np.array([
[[0.5, 0.5], [1.5, 1.5]], # First constraint: bottom_left=(0.5, 0.5), width=1.5, height=1.5
[[3.0, 2.0], [1.0, 1.0]] # Second constraint: bottom_left=(3.0, 2.0), width=1.0, height=1.0
], dtype=np.float32)
ARGS = {
"width": width,
"height": height,
"states": states,
"values": values,
"nsteps": nsteps,
"constraints": constraints
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- matplotlib, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type FuncAnimation — a FuncAnimation output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a FuncAnimation 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
|
| dist_to_const_line |
Ran ran on a synthesized input |
andrschl/cirl/algs/cirl.py code served (permissive licence) · get_code("78fec7268a705b50") 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 float64, ndim 0, 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.
import numpy as np
# Construct small numpy arrays for the function parameters
r_expert = np.array([1.0, 2.0, 3.0, 4.0])
r = np.array([1.5, 2.5, 3.5, 4.5])
ARGS = {
"r_expert": r_expert,
"r": r,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
- 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
|
| empirical_expert_feature_expectation |
Ran ran on a synthesized input |
andrschl/cirl/algs/cirl.py code served (permissive licence) · get_code("f41acfeea124b649") 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 ndarray, ndim 1, dtype family float, shape (5,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np
class GridworldEnv:
"""Minimal gridworld environment for testing."""
def __init__(self, n=4, m=3, gamma=0.99):
self.n = n # number of rows
self.m = m # number of columns
self.gamma = gamma
def rollout(self, N, T, policy, nu0=None):
"""
Generate N trajectories of length T.
Returns rollouts of shape (N, T, 2) where each state is [row, col].
"""
rollouts = np.zeros((N, T, 2), dtype=np.int32)
for traj_idx in range(N):
if nu0 is not None:
# Sample initial state from nu0
state = np.random.choice(len(nu0), p=nu0)
row, col = state // self.m, state % self.m
else:
# Random initial state
row = np.random.randint(0, self.n)
col = np.random.randint(0, self.m)
for t in range(T):
rollouts[traj_idx, t, 0] = row
rollouts[traj_idx, t, 1] = col
# Simulate transition (simple random walk)
if np.random.rand() < 0.5:
row = min(row + 1, self.n - 1)
else:
row = max(row - 1, 0)
return rollouts, None
# Set up parameters
n_states_row = 4
n_states_col = 3
feature_dim = 5
n_trajectories = 2
trajectory_length = 6
# Create environment
env = GridworldEnv(n=n_states_row, m=n_states_col, gamma=0.99)
# Create policy: shape (n, m) - probability distribution over actions
policy = np.random.dirichlet(np.ones(4), size=(n_states_row, n_states_col))
# Create reward features: shape (n, m, d)
Phi = np.random.randn(n_states_row, n_states_col, feature_dim)
# Initial state distribution
nu0 = np.ones(n_states_row * n_states_col) / (n_states_row * n_states_col)
ARGS = {
'env': env,
'policy': policy,
'Phi': Phi,
'N': n_trajectories,
'T': trajectory_length,
'nu0': nu0
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 1, dtype family float, shape (5,) — shape (5,) as a later run recorded it
- 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
|
| euclidean_proj_l1ball |
Ran ran on a synthesized input |
andrschl/cirl/algs/l1_projection.py code served (permissive licence) · get_code("4e0247ae28bbd615") 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 ndarray, ndim 1, dtype family float, shape (5,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np
# Create a small test vector for projection
v = np.array([2.0, 1.0, -1.5, 0.5, 3.0])
# Define the simplex radius
s = 2.0
# Construct ARGS dictionary with all parameters
ARGS = {
"v": v,
"s": s
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 1, dtype family float, shape (5,) — shape (5,) as a later run recorded it
- 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
|
| euclidean_proj_simplex |
Ran ran on a synthesized input |
andrschl/cirl/algs/l1_projection.py code served (permissive licence) · get_code("d13aff1a000a4d49") 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 ndarray, ndim 1, dtype family float, shape (5,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np
# Construct test arguments for euclidean_proj_simplex
v = np.array([0.5, 0.3, 0.1, 0.8, 0.2]) # n-dimensional vector
s = 1 # radius of simplex (default value)
ARGS = {
'v': v,
's': s,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 1, dtype family float, shape (5,) — shape (5,) as a later run recorded it
- 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
|
| intersection |
Ran ran on a synthesized input |
andrschl/cirl/utils/geometric_tools.py code served (permissive licence) · get_code("c126fc1d8eb97b0c") 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 ndarray, ndim 2, dtype family float, shape (5, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np
from scipy.linalg import null_space
# Create two matrices with column spaces
# A is 5x3 (n=5, m=3)
# B is 5x4 (n=5, l=4)
# Using distinct sizes so dimensions are unambiguous
np.random.seed(0)
# Create A: shape (5, 3)
A = np.random.randn(5, 3)
# Create B: shape (5, 4)
B = np.random.randn(5, 4)
ARGS = {
"A": A,
"B": B,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 2, dtype family float, shape (5, 2) — shape (5, 2) as a later run recorded it
- 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
|
| orthogonal_complement |
Ran ran on a synthesized input |
andrschl/cirl/utils/geometric_tools.py code served (permissive licence) · get_code("b19942947f52d1fe") 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 ndarray, ndim 2, dtype family float, shape (5, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np
from scipy.linalg import null_space, orth, pinv
# Create a small matrix for testing
# Using shape (5, 3) - more rows than columns to have a non-trivial null space
# when transposed
A = np.array([
[1.0, 2.0, 3.0],
[4.0, 5.0, 6.0],
[7.0, 8.0, 9.0],
[10.0, 11.0, 12.0],
[13.0, 14.0, 15.0]
], dtype=np.float64)
ARGS = {
"A": A
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 2, dtype family float, shape (5, 3) — shape (5, 3) as a later run recorded it
- 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
|
| plot_gridworld |
Ran ran on a synthesized input |
andrschl/cirl/visualization/gridworld_vis.py code served (permissive licence) · get_code("80eed4dd96b2c24f") 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 Figure. 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 numpy as np
import matplotlib.pyplot as plt
class MockEnv:
"""Mock gridworld environment with required attributes and methods."""
def __init__(self, width, height):
self.width = width
self.height = height
self.n = width * height # total number of states
self.r = np.zeros((self.n, 1)) # reward array, shape (n_states, 1)
self.actions = np.array([[1, 0], [-1, 0], [0, 1], [0, -1]]) # up, down, right, left
def int2point(self, state_idx):
"""Convert state index to (x, y) coordinates."""
x = state_idx % self.width
y = state_idx // self.width
return x, y
# Setup parameters
width = 4
height = 3
# Create mock environment
env = MockEnv(width, height)
# Create policy: shape (n_states, n_actions)
n_states = width * height
n_actions = 4
policy = np.random.dirichlet(np.ones(n_actions), size=n_states)
# Create values array: shape (height * width,)
values = np.random.uniform(-1.0, 1.0, size=width * height)
# Create constraints: shape (n_constraints, 2, 2)
# Format: constraints[i, 0, :] = [x, y] bottom_left
# constraints[i, 1, :] = [width, height] dimensions
constraints = np.array([
[[0.5, 0.5], [1, 1]],
[[2.5, 1.5], [1, 1]]
])
ARGS = {
'env': env,
'policy': policy,
'width': width,
'height': height,
'values': values,
'constraints': constraints
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- matplotlib, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Figure — a Figure output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Figure 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
|
| reward |
Ran ran on a synthesized input |
andrschl/cirl/algs/cirl.py code served (permissive licence) · get_code("c6f978bd33eadfed") 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 Tensor, ndim 2, dtype family float, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from einops import einsum
torch.manual_seed(0)
# w: Reward parameter, shape (d,)
# d = 4 (chosen dimension)
w = torch.randn(4)
# Phi: Reward features, shape (n, m, d)
# n = 2 (batch size)
# m = 3 (number of actions/items)
# d = 4 (feature dimension)
Phi = torch.randn(2, 3, 4)
ARGS = {
'w': w,
'Phi': Phi,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) as a later run recorded it
- 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
|
| unit_vector |
Ran ran on a synthesized input |
andrschl/cirl/utils/geometric_tools.py code served (permissive licence) · get_code("1dda2e3a464c543a") 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 ndarray, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np
# Create a simple vector to normalize
v = np.array([3.0, 4.0])
# Define arguments for the unit_vector function
ARGS = {
"v": v,
"axis": None,
"ord": None
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
- 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
|
| xi_update |
Ran ran on a synthesized input |
andrschl/cirl/algs/cmdp.py code served (permissive licence) · get_code("2778d6a851c355ee") 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 tuple. 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 numpy as np
import torch
from einops import einsum
torch.manual_seed(0)
# Define a minimal environment class that satisfies the function's requirements
class MinimalGridworld:
def __init__(self):
# nu0: shape (s,) - initial state distribution
self.nu0 = np.array([0.5, 0.5, 0.0, 0.0])
# Psi: constraint feature matrix, shape (s, k) where k is number of constraints
# Used in approx_vector_cost_eval
self.Psi = np.random.randn(4, 3)
# b: constraint bounds, shape (k,)
# Used to compute gradient: b - einsum(nu0, v_c, 's, s k->k')
self.b = np.array([1.0, 2.0, 1.5])
def approx_vector_cost_eval(self, init_v_c, Psi, policy, max_iters=50, tol=1e-05, logging=False):
"""
Approximates vector cost values using Bellman iterations.
:param init_v_c: Initial constraint cost values, shape (n, k)
:param Psi: Constraint feature matrix, shape (n, k)
:param policy: Current policy, shape (n, m)
:param max_iters: Maximum iterations
:param tol: Tolerance
:param logging: Whether to log
:return: Approximate constraint cost values, shape (n, k)
"""
# Simple approximation: just return a perturbed version of init_v_c
# In reality this would iterate Bellman updates
v_c = init_v_c + np.random.randn(*init_v_c.shape) * 0.01
return v_c
# Create environment
env = MinimalGridworld()
# xi: dual variable, shape (k,) where k=3
xi = np.array([0.5, 0.3, 0.2])
# policy: Current policy, shape (n, m) where n=4 (states), m=2 (actions)
policy = np.random.dirichlet([1.0, 1.0], size=4) # shape (4, 2)
# eta: learning rate (scalar)
eta = 0.1
# init_v_c: Initial constraint cost values, shape (n, k) where n=4, k=3
init_v_c = np.random.randn(4, 3)
# max_iters: Maximum number of Bellman iterations
max_iters = 50
# tol: Tolerance for value approximation
tol = 1e-05
# threshold: Threshold for dual variable xi
threshold = float('inf')
ARGS = {
'env': env,
'xi': xi,
'policy': policy,
'eta': eta,
'init_v_c': init_v_c,
'max_iters': max_iters,
'tol': tol,
'threshold': threshold
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- einops, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple — a tuple output has no array shape of its own; none is 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
|
| NPG_update |
Not yet run unverified (harvested, no recorded run) |
andrschl/cirl/algs/cmdp.py code served (permissive licence) · get_code("244f37859a9fb194") How it ran |
| cmdp_gda |
Not yet run unverified (harvested, no recorded run) |
andrschl/cirl/algs/cmdp.py code served (permissive licence) · get_code("39359208e0f99183") How it ran |