Skip to content

Commit

Permalink
fix: no parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Jun 20, 2024
1 parent 00eef77 commit 1b40b7e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/OptimInstance.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ OptimInstance = R6Class("OptimInstance",
cli_li(sprintf("Objective: %s", class(self$objective)[1]))
cli_li("Search Space:")
print(as.data.table(self$search_space)[, c("id", "class", "lower", "upper", "nlevels"), with = FALSE])
cli_li(sprintf("Terminator: %s (%s)", class(self$terminator)[1], as_short_string(self$terminator$param_set$values)))
cli_li(sprintf("Terminator: %s %s", class(self$terminator)[1], if (length(self$terminator$param_set$values)) paste0("(", as_short_string(self$terminator$param_set$values), ")") else ""))
if (!is.null(private$.result)) {
cli_li("Result:")
print(self$result[, c(self$archive$cols_x, self$archive$cols_y), with = FALSE])
Expand Down
2 changes: 1 addition & 1 deletion R/Terminator.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Terminator = R6Class("Terminator",
#' @param ... (ignored).
print = function(...) {
cli_h1(sprintf("%s %s", class(self)[1L], if (is.na(self$label)) "" else paste0("- ", self$label)))
cli_li(sprintf("Parameters: %s", if (length(self$param_set$values)) as_short_string(self$param_set$values) else "-"))
cli_li(sprintf("Parameters: %s", if(length(self$param_set$values)) as_short_string(self$param_set$values) else "-"))
},

#' @description
Expand Down
20 changes: 20 additions & 0 deletions tests/testthat/_snaps/TerminatorNone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# TerminatorNone works

Code
terminators
Output
$evals
Message
-- TerminatorEvals - Number of Evaluation --------------------------------------
* Parameters: n_evals=10, k=0
Output
$none
Message
-- TerminatorNone - None -------------------------------------------------------
* Parameters: -
Output

0 comments on commit 1b40b7e

Please sign in to comment.