mlr-org / bbotk

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

TerminatorRuntime doesn't work with empty archive #128

Closed mb706 closed 3 years ago

mb706 commented 3 years ago

Should probably be automatically tested with all terminators.

> trm("run_time")$is_terminated(Archive$new(ps(x = p_dbl()), ps(x = p_dbl())))
Error in as.POSIXct.default(time2) : 
  do not know how to convert 'time2' to class “POSIXct”
be-marc commented 3 years ago

All terminators work with an empty archive. TerminatorRunTime needs Archive$start_time which is set by the Optimizer. We could add an error message if Archive$start_time = NULL.

archive = Archive$new(ps(x = p_dbl()), ps(x = p_dbl()))
archive$start_time = Sys.time()
trm("run_time")$is_terminated(archive)

# > [1] FALSE
be-marc commented 3 years ago

The unit test check now if all terminators work with an empty archive. TerminatorRunTime$is_terminated() returns FALSE if Archive$start_time is not set and the documentation mentions that archive$start_time must be set. Closed by 1c89ab8eebb8cc07e2bb070ed23527cf1240a152 and 116ac3966def945af56123d9fe9adeab69410217.