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.
The code throws an error because
assign_result
ofOptimInstanceMulticrit
asserts that y is adata.table
. The default.assign_result
private method ofOptimizer
which is used byOptimizerRandomSearch
returns y as anumeric
.Solution would be to return y always as a
data.table
and change the assert ofassign_result
inOptimInstance
fromnumeric
todata.table
.