Skip to content

Commit

Permalink
version 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtAcht authored and cran-robot committed Oct 25, 2023
1 parent cb42c12 commit 76a50d0
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 28 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: hmsr
Title: Multipopulation Evolutionary Strategy HMS
Version: 1.0.0
Version: 1.0.1
Authors@R: c(
person(given = "Wojciech",
family = "Achtelik",
Expand Down Expand Up @@ -37,12 +37,12 @@ Suggests: testthat (>= 3.0.0), ecr, filelock, parallel, doParallel,
BugReports: https://github.com/WojtAcht/hms/issues
URL: https://wojtacht.github.io/hms/
NeedsCompilation: no
Packaged: 2023-10-11 16:40:53 UTC; wojciechachtelik
Packaged: 2023-10-24 18:38:02 UTC; wojciechachtelik
Author: Wojciech Achtelik [aut, cre],
Marcin Kozubek [aut],
Maciej Smołka [ths, aut] (<https://orcid.org/0000-0002-3386-0555>, Java
original),
AGH University of Kraków [cph]
Maintainer: Wojciech Achtelik <wachtelik@gmail.com>
Repository: CRAN
Date/Publication: 2023-10-12 06:10:02 UTC
Date/Publication: 2023-10-25 07:10:02 UTC
10 changes: 5 additions & 5 deletions MD5
@@ -1,7 +1,7 @@
de994a43d48dfa8a121dae5a7229e019 *DESCRIPTION
f23592268df34182f537bf108207aec9 *DESCRIPTION
73dc907b9f2d20015786a7f40e3c9ff3 *LICENSE
8455034c510f6eb4a7d0138bdc8bf388 *NAMESPACE
febc4f16aef430c1874b458acd854db4 *NEWS.md
79742c833bd393ef53b70f28e0afed3f *NEWS.md
fc1df8ec568e0a5bffce61246e49fda6 *R/default_parameters.R
3d6562ccf846ec332f11721c29b2e6c5 *R/deme.R
49237c9da65f080f76e700ccb7c85f05 *R/ecr_metaepoch.R
Expand All @@ -13,7 +13,7 @@ d0c0a927ff4ac81645b91cd8a34322ef *R/gradient_method.R
7435d1418df96e2d840ac44493329794 *R/local_stopping_condition.R
090571a3a944b647cc3d6f1d1e9b2d9e *R/monitor.R
5edb83f801232dd3cfc5dd231daa6434 *R/mutation.R
a86b8004cd5dc57c2678dcdb2df301e5 *R/sprouting_condition.R
4d1dfb9926192878f86bd0496387fac0 *R/sprouting_condition.R
244cb4d5e17add77244f1eacfd1a961d *R/start_message.R
4e0d2b6b1da5e97ff3541668e52081ed *R/utils.R
8cd69edc16de2228aa1b3fe3d986b0dc *README.md
Expand Down Expand Up @@ -45,7 +45,7 @@ daf8cf3efafa4e09e8edc04f0871cba4 *man/printTree-hms-method.Rd
1f9ff3f729689c9f4ffd0e18ec332d66 *man/rtnorm_mutation.Rd
5a2ff369f9bccefb467c03bc8f789e9b *man/saveMetaepochsPopulations-hms-method.Rd
0d381df3ee7417ad9f89859aaafad69a *man/saveMetaepochsPopulations.Rd
b43e679550aefba7795ee68abc2664aa *man/sc_max_metric.Rd
1d357668ff1175bfa181381f5671f98e *man/sc_max_metric.Rd
0e2688bf28f6b8b5f47f9acbc7615260 *man/show-hms-method.Rd
773119a2e12336093e33a5adccd2da3a *man/summary-hms-method.Rd
252721a9d7c533dcd82621cc2c002fba *tests/testthat.R
Expand All @@ -54,6 +54,6 @@ b43e679550aefba7795ee68abc2664aa *man/sc_max_metric.Rd
e2fa661300951d7b2f022236b390ad15 *tests/testthat/test-deme.R
d1707ade2a47cf027c0bf2375f02ddb2 *tests/testthat/test-hms-class.R
c090441b9f74dc7206f8c284018065f7 *tests/testthat/test-hms-validation.R
23ae268be941b9f6bcc8d160740302ba *tests/testthat/test-hms.R
36a7d281e8101a8c257993772a8c8dfa *tests/testthat/test-hms.R
cce5f003799884e00d4c5b640479831f *tests/testthat/test-monitor.R
b245f96417f0faf8a243beff17a9dfbb *tests/testthat/test-utils.R
8 changes: 3 additions & 5 deletions NEWS.md
@@ -1,5 +1,3 @@
# hmsr 1.0.0

# hmsr 0.0.0.9000

* Added a `NEWS.md` file to track changes to the package.
# hmsr 1.0.1
* `sc_max_metric()` uses centroids instead of sprouts (#54).
* fix M1 mac failing tests.
13 changes: 5 additions & 8 deletions R/sprouting_condition.R
@@ -1,13 +1,13 @@
#' Default sprouting condition based on given metric.
#'
#' It allows an individual to sprout only if there are no other
#' demes on the target level that have sprouted within the given
#' demes on the target level that have centroid within the given
#' distance.
#'
#' @param metric - Metric used for deme distance comparison (e.g.
#' euclidean_distance, manhattan_distance)
#' @param max_distances - numeric - maximum distance to a sprout of
#' a deme on the target level that would allow the idividual to sprout
#' @param max_distances - numeric - maximum distance to a centroid of
#' a deme on the target level that would allow the individual to sprout
#'
#' @return Function that can be used as a sprouting condition of hms.
#'
Expand All @@ -22,11 +22,8 @@ sc_max_metric <- function(metric, max_distances) {
}, demes)

single_deme_condition <- function(deme) {
if (is.null(deme@sprout)) {
FALSE
} else {
metric(deme@sprout, potential_sprout) < max_distances[[potential_sprout_level - 1]]
}
centroid <- colMeans(deme@population)
metric(centroid, potential_sprout) < max_distances[[potential_sprout_level - 1]]
}
length(Filter(single_deme_condition, level_demes)) == 0
}
Expand Down
6 changes: 3 additions & 3 deletions man/sc_max_metric.Rd

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

8 changes: 4 additions & 4 deletions tests/testthat/test-hms.R
Expand Up @@ -124,10 +124,10 @@ test_that("HMS works - Eggholder with gradient method:", {
sigma <- list(c(200, 200), c(100, 100), c(50, 50))
ga_config <- list(
list(
pmutation = 0.4, mutation = rtnorm_mutation(lower, upper, sigma[[1]])
pmutation = 0.6, mutation = rtnorm_mutation(lower, upper, sigma[[1]])
),
list(
pmutation = 0.2,
pmutation = 0.4,
mutation = rtnorm_mutation(lower, upper, sigma[[2]])
),
list(
Expand All @@ -144,13 +144,13 @@ test_that("HMS works - Eggholder with gradient method:", {
run_metaepoch = ga_metaepoch(ga_config),
population_sizes = c(50, 30, 15),
sigma = sigma,
gsc = gsc_max_fitness_evaluations(25000),
gsc = gsc_max_fitness_evaluations(50000),
sc = sc_max_metric(euclidean_distance, c(40, 20, 10)),
lsc = lsc_metaepochs_without_improvement(15),
monitor_level = "none",
with_gradient_method = TRUE
)
expected_solution <- c(512, 404.2319)
expected_fitness <- Eggholder(expected_solution)
expect_true(abs(result@best_fitness - expected_fitness) < 1e1)
expect_true(abs(result@best_fitness - expected_fitness) < 1e2)
})

0 comments on commit 76a50d0

Please sign in to comment.