Skip to content

Commit

Permalink
call of inspect_population before resize!
Browse files Browse the repository at this point in the history
  • Loading branch information
sadit committed Feb 26, 2021
1 parent ba59f11 commit d235186
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ on:
# Push events on main branch
- main
# Sequence of patterns matched against refs/tags
tags:
- v*.*.*
tags: '*'

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SearchModels"
uuid = "0e966ebe-b704-4a65-8279-db954bfe5da0"
authors = ["Eric S. Tellez"]
version = "0.1.4"
version = "0.1.5"

[deps]
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Expand Down
4 changes: 3 additions & 1 deletion docs/src/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ This is a toy example that help us to select and fit a polynomial model for an i
The approach of `SearchModels` consists on modeling our solution space defining a struct type and three related methods: `random_configuration`, `combine_configuration`, and `mutate_configuration`. We also may need to define `config_type` and `eltype`. In particular, `config_type` needs to be defined here to put the type as the polynomial's degree to be able to distinguish among different degrees. The `eltype` should be defined to use concrete types internally on several queues.

```@example Poly
using SearchModels
using SearchModels, Random
import SearchModels: random_configuration, combine_configurations, mutate_configuration, config_type
Random.seed!(0) # fixing seed
struct PolyModelSpace <: AbstractSolutionSpace
degree
end
Expand Down
7 changes: 4 additions & 3 deletions src/SearchModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ function evaluate_queue(error_function::Function, evalqueue, population, config_
end
end
## verbose && println(stderr, "SearchModels> *** iteration $iter finished")

sort!(population, by=x->x.second)
population
end

"""
Expand Down Expand Up @@ -229,11 +228,13 @@ function search_models(
iter += 1
empty!(config_and_errors)
evaluate_queue(error_function, evalqueue, population, config_and_errors, parallel)
sort!(population, by=x->x.second)
inspect_population(space, population)

if maxpopulation < length(population)
resize!(population, maxpopulation)
end

inspect_population(space, population)
if iter >= maxiters
verbose && println("SearchModels> reached maximum number of iterations $maxiters")
return population
Expand Down

2 comments on commit d235186

@sadit
Copy link
Owner Author

@sadit sadit commented on d235186 Feb 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/30897

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.5 -m "<description of version>" d235186c1c2a77a43bb5700d5fedc961a47ff0e7
git push origin v0.1.5

Please sign in to comment.