mlr-org / bbotk

Black-box optimization framework for R.
https://bbotk.mlr-org.com
GNU Lesser General Public License v3.0
20 stars 9 forks source link

`assign_result` of `OptimInstanceMulticrit` fails #64

Closed be-marc closed 4 years ago

be-marc commented 4 years ago
library(bbotk)
source("tests/testthat/helper.R")

terminator = term("evals", n_evals = 10)
inst = MAKE_INST_2D_2D(terminator)
opt = OptimizerRandomSearch$new()
opt$optimize(inst)

The code throws an error because assign_result of OptimInstanceMulticrit asserts that y is a data.table. The default .assign_result private method of Optimizer which is used by OptimizerRandomSearch returns y as a numeric.

Solution would be to return y always as a data.table and change the assert of assign_result in OptimInstance from numeric to data.table.

be-marc commented 4 years ago

Alternatively, .assign_result returns a numeric for singlecrit and a data.table for multicrit. I think this would be the better solution.

be-marc commented 4 years ago

Closed by 5a5fac77c5285ee20f1f10c97bd8bb800c9255c5