Discovery (§8/§16): add Pareto-frontier construction over the multi-objective candidate score vector (DiscoveryResult.frontier + pareto_frontier()), opt-in regime segmentation (result.regimes), and bootstrap uncertainty attachment; CLI --pareto/--regimes flags. Benchmarks: a real generate->run->score->classify execution engine driving the compiled CLI (9 supported cases end-to-end, 21 honest capability boundaries). Rust workspace 329->342 tests; benchmarks +8 tests. clippy -D warnings clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43 lines
1.3 KiB
Rust
43 lines
1.3 KiB
Rust
use std::fs;
|
|
|
|
use lawsynth_bundle::write_discrete_world;
|
|
use lawsynth_cli::run;
|
|
use lawsynth_core::Identifier;
|
|
use lawsynth_expr::Expr;
|
|
use lawsynth_world::{DiscreteLaw, DiscreteWorld, Variable, VariableRole};
|
|
|
|
fn id(value: &str) -> Identifier {
|
|
Identifier::new(value).unwrap()
|
|
}
|
|
|
|
#[test]
|
|
fn discrete_command_simulates_a_serialized_world() {
|
|
let directory = std::env::temp_dir().join(format!(
|
|
"lawsynth-cli-discrete-{}-{}",
|
|
std::process::id(),
|
|
std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos()
|
|
));
|
|
fs::create_dir_all(&directory).unwrap();
|
|
let bundle = directory.join("recurrence.lsworld");
|
|
let world = DiscreteWorld::new(
|
|
[Variable::new(id("x"), VariableRole::State)],
|
|
[],
|
|
[DiscreteLaw::new(id("x"), Expr::sum(Expr::symbol(id("x")), Expr::constant(1.0)))],
|
|
)
|
|
.unwrap();
|
|
write_discrete_world(&bundle, &world).unwrap();
|
|
|
|
let output = run(&[
|
|
"simulate-discrete".to_owned(),
|
|
bundle.display().to_string(),
|
|
"--initial".to_owned(),
|
|
"x=2".to_owned(),
|
|
"--steps".to_owned(),
|
|
"3".to_owned(),
|
|
])
|
|
.unwrap();
|
|
|
|
assert_eq!(output.lines().last().unwrap(), "3.00000000000000000e0,5.00000000000000000e0");
|
|
fs::remove_dir_all(directory).unwrap();
|
|
}
|