Skip to content

Commit

Permalink
Merge pull request #174 from mlb2251/structure_penalty
Browse files Browse the repository at this point in the history
add structure penalty
  • Loading branch information
mlb2251 authored Nov 26, 2023
2 parents 1169764 + 5413693 commit 2b72642
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2b72642

Please sign in to comment.