fix: Corrected log10 calculation in master_iteration_end function

This commit is contained in:
Max Luebke 2024-09-16 12:05:19 +02:00
parent 66fb9e601c
commit 57d05f5c76

View File

@ -63,7 +63,7 @@ master_iteration_end <- function(setup, state_T, state_C) {
iter <- setup$iter
# print(iter)
## max digits for iterations
dgts <- as.integer(ceiling(log10(setup$maxiter)))
dgts <- as.integer(ceiling(log10(setup$maxiter + 1)))
## string format to use in sprintf
fmt <- paste0("%0", dgts, "d")
@ -78,7 +78,8 @@ master_iteration_end <- function(setup, state_T, state_C) {
ai_surrogate_info <- list(
prediction_time = if (exists("ai_prediction_time")) as.integer(ai_prediction_time) else NULL,
training_time = if (exists("ai_training_time")) as.integer(ai_training_time) else NULL,
valid_predictions = if(exists("validity_vector")) validity_vector else NULL)
valid_predictions = if (exists("validity_vector")) validity_vector else NULL
)
SaveRObj(x = list(
T = state_T,
@ -186,7 +187,8 @@ ReadRObj <- function(path) {
switch(extension,
rds = readRDS(path),
qs = qs::qread(path))
qs = qs::qread(path)
)
}
## Handler to store R objs to binary files using either builtin
@ -199,6 +201,6 @@ SaveRObj <- function(x, path) {
switch(extension,
rds = saveRDS(object = x, file = path),
qs = qs::qsave(x=x, file = path))
qs = qs::qsave(x = x, file = path)
)
}