Last active
March 17, 2021 21:48
-
-
Save PyDataBlog/1b56799a4160e63a087a7c3dc811730b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cost = [10, 10, 10, 10, 1, 1, 1] | |
function count_no_improvements(x) | |
counter = 0 | |
for i in 1:size(x, 1) | |
if (i > 1) && abs(x[i] - x[i-1]) < (1e-6 * x[i]) | |
counter += 1 | |
else | |
counter = 0 | |
end | |
end | |
return counter | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment