Skip to content

Commit

Permalink
Fix/simulator failure min max (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock authored Dec 16, 2024
1 parent 359744c commit ae006b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fsrs"
version = "1.4.4"
version = "1.4.5"
authors = ["Open Spaced Repetition"]
categories = ["algorithms", "science"]
edition = "2021"
Expand Down
7 changes: 5 additions & 2 deletions src/optimal_retention.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ fn stability_after_success(w: &[f32], s: f32, r: f32, d: f32, rating: usize) ->
}

fn stability_after_failure(w: &[f32], s: f32, r: f32, d: f32) -> f32 {
(w[11] * d.powf(-w[12]) * ((s + 1.0).powf(w[13]) - 1.0) * f32::exp((1.0 - r) * w[14]))
.clamp(S_MIN, s / (w[17] * w[18]).exp())
let new_s_min = s / (w[17] * w[18]).exp();
let new_s =
(w[11] * d.powf(-w[12]) * ((s + 1.0).powf(w[13]) - 1.0) * f32::exp((1.0 - r) * w[14]))
.min(new_s_min);
new_s.clamp(S_MIN, S_MAX)
}

fn stability_short_term(w: &[f32], s: f32, rating_offset: f32, session_len: f32) -> f32 {
Expand Down

0 comments on commit ae006b5

Please sign in to comment.