From 408390336f66866cd5f388e91bd00bfc6826f470 Mon Sep 17 00:00:00 2001 From: Matthew Bowers Date: Wed, 6 Sep 2023 09:50:59 -0400 Subject: [PATCH] add structure penalty --- src/compression.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compression.rs b/src/compression.rs index 731f6fcf..6d770195 100644 --- a/src/compression.rs +++ b/src/compression.rs @@ -201,6 +201,11 @@ pub struct CompressionStepConfig { #[clap(long)] pub no_other_util: bool, + /// DreamCoder style structure penalty - must be positive. Overall utility is this + /// difference in corpus size minus structure_penalty * abstraction_size + #[clap(long, default_value = "1.0")] + pub structure_penalty: f32, + /// Used for soundness testing. Whenever you finish an invention do a full rewrite to check /// that rewriting doesnt raise a cost mismatch exception. #[clap(long)] @@ -1492,7 +1497,7 @@ fn noncompressive_utility( // this is a bit like the structure penalty from dreamcoder except that // that penalty uses inlined versions of nested inventions. // 0 - - body_utility + - (body_utility as f32 * cfg.structure_penalty) as i32 } /// This takes a partial invention and gives an upper bound on the maximum