Skip to content

Commit

Permalink
Merge pull request #1488 from NASA-AMMOS/1336-1468-bug-mutex
Browse files Browse the repository at this point in the history
Fix rootfinding by enforcing bounds of initial x-values
  • Loading branch information
dandelany authored Jun 26, 2024
2 parents dd27d6a + 33ad9e9 commit 0c4a76d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private IteratingResult nextValueAt(
int i = 0;
do {
//we should not come back to previously visited values
if (!history.alreadyVisited(cur)) {
if (!history.alreadyVisited(cur) && cur.between(min, max)) {
i++;
try {
final var value = function.valueAt(cur, history);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public Duration valueAt(
Duration.of(-2, Duration.SECONDS),
twoSecond,
100);
assertEquals(29, solution.history().getHistory().size());
assertEquals(30, solution.history().getHistory().size());
assertEquals(new EquationSolvingAlgorithms.FunctionCoordinate<>(Duration.of(0, Duration.MICROSECONDS), Duration.of(0, Duration.MICROSECONDS)), solution.functionCoordinate());
}

Expand Down Expand Up @@ -164,7 +164,7 @@ public Duration valueAt(
Duration.of(-2, Duration.SECONDS),
twoSecond,
100);
assertEquals(2, solution.history().getHistory().size());
assertEquals(new EquationSolvingAlgorithms.FunctionCoordinate<>(Duration.of(0, Duration.MICROSECONDS), Duration.of(0, Duration.MICROSECONDS)), solution.functionCoordinate());
assertEquals(1, solution.history().getHistory().size());
assertEquals(new EquationSolvingAlgorithms.FunctionCoordinate<>(Duration.of(-860925, Duration.MICROSECONDS), Duration.of(0, Duration.MICROSECONDS)), solution.functionCoordinate());
}
}

0 comments on commit 0c4a76d

Please sign in to comment.