/** * SAFE OPTIMIZATION — find the best, but never cross a line you can't cross. Real processes are never "just * maximise" — they're "maximise yield WHILE cost stays under budget, toxicity under the safety limit, * temperature under what the vessel can hold." A naive optimizer happily proposes the brilliant-but-illegal * setting that melts the reactor. Competitors (Ax/BoTorch constraints, SafeOpt) handle this; Melete now does * too — with a twist no one else ships: a SAFETY-MARGIN CERTIFICATE. * * Two parts: * • bestFeasible — the best-scoring setting that satisfies EVERY constraint, alongside the (better but * forbidden) unconstrained best, so you see exactly what safety costs you; plus, for the chosen recipe, * how far it sits inside each limit — a warranty: "cost 15 (limit 20, 25% margin), toxicity 0.3 (limit * 0.5, 40% margin)." * • proposeNextSafe — the next experiment that is both high-potential AND predicted-feasible, learning the * forbidden region from your labelled runs so it steers away from settings likely to violate a limit. * * Honest by construction (DIAKRISIS): feasibility is read from the constraint values YOU measured (a setting * is feasible iff its measured metrics satisfy the limits — no guessing about the recipe you pick); the * safe-proposal's feasibility is a distance-weighted estimate from your labelled points (it steers away from * known-unsafe regions, it does not certify an unmeasured point is safe — that's what the experiment is * for). It abstains when there's nothing to stand on. */ import { type Space, type Experiment } from "./space.js"; import { type Observation, type Goal } from "./engine.js"; export type CObs = Observation & { metrics?: Record; }; export interface Constraint { name: string; max?: number; min?: number; } export interface MarginItem { name: string; value: number; limit: number; bound: "max" | "min"; marginPct: number; } export interface FeasibleReport { best: CObs | null; unconstrainedBest: CObs | null; safetyCost: number; feasibilityRate: number; margins: MarginItem[]; note: string; } /** The best setting that satisfies every constraint, plus its safety margins. */ export declare function bestFeasible(obs: ReadonlyArray, goal: Goal, cons: ReadonlyArray): FeasibleReport; /** Propose the next experiment that is high-potential AND predicted to stay within the limits. */ export declare function proposeNextSafe(space: Space, obs: ReadonlyArray, goal: Goal, cons: ReadonlyArray, seed?: number): Experiment; export declare function constrainedGauntlet(): { score: 0 | 100; checks: Array<{ name: string; pass: boolean; detail: string; }>; }; //# sourceMappingURL=constrained.d.ts.map