Skip to content

Commit

Permalink
fix: printer of optiminstance errored when the search space was empty (
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc authored Sep 27, 2023
1 parent fba6087 commit 4691266
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# bbotk 0.7.2.9000

* fix: `OptimInstance$print()` errored when the search space was empty.

# bbotk 0.7.2

* fix: Standalone `Tuner` and `FSelector` were rejected by `ContextOptimization`.
Expand Down
8 changes: 6 additions & 2 deletions R/OptimInstance.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,12 @@ OptimInstance = R6Class("OptimInstance",
catf(format(self))
catf(str_indent("* State: ", if (is.null(private$.result)) "Not optimized" else "Optimized"))
catf(str_indent("* Objective:", format(self$objective)))
catf("* Search Space:")
print(as.data.table(self$search_space)[, c("id", "class", "lower", "upper", "nlevels"), with = FALSE])
if (!self$search_space$length) {
catf("* Search Space: Empty")
} else {
catf("* Search Space:")
print(as.data.table(self$search_space)[, c("id", "class", "lower", "upper", "nlevels"), with = FALSE])
}
catf(str_indent("* Terminator:", format(self$terminator)))
if (!is.null(private$.result)) {
catf("* Result:")
Expand Down

0 comments on commit 4691266

Please sign in to comment.