-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add deprecated message to instances
- Loading branch information
Showing
7 changed files
with
288 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: bbotk | ||
Title: Black-Box Optimization Toolkit | ||
Version: 0.8.0.9000 | ||
Authors@R:c( | ||
Authors@R: c( | ||
person("Marc", "Becker", , "[email protected]", role = c("cre", "aut"), | ||
comment = c(ORCID = "0000-0002-8115-0400")), | ||
person("Jakob", "Richter", , "[email protected]", role = "aut", | ||
|
@@ -77,6 +77,8 @@ Collate: | |
'OptimInstanceBatch.R' | ||
'OptimInstanceBatchMultiCrit.R' | ||
'OptimInstanceBatchSingleCrit.R' | ||
'OptimInstanceMultiCrit.R' | ||
'OptimInstanceSingleCrit.R' | ||
'mlr_optimizers.R' | ||
'Optimizer.R' | ||
'OptimizerAsync.R' | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#' @title Multi Criteria Optimization Instance for Batch Optimization | ||
#' | ||
#' @description | ||
#' `OptimInstanceMultiCrit` is a deprecated class that is now a wrapper around [OptimInstanceBatchMultiCrit]. | ||
#' | ||
#' @template param_objective | ||
#' @template param_search_space | ||
#' @template param_terminator | ||
#' @template param_check_values | ||
#' @template param_callbacks | ||
#' @template param_keep_evals | ||
#' | ||
#' @export | ||
OptimInstanceMultiCrit = R6Class("OptimInstanceMultiCrit", | ||
inherit = OptimInstanceBatchMultiCrit, | ||
public = list( | ||
|
||
#' @description | ||
#' Creates a new instance of this [R6][R6::R6Class] class. | ||
initialize = function( | ||
objective, | ||
search_space = NULL, | ||
terminator, | ||
keep_evals = "all", | ||
check_values = TRUE, | ||
callbacks = NULL | ||
) { | ||
|
||
message("OptimInstanceMultiCrit is deprecated. Use OptimInstanceBatchMultiCrit instead.") | ||
|
||
super$initialize( | ||
objective = objective, | ||
search_space = search_space, | ||
terminator = terminator, | ||
check_values = check_values, | ||
callbacks = callbacks) | ||
} | ||
) | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#' @title Single Criterion Optimization Instance for Batch Optimization | ||
#' | ||
#' @description | ||
#' `OptimInstanceSingleCrit` is a deprecated class that is now a wrapper around `OptimInstanceBatchSingleCrit`. | ||
#' | ||
#' @template param_objective | ||
#' @template param_search_space | ||
#' @template param_terminator | ||
#' @template param_check_values | ||
#' @template param_callbacks | ||
#' @template param_keep_evals | ||
#' | ||
#' @export | ||
OptimInstanceSingleCrit = R6Class("OptimInstanceSingleCrit", | ||
inherit = OptimInstanceBatchSingleCrit, | ||
public = list( | ||
|
||
#' @description | ||
#' Creates a new instance of this [R6][R6::R6Class] class. | ||
initialize = function( | ||
objective, | ||
search_space = NULL, | ||
terminator, | ||
keep_evals = "all", | ||
check_values = TRUE, | ||
callbacks = NULL | ||
) { | ||
|
||
message("OptimInstanceSingleCrit is deprecated. Use OptimInstanceBatchSingleCrit instead.") | ||
|
||
super$initialize( | ||
objective = objective, | ||
search_space = search_space, | ||
terminator = terminator, | ||
check_values = check_values, | ||
callbacks = callbacks) | ||
} | ||
) | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
test_that("OptimInstanceSingleCrit deprecated works", { | ||
|
||
expect_message({instance = OptimInstanceSingleCrit$new( | ||
objective = OBJ_2D, | ||
search_space = PS_2D, | ||
terminator = trm("evals", n_evals = 5L), | ||
)}, "OptimInstanceSingleCrit is deprecated") | ||
|
||
expect_class(instance, "OptimInstanceSingleCrit") | ||
}) | ||
|
||
test_that("OptimInstanceMultiCrit deprecated works", { | ||
|
||
expect_message({instance = OptimInstanceMultiCrit$new( | ||
objective = OBJ_2D, | ||
search_space = PS_2D, | ||
terminator = trm("evals", n_evals = 5L), | ||
)}, "OptimInstanceMultiCrit is deprecated") | ||
|
||
expect_class(instance, "OptimInstanceMultiCrit") | ||
}) |