Skip to content

Commit

Permalink
Fixed NaN value response from fitness functon
Browse files Browse the repository at this point in the history
  • Loading branch information
Jozo132 committed Apr 26, 2020
1 parent 678c466 commit 38602f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ga.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ const fitnessTestPopulationASYNC = (population, options, callback) => {
}
}
const fitnessOutput = options.calculateFitness(child, fitnessCallback)
if (fitnessOutput >= 0 || fitnessOutput < 0) fitnessCallback(fitnessOutput)
if (fitnessOutput >= 0 || fitnessOutput < 0 || isNaN(fitnessOutput)) fitnessCallback(fitnessOutput)
})
}

Expand Down

0 comments on commit 38602f2

Please sign in to comment.