/* global React */ const { useState, useMemo, useEffect, useRef } = React; // ============================================================ // SHARED PRIMITIVES // ============================================================ const ClassBadge = ({ cls }) => { const map = { policy: { label: 'Policy', klass: 'cls-policy' }, value: { label: 'Value', klass: 'cls-value' }, irl: { label: 'IRL', klass: 'cls-irl' }, offline: { label: 'Offline', klass: 'cls-offline' }, modelbased: { label: 'Model-Based', klass: 'cls-modelbased' }, hybrid: { label: 'Hybrid', klass: 'cls-hybrid' }, }; const c = map[cls] || { label: cls, klass: '' }; return {c.label}; }; const NNIndicator = ({ n }) => { const max = 4; return ( 1?'s':''}`}> {Array.from({ length: max }).map((_, i) => ( ))} ×{n} ); }; const StabilityBar = ({ val }) => ( {val.toFixed(2)} ); const Sparkline = ({ data, w = 70, h = 22, color }) => { if (!data || data.length < 2) return null; const min = Math.min(...data); const max = Math.max(...data); const range = max - min || 1; const pts = data.map((d, i) => { const x = (i / (data.length - 1)) * w; const y = h - ((d - min) / range) * (h - 2) - 1; return [x, y]; }); const path = 'M ' + pts.map(p => p.join(' ')).join(' L '); const area = path + ` L ${w} ${h} L 0 ${h} Z`; return ( ); }; const S2RGapDisplay = ({ val }) => { const pct = (val * 100).toFixed(1); const good = val < 0.15; const mid = val < 0.25; const color = good ? 'var(--ok)' : mid ? 'var(--accent-4)' : 'var(--bad)'; return ( {pct}% ); }; // ============================================================ // HEADER + NAV // ============================================================ const Header = ({ active, onNav, onOpenAuth, onOpenKeys }) => { const isPlayground = active === 'playground' || active === 'pg-envs' || active === 'pg-algos' || active === 'pg-sessions' || active === 'pg-train'; const isAdmin = active === 'admin'; const activePg = active === 'playground' ? 'pg-envs' : active; const [adminAuthed, setAdminAuthed] = useState(() => window.RLX_API && window.RLX_API.isAuthed()); const [currentUser, setCurrentUser] = useState(null); useEffect(() => { const handler = (e) => setAdminAuthed(e.detail.authed); window.addEventListener('rlx:auth', handler); return () => window.removeEventListener('rlx:auth', handler); }, []); useEffect(() => { const handler = (e) => setCurrentUser(e.detail?.user || null); window.addEventListener('rlx:user-auth', handler); if (window.RLX_USER_API) { window.RLX_USER_API.getCurrentUser().then(u => setCurrentUser(u)).catch(() => {}); } return () => window.removeEventListener('rlx:user-auth', handler); }, []); // RLX = results/benchmark site. Playground = separate interactive product. const tabs = isPlayground ? [ { id: 'pg-envs', label: 'Overview' }, { id: 'pg-sessions', label: 'My Sessions' }, ] : [ { id: 'home', label: 'Home' }, { id: 'leaderboards', label: 'Leaderboards' }, { id: 'docs', label: 'Docs' }, { id: 'playground', label: 'Playground Dashboard ↗' }, ]; return ( <>
{isPlayground ? ( <>OptRL ) : ( RLX )} {(isAdmin || isPlayground) && ( / {isAdmin ? 'admin' : 'playground'} )}
{isPlayground ? '“Apply algorithms. Run the envs. Publish.”' : '“From Rewards to Reality.”'}
{isAdmin ? ( <> {adminAuthed ? ( <> internal · signed in ) : ( internal · signed out )} ) : isPlayground ? ( <> session live optrl.com / playground ) : ( <> {/* Counted from the live boards, not baked in. */} live · { (() => { const s = window.RLX_STATUS; return s ? (s.paper + s.proprietary + s.playground) : 0; })() } entries indexed {currentUser ? ( <> 👤 {currentUser.display_name || currentUser.social_handle || (currentUser.email ? currentUser.email.split('@')[0] : 'User')} ) : ( )} )}
{!isAdmin && ( )} ); }; // ============================================================ // LEADERBOARDS // // One table, three boards. The column set is exactly the RLX CSV // contract (docs/RLX/rl_benchmarks_comparison-v3.csv) and nothing // else: Research, OptRL and Playground are field-identical by // construction because they render the same component. // // Every column below maps 1:1 to an API field. Nothing here is // derived, inferred or computed from another column: if the source // didn't report it, the cell shows a dash rather than a zero. // ============================================================ // "not reported": never render a missing measurement as 0. const Dash = () => -; const Num = ({ v, digits = 2 }) => ( v === null || v === undefined || Number.isNaN(v) ? : <>{Number(v).toLocaleString(undefined, { maximumFractionDigits: digits })} ); const Pct = ({ v }) => ( v === null || v === undefined ? : <>{Number(v).toFixed(1)}% ); // Training Steps keeps its unit: 40M Atari frames is not 1M gradient // steps, and the board must not imply they are comparable. const Steps = ({ raw, n, unit }) => { if (!raw && n === null) return ; const label = raw || Number(n).toLocaleString(); const suffix = unit && unit !== 'steps' ? unit.replace(/_/g, ' ') : null; return ( {label} {suffix && ( {suffix} )} ); }; const EmptyBoard = ({ lane }) => { const copy = { paper: ['No research benchmarks yet.', 'An admin loads these from a CSV in RLX Admin → Upload Sheet.'], proprietary: ['No OptRL benchmarks yet.', 'An admin loads these from a CSV in RLX Admin → Upload Sheet.'], playground: ['No published runs yet.', 'Runs appear here once a Playground session is published and approved.'], }[lane]; return (
{copy[0]}
{copy[1]}
); }; const Leaderboards = ({ board, setBoard, sortKey, setSortKey, onPublish }) => { const [sortDir, setSortDir] = useState('desc'); const [fSuite, setFSuite] = useState('all'); const [fType, setFType] = useState('all'); const [fEnv, setFEnv] = useState('all'); const D = window.RLX_DATA; const lanes = { published: { key: 'paper', rows: D.researchRows || [], label: 'Research Benchmarks' }, optrl: { key: 'proprietary', rows: D.optrlRows || [], label: 'OptRL Benchmarks' }, playground: { key: 'playground', rows: D.playgroundRows || [], label: 'Playground Benchmarks' }, }; // Reset filters when switching boards: a suite that exists on one // board usually doesn't on another, and a stale filter reads as // "this board is empty". useEffect(() => { setFSuite('all'); setFType('all'); setFEnv('all'); }, [board]); const boards = [ { id: 'published', label: 'Research Benchmarks', count: lanes.published.rows.length }, { id: 'optrl', label: 'OptRL Benchmarks', count: lanes.optrl.rows.length }, { id: 'playground', label: 'Playground Benchmarks', count: lanes.playground.rows.length }, ]; const active = lanes[board] || lanes.published; return (

Benchmarks // three sources, one field set

A living record of reinforcement-learning performance across published research, OptRL proprietary experiments, and community-submitted runs from the OptRL Playground.
{boards.map(b => ( ))}
); }; const BoardTable = ({ lane, rows, sortKey, setSortKey, sortDir, setSortDir, fSuite, setFSuite, fType, setFType, fEnv, setFEnv, onPublish, }) => { const uniq = (k) => [...new Set(rows.map(r => r[k]).filter(Boolean))].sort(); const suites = useMemo(() => uniq('benchmark_suite'), [rows]); const types = useMemo(() => uniq('learning_type'), [rows]); const envs = useMemo(() => uniq('environment'), [rows]); const filtered = useMemo(() => { let r = rows.filter(x => (fSuite === 'all' || x.benchmark_suite === fSuite) && (fType === 'all' || x.learning_type === fType) && (fEnv === 'all' || x.environment === fEnv)); const dir = sortDir === 'desc' ? -1 : 1; r = [...r].sort((a, b) => { const va = a[sortKey], vb = b[sortKey]; // "Not reported" always sorts last, in both directions: the // same rule the API applies with NULLS LAST. const na = va === null || va === undefined; const nb = vb === null || vb === undefined; if (na && nb) return 0; if (na) return 1; if (nb) return -1; if (typeof va === 'number' && typeof vb === 'number') return (va - vb) * dir; return String(va).localeCompare(String(vb)) * dir; }); return r; }, [rows, fSuite, fType, fEnv, sortKey, sortDir]); const toggleSort = (k) => { if (sortKey === k) setSortDir(sortDir === 'desc' ? 'asc' : 'desc'); else { setSortKey(k); setSortDir('desc'); } }; const arrow = (k) => sortKey === k ? {sortDir === 'desc' ? '▼' : '▲'} : null; const th = (k, label, numeric) => ( toggleSort(k)} className={`${numeric ? 'num ' : ''}${sortKey === k ? 'sorted' : ''}`} style={{ cursor: 'pointer' }}> {label} {arrow(k)} ); if (rows.length === 0) { return ( <> {lane === 'playground' && (
verified community submissions only
)} ); } // The last column is the row's provenance. For uploaded boards // that's the citation the sheet carried; for Playground it's the // submitter, which is the same idea: who this result came from. const provenanceHead = lane === 'playground' ? 'Submitted By' : 'Primary Citation'; return ( <>
Suite
Learning type
Env
{lane === 'playground' && ( )} showing {filtered.length} of {rows.length}
{th('algorithm', 'Algorithm')} {th('environment', 'Environment')} {th('learning_type', 'Learning Type')} {th('benchmark_suite', 'Benchmark Suite')} {th('mean_reward', 'Mean Reward', true)} {th('std_reward', 'Stability (SD/SE)', true)} {th('success_rate', 'Success Rate', true)} {th('n_timesteps', 'Training Steps', true)} {th('min_reward', 'Min Reward', true)} {th('max_reward', 'Max Reward', true)} {filtered.map((r, i) => ( ))}
#{provenanceHead}
{i + 1}
{r.algorithm}
{r.environment} {r.learning_type || } {r.benchmark_suite || } {lane === 'playground' ? (r.submitted_by ? {r.submitted_by.handle_short} : ) : (r.paper_reference || )}
); }; Object.assign(window, { Header, Leaderboards, ClassBadge, NNIndicator, StabilityBar, Sparkline, S2RGapDisplay });