Skip to content

Commit 26344aa

Browse files
salim4nkhayonclaude
authored
Dock spatial : réseau de neurones DQN entraînable dans le navigateur + agent pré-entraîné (#96)
* build(demo-space-dock): wire workspace TF.js backend without new npm packages Adds @ignitionai/backend-tfjs (workspace) and @tensorflow/tfjs (4.22.0, already locked for other demos) to the dock demo, with the same source aliases as demo-ball-thrust. Lockfile diff is limited to the importer entries. Drops an unused type import in backend-tfjs/src/defaults.ts so the demo's strict tsc (noUnusedLocals) can typecheck the backend sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(demo-space-dock): DockTrainingEnv, bounded reward and seeded episodes for DQN Wraps SpaceDockEnv (physics unchanged) as a TrainingEnv: 26 normalized observations, 8 discrete actions, dense reward clipped to [-1,1] plus collision/terminal terms (bounds [-12, 11]), success/collision/bounds as termination, 300-decision horizon as truncation, deterministic seed sequence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(demo-space-dock): in-browser DQN training panel and greedy agent mode TrainingSession (IgnitionEnvTFJS + DQNAgent, CPU backend) runs time-boxed chunks so rendering continues; start/pause/resume/reset, real Keras loss, moving-average reward curve, docking success rates, greedy inference, tfjs JSON export/import. DockRuntime yields the shared world while the network drives; manual and scripted PD remain available. TF.js loads in a lazy chunk after the scene. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(space-dock): list DQN in the catalogue and add a short training section FR/EN demos.json algos become "DQN · Manuel · PD non entraîné"; blog metadata and both tutorials describe the in-browser DQN (environment, reward, episode, controls) without any convergence figure. Registry test also requires DQN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(demo-space-dock): keep the cadence selector inside the panel on narrow screens Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(demo-space-dock): training recipe that docks: curriculum starts, potential shaping Measured headless (seed 118, 20 greedy episodes every 2,000 steps): the first recipe never docked in 40,000 steps. This one (training-only curriculum of starts at rest on the docking axis 0.5-13 m from the dock, potential-difference shaping, epsilon decay 0.9999, target update 1000) reached 20/20 from the standard start at 32,000 steps; rerun bit-identical. Physics, actions and the IGN-118 docking criterion are unchanged; SpaceDockEnv.placeOnAxis only places the pair before the first step. Watching always uses the standard start. Session can import a shipped model with a validated provenance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(demo-space-dock): optional agent pre-trained offline, with measured provenance "Charger un agent pré-entraîné" lazy-loads src/pretrained/space-dock-dqn.json (36 KB, tfjs JSON): 32,000 DQN steps with the a07d1d7 recipe, seed 118, reproduced bit-identically; 50/50 greedy dockings from the standard start on unseen seeds (50000...), mean final distance 0.29 m. The panel shows that provenance from the file; a visitor's own import never does. Live training and Reset network stay available. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(space-dock): curriculum, measured offline results and pre-trained agent FR/EN Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(demo-space-dock): French decimal separator in the pre-trained provenance Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(space-dock): use the sourced in-browser throughput (65-104 steps/s), fix FR comma Replaces the unsourced ~100 steps/s figure and the unproven 'slower with the scene' claim with Talos's acceptance measurement (local prod build, Chromium, with the scene). The five-minute minimum follows from 32,000 / 104. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: khayon <khayon@ignitionai.local> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 39c8ae8 commit 26344aa

25 files changed

Lines changed: 1191 additions & 26 deletions

‎packages/backend-tfjs/src/defaults.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { AlgorithmType } from '@ignitionai/core';
2-
31
export const DQN_DEFAULTS: Record<string, unknown> = {
42
hiddenLayers: [64, 64],
53
gamma: 0.99,

‎packages/demo-space-dock/package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
},
1313
"dependencies": {
1414
"@dimforge/rapier3d-compat": "0.15.0",
15+
"@ignitionai/backend-tfjs": "workspace:*",
1516
"@ignitionai/core": "workspace:*",
1617
"@react-three/fiber": "^9.1.2",
18+
"@tensorflow/tfjs": "^4.22.0",
1719
"react": "^19.0.0",
1820
"react-dom": "^19.0.0",
1921
"three": "^0.162.0"

‎packages/demo-space-dock/src/App.tsx‎

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ import { useEffect, useState } from 'react';
22
import Scene from './scene-adapter';
33
import Hud from './Hud';
44
import { SpaceDockEnv } from './space-dock-env';
5+
import type { TrainingSession } from './training-session';
6+
import type { TrainingPanel as Panel } from './TrainingPanel';
57
import { DockRuntime } from './runtime';
68
import { attachControls } from './controls';
79
import { ACTIONS } from './simulation-contract';
810
import type { Action } from './simulation-contract';
911

1012
type Loading = { status: 'loading' } | { status: 'error'; message: string } | { status: 'ready'; runtime: DockRuntime };
13+
type Learning = { status: 'loading' } | { status: 'error'; message: string } | { status: 'ready'; session: TrainingSession; Panel: typeof Panel };
1114
const SHORTCUTS = ['X', 'W / ↑', 'S / ↓', 'A / ←', 'D / →', 'Q', 'E', 'Espace'];
1215
function useMediaQuery(query: string) {
1316
const [matches, setMatches] = useState(() => window.matchMedia(query).matches);
@@ -24,19 +27,27 @@ export default function App() {
2427
const compact = useMediaQuery('(max-width: 600px)');
2528
const reducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');
2629
const [loading, setLoading] = useState<Loading>({ status: 'loading' });
30+
const [learning, setLearning] = useState<Learning>({ status: 'loading' });
2731
const [, repaint] = useState(0);
2832
const [seed, setSeed] = useState('42');
2933
const [inputError, setInputError] = useState('');
3034
const publish = () => repaint(value => value + 1);
3135
useEffect(() => {
32-
let alive = true, owner: DockRuntime | undefined, frame = 0;
36+
let alive = true, owner: DockRuntime | undefined, trainer: TrainingSession | undefined, frame = 0;
3337
let detach: (() => void) | undefined;
3438
void SpaceDockEnv.create(42).then(env => {
3539
if (!alive) { env.dispose(); return; }
3640
const runtime = new DockRuntime(env); owner = runtime;
3741
detach = attachControls(runtime, window, document, publish);
3842
if (document.hidden) runtime.setPaused(true);
3943
setLoading({ status: 'ready', runtime });
44+
void import('./learning').then(async ({ startLearning, TrainingPanel }) => {
45+
if (!alive) return;
46+
const session = await startLearning(env, runtime);
47+
if (!alive) { void session.dispose(); return; }
48+
trainer = session; session.onChange = () => { if (alive) publish(); };
49+
setLearning({ status: 'ready', session, Panel: TrainingPanel });
50+
}).catch((error: unknown) => { if (alive) setLearning({ status: 'error', message: String(error) }); });
4051
let previous: number | undefined;
4152
const animate = (now: number) => {
4253
if (!alive) return;
@@ -51,12 +62,24 @@ export default function App() {
5162
};
5263
frame = requestAnimationFrame(animate);
5364
}).catch((error: unknown) => { if (alive) setLoading({ status: 'error', message: String(error) }); });
54-
return () => { alive = false; cancelAnimationFrame(frame); detach?.(); owner?.dispose(); };
65+
return () => {
66+
alive = false; cancelAnimationFrame(frame); detach?.();
67+
// The session stops after any in-flight fit, then the runtime frees the shared Rapier world.
68+
const runtime = owner;
69+
void (trainer ? trainer.dispose() : Promise.resolve()).finally(() => runtime?.dispose());
70+
};
5571
}, []);
5672
if (loading.status === 'loading') return <main><h1>Dock spatial</h1><p role="status">Initialisation Rapier WASM…</p></main>;
5773
if (loading.status === 'error') return <main><h1>Dock spatial</h1><p role="alert">Initialisation ou simulation interrompue : {loading.message}</p></main>;
5874
const { runtime } = loading;
75+
const session = learning.status === 'ready' ? learning.session : undefined;
76+
const snapshot = session?.snapshot();
77+
const external = runtime.isExternal;
5978
const change = (action: () => void) => { action(); publish(); };
79+
// Manual and PD stay available as references: choosing one hands the dock back from the network.
80+
const choose = (mode: 'manual' | 'auto') => {
81+
void (session?.stop() ?? Promise.resolve()).then(() => change(() => runtime.setMode(mode)));
82+
};
6083
const reset = () => {
6184
try {
6285
if (seed.trim() === '') throw new RangeError('Graine uint32 requise');
@@ -67,21 +90,23 @@ export default function App() {
6790
<header><p className="eyebrow">Démo · physique Rapier</p><h1>Dock spatial</h1>
6891
<p className="temporary">Modèles 3D originaux sous licence MIT ; voir les <a href={`${(import.meta as ImportMeta & { env: { BASE_URL: string } }).env.BASE_URL}models/LICENSE.txt`}>mentions de licence</a>.</p>
6992
<p>Transportez le cargo vers le poste d’arrimage ; le témoin devient vert au succès. La poussée change la vitesse ; anticipez le freinage.</p>
70-
<strong>{runtime.currentMode === 'auto' ? 'AUTO DÉMO — PD SCRIPTÉ, NON ENTRAÎNÉ' : 'MANUEL — 8 ACTIONS'}</strong>
93+
<p>Vous pouvez aussi entraîner un réseau de neurones (DQN) dans ce navigateur, puis le regarder piloter le remorqueur.</p>
94+
<strong>{external ? (snapshot?.mode === 'inference' || snapshot?.resumeMode === 'inference' ? 'AGENT DQN — INFÉRENCE SANS EXPLORATION' : 'ENTRAÎNEMENT DQN — EXPLORATION ε')
95+
: runtime.currentMode === 'auto' ? 'AUTO DÉMO — PD SCRIPTÉ, NON ENTRAÎNÉ' : 'MANUEL — 8 ACTIONS'}</strong>
7196
</header>
7297
<div className="toolbar">
73-
<button onClick={() => change(() => runtime.setMode('manual'))} aria-pressed={runtime.currentMode === 'manual'}>Manuel</button>
74-
<button onClick={() => change(() => runtime.setMode('auto'))} aria-pressed={runtime.currentMode === 'auto'}>Autodémo scriptée</button>
75-
<button onClick={() => change(() => runtime.setPaused(!runtime.isPaused))}>{runtime.isPaused ? 'Reprendre' : 'Pause'} (P)</button>
98+
<button onClick={() => choose('manual')} aria-pressed={!external && runtime.currentMode === 'manual'}>Manuel</button>
99+
<button onClick={() => choose('auto')} aria-pressed={!external && runtime.currentMode === 'auto'}>Autodémo scriptée</button>
100+
<button disabled={external} onClick={() => change(() => runtime.setPaused(!runtime.isPaused))}>{runtime.isPaused ? 'Reprendre' : 'Pause'} (P)</button>
76101
<label>Graine uint32 <input value={seed} inputMode="numeric" onChange={e => setSeed(e.target.value)} /></label>
77-
<button onClick={reset}>Reset seedé</button>
102+
<button disabled={external} onClick={reset}>Reset seedé</button>
78103
</div>
79104
{inputError && <p role="alert">{inputError}</p>}
80105
<div className="viewport" style={{ minHeight: compact ? 320 : 460 }} aria-label="Vue 3D du cargo, du remorqueur et du dock ; télémétrie textuelle ci-dessous">
81106
<Scene env={runtime.env} compact={compact} reducedMotion={reducedMotion} />
82107
</div>
83108
<div className="controls" aria-label="Commandes de poussée">
84-
{ACTIONS.map((label, index) => <button key={label} disabled={runtime.isPaused || runtime.currentMode !== 'manual' || runtime.env.done()}
109+
{ACTIONS.map((label, index) => <button key={label} disabled={external || runtime.isPaused || runtime.currentMode !== 'manual' || runtime.env.done()}
85110
onPointerDown={event => { event.preventDefault(); event.currentTarget.setPointerCapture(event.pointerId); runtime.press(`pointer-${event.pointerId}`, index as Action); }}
86111
onPointerUp={event => runtime.release(`pointer-${event.pointerId}`)} onPointerCancel={event => runtime.release(`pointer-${event.pointerId}`)}
87112
onLostPointerCapture={event => runtime.release(`pointer-${event.pointerId}`)}
@@ -90,7 +115,11 @@ export default function App() {
90115
{label}<small>{SHORTCUTS[index]}</small>
91116
</button>)}
92117
</div>
93-
<p>P : pause · R : rejouer la graine courante. Perte de focus ou onglet masqué : commandes effacées et pause ; reprise explicite.</p>
118+
<p>P : pause · R : rejouer la graine courante. Perte de focus ou onglet masqué : commandes effacées et pause ; reprise explicite.
119+
Pendant l’entraînement ou l’inférence, le réseau pilote seul : commandes manuelles, pause et reset du runtime sont inactifs.</p>
120+
{learning.status === 'ready' && snapshot ? <learning.Panel session={learning.session} snapshot={snapshot} />
121+
: learning.status === 'error' ? <p role="alert">Entraînement indisponible : {learning.message}</p>
122+
: <p role="status">Chargement de TensorFlow.js pour l’entraînement…</p>}
94123
<Hud runtime={runtime} />
95124
</main>;
96125
}

‎packages/demo-space-dock/src/Hud.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ export default function Hud({ runtime }: { runtime: DockRuntime }) {
2525
couple {P.torque} Nm. Frein : −840 v, −1315 ω, bornés à 600 N / 300 Nm.</p>
2626
<p>PD NON ENTRAÎNÉ : Kp {PD_GAINS.position}, Kd {PD_GAINS.velocity}, lacet Kp {PD_GAINS.yaw}, Kd {PD_GAINS.angularVelocity}.
2727
Qualification limitée aux départs axiaux seedés, sans évitement d’obstacles.</p>
28-
<p>Contrat TrainingEnv disponible : 26 observations normalisées, 8 actions discrètes.
29-
Aucun entraînement ni checkpoint livré. Récompense : progression signée + orientation, coûts temps/poussée/contact, bonus terminal unique.</p>
28+
<p>Contrat TrainingEnv : 26 observations normalisées, 8 actions discrètes. Le panneau DQN entraîne un réseau dans ce navigateur
29+
via DockTrainingEnv (récompense bornée, épisode de 30 s simulées, collision = échec). Un agent pré-entraîné hors ligne peut être chargé depuis ce panneau.
30+
Récompense de cette télémétrie (runtime manuel / PD) : progression signée + orientation, coûts temps/poussée/contact, bonus terminal unique.</p>
3031
</details>
3132
<details><summary>Historique des 64 dernières transitions</summary><ol>
3233
{runtime.history.map((r, i) => <li key={`${r.elapsed}-${i}`}>{r.elapsed.toFixed(2)} s · {ACTIONS[r.action]} · r={r.reward.toFixed(4)}</li>)}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import { useRef, useState } from 'react';
2+
import * as tf from '@tensorflow/tfjs';
3+
import { DQN_CONFIG, SESSION_DEFAULTS } from './training-session';
4+
import type { SessionSnapshot, TrainingSession } from './training-session';
5+
import { TRAINING_ENV } from './dock-training-env';
6+
7+
const MODE_LABELS = {
8+
idle: 'Réseau à l’arrêt — manuel / PD actifs',
9+
training: 'Entraînement DQN (exploration ε)',
10+
inference: 'Regarder l’agent — poids figés, sans exploration',
11+
paused: 'En pause',
12+
} as const;
13+
const OUTCOMES = { success: 'arrimé', collision: 'collision', bounds: 'hors limites', nonfinite: 'non fini', timeout: 'temps écoulé' } as const;
14+
const percent = (value: number | null) => value === null ? '—' : `${(value * 100).toFixed(0)} %`;
15+
16+
/** Live counters of the real session; nothing here is estimated or pre-recorded. */
17+
export function TrainingPanel({ session, snapshot: state }: { session: TrainingSession; snapshot: SessionSnapshot }) {
18+
const [commandError, setCommandError] = useState('');
19+
const file = useRef<HTMLInputElement>(null);
20+
const invoke = (operation: () => Promise<unknown>) => {
21+
setCommandError('');
22+
void operation().catch((reason: unknown) => setCommandError(reason instanceof Error ? reason.message : String(reason)));
23+
};
24+
const download = () => invoke(async () => {
25+
const blob = new Blob([await session.exportModel()], { type: 'application/json' });
26+
const url = URL.createObjectURL(blob), link = document.createElement('a');
27+
link.href = url; link.download = `space-dock-dqn-${state.trainingSteps}.json`; link.click();
28+
setTimeout(() => URL.revokeObjectURL(url), 0);
29+
});
30+
// The shipped weights stay out of the main bundle until the visitor asks for them.
31+
const loadPretrained = () => invoke(async () => {
32+
const { default: file } = await import('./pretrained/space-dock-dqn.json');
33+
await session.importModel(JSON.stringify(file), { pretrained: true });
34+
});
35+
const upload = (input: HTMLInputElement) => {
36+
const chosen = input.files?.[0]; input.value = '';
37+
if (chosen) invoke(async () => session.importModel(await chosen.text()));
38+
};
39+
const curve = state.curve, low = Math.min(0, ...curve), spread = Math.max(1, ...curve) - low;
40+
const points = curve.map((value, index) => `${(index / Math.max(1, curve.length - 1) * 600).toFixed(1)},${(84 - (value - low) / spread * 76).toFixed(1)}`).join(' ');
41+
const zero = 84 - (0 - low) / spread * 76;
42+
const latest = state.recentEpisodes.at(-1);
43+
const running = state.mode === 'training' || state.mode === 'inference';
44+
const error = commandError || state.error;
45+
const layers = [DQN_CONFIG.inputSize, ...(DQN_CONFIG.hiddenLayers ?? []), DQN_CONFIG.actionSize];
46+
return <section className="learning" aria-label="Entraînement DQN">
47+
<div className="learning-heading">
48+
<div><p className="eyebrow">RÉSEAU DE NEURONES / DQN · TF.js {tf.getBackend()}</p><h2>{layers.join(' → ')}</h2></div>
49+
<p role="status" data-testid="session-mode">{state.busy ? 'Opération en cours…' : MODE_LABELS[state.mode]}</p>
50+
</div>
51+
<div className="toolbar">
52+
<button data-testid="train" disabled={state.busy || state.mode === 'training'} onClick={() => invoke(() => session.train())}>
53+
{state.mode === 'paused' && state.resumeMode === 'training' ? 'Reprendre l’entraînement' : state.trainingSteps ? 'Continuer l’entraînement' : 'Démarrer l’entraînement'}</button>
54+
<button data-testid="pause" disabled={state.busy || !running} onClick={() => invoke(() => session.pause())}>Pause</button>
55+
<button data-testid="watch" disabled={state.busy || state.mode === 'inference'} onClick={() => invoke(() => session.watch())}>Regarder l’agent</button>
56+
<button data-testid="stop" disabled={state.busy || state.mode === 'idle'} onClick={() => invoke(() => session.stop())}>Rendre la main (manuel / PD)</button>
57+
<button data-testid="reset-network" disabled={state.busy} onClick={() => invoke(() => session.reset())}>Réinitialiser le réseau</button>
58+
<label>Cadence <select data-testid="cadence" value={state.chunkMs} onChange={event => session.setChunkBudget(Number(event.currentTarget.value))}>
59+
<option value={SESSION_DEFAULTS.chunkMs}>Fluide ({SESSION_DEFAULTS.chunkMs} ms par tranche)</option>
60+
<option value={SESSION_DEFAULTS.fastChunkMs}>Rapide ({SESSION_DEFAULTS.fastChunkMs} ms, rendu moins fluide)</option>
61+
</select></label>
62+
</div>
63+
<dl className="metrics">
64+
<div><dt>Pas d’entraînement</dt><dd data-testid="train-steps">{state.trainingSteps.toLocaleString('fr-FR')}</dd></div>
65+
<div><dt>Épisodes d’entraînement</dt><dd data-testid="episodes">{state.episodes}</dd></div>
66+
<div><dt>Taux d’arrimage ({SESSION_DEFAULTS.successWindow} derniers)</dt><dd data-testid="success-recent">{percent(state.recentSuccessRate)}</dd></div>
67+
<div><dt>Taux d’arrimage global</dt><dd data-testid="success-rate">{percent(state.successRate)} <small>({state.successes}/{state.episodes})</small></dd></div>
68+
<div><dt>Exploration ε</dt><dd data-testid="epsilon">{state.epsilon.toFixed(3)}</dd></div>
69+
<div><dt>Mises à jour du réseau</dt><dd data-testid="updates">{state.updates}</dd></div>
70+
<div><dt>Perte (dernier lot)</dt><dd data-testid="loss">{state.lastLoss === null ? '—' : state.lastLoss.toExponential(2)}</dd></div>
71+
<div><dt>Épisode en cours</dt><dd data-testid="episode-now">{state.episodeSteps} / {TRAINING_ENV.maxSteps} pas · {state.episodeReturn.toFixed(2)}</dd></div>
72+
<div><dt>Agent regardé</dt><dd data-testid="inference">{state.inferenceSteps} pas · {state.inferenceSuccesses}/{state.inferenceEpisodes} arrimés</dd></div>
73+
</dl>
74+
<div className="reward-chart">
75+
<p>Récompense moyenne (fenêtre glissante de {SESSION_DEFAULTS.curveWindow} épisodes){latest ? ` · dernier épisode : ${latest.return.toFixed(2)}, ${OUTCOMES[latest.outcome]}` : ' · aucun épisode terminé'}</p>
76+
{curve.length > 1
77+
? <svg viewBox="0 0 600 90" role="img" aria-label={`Récompense moyenne glissante sur ${curve.length} épisodes, dernière valeur ${curve.at(-1)!.toFixed(2)}`}>
78+
<line x1="0" x2="600" y1={zero} y2={zero} stroke="#425667" strokeDasharray="4 4" />
79+
<polyline points={points} fill="none" stroke="#8ee8cc" strokeWidth="2" /></svg>
80+
: <p>La courbe apparaît après deux épisodes terminés.</p>}
81+
</div>
82+
<div className="toolbar">
83+
<button data-testid="pretrained" disabled={state.busy} onClick={loadPretrained}>Charger un agent pré-entraîné</button>
84+
<button data-testid="export" disabled={state.busy} onClick={download}>Exporter le modèle (JSON TF.js)</button>
85+
<button data-testid="import" disabled={state.busy} onClick={() => file.current?.click()}>Importer un modèle</button>
86+
<input ref={file} type="file" accept="application/json,.json" hidden onChange={event => upload(event.currentTarget)} />
87+
</div>
88+
{state.notice && <p role="status">{state.notice}</p>}
89+
{state.provenance && <p data-testid="provenance">Agent entraîné hors ligne par IgnitionAI, avec cette même démo en Node.js sans rendu :
90+
{' '}{state.provenance.trainingSteps.toLocaleString('fr-FR')} pas DQN (graine {state.provenance.seed}
91+
{state.provenance.curriculum ? `, départs d’entraînement entre ${state.provenance.curriculum[0].toLocaleString('fr-FR')} et ${state.provenance.curriculum[1].toLocaleString('fr-FR')} m` : ''}).
92+
{' '}Mesure greedy avant publication : {Math.round(state.provenance.evaluation.successRate * state.provenance.evaluation.episodes)}/{state.provenance.evaluation.episodes} arrimages
93+
{' '}depuis le départ standard (graines à partir de {state.provenance.evaluation.firstSeed}), distance finale moyenne {state.provenance.evaluation.meanFinalDistance.toLocaleString('fr-FR', { maximumFractionDigits: 2 })} m.
94+
{' '}Recette : commit {state.provenance.commit}, {state.provenance.date}. Cliquez « Regarder l’agent » pour le voir piloter ; « Réinitialiser le réseau » repart de zéro pour l’entraîner vous-même.</p>}
95+
{state.nonFiniteLosses > 0 && <p role="alert">Perte non finie observée {state.nonFiniteLosses} fois : réinitialisez le réseau.</p>}
96+
{error && <p role="alert">{error}</p>}
97+
<details><summary>Ce que fait l’entraînement</summary>
98+
<p>Le réseau reçoit les 26 observations normalisées du dock et choisit l’une des 8 actions toutes les 0,1 s simulées.
99+
Récompense par pas : variation d’un potentiel (distance au poste, alignement du lacet, vitesse près du poste) moins un léger coût de temps,
100+
bornée à [−1, 1] ; −1 par contact ; +10 à l’arrimage ; −10 en cas de collision ou de sortie des limites.
101+
Un épisode dure au plus {TRAINING_ENV.maxSteps} décisions ({TRAINING_ENV.maxSteps / 10} s simulées).</p>
102+
<p>Curriculum : pendant l’entraînement, chaque épisode part à l’arrêt sur l’axe du poste, à une distance tirée
103+
{state.curriculum ? ` entre ${state.curriculum[0].toLocaleString('fr-FR')} et ${state.curriculum[1].toLocaleString('fr-FR')} m` : ''}.
104+
« Regarder l’agent » part toujours du départ standard. Le critère d’arrimage ne change pas.</p>
105+
<p>Le calcul tourne dans ce navigateur, sur le processeur, par tranches de {SESSION_DEFAULTS.chunkMs} ms pour laisser la scène s’afficher.
106+
Aucune convergence n’est garantie : la courbe et les taux affichés sont ceux des épisodes réellement joués ici. L’agent pré-entraîné est un résultat mesuré hors ligne, pas une promesse pour votre propre entraînement.
107+
L’export contient les poids du réseau, pas le replay ni l’état de l’optimiseur.</p>
108+
</details>
109+
</section>;
110+
}

0 commit comments

Comments
 (0)