# \donttest{
# 1. Locate the example initial samples file included with the package
# In a real scenario, this file would be from an 'initial_parameter_optimization' run.
initial_file <- system.file(
"extdata", "initial_samples_example.csv",
package = "topolow"
)
# 2. Create a temporary directory for the function's output
# This function requires a writable directory for its results.
temp_out_dir <- tempdir()
# 3. Create a sample dissimilarity matrix for the function to use
dissim_mat <- matrix(runif(100, 1, 10), 10, 10)
diag(dissim_mat) <- 0
# 4. Run the adaptive sampling only if the example file is found
if (nzchar(initial_file)) {
run_adaptive_sampling(
initial_samples_file = initial_file,
scenario_name = "adaptive_test_example",
dissimilarity_matrix = dissim_mat,
output_dir = temp_out_dir,
max_cores = 1,
num_samples = 1,
verbose = FALSE
)
# 5. Verify output files were created
print("Output files from adaptive sampling:")
print(list.files(temp_out_dir, recursive = TRUE))
# 6. Clean up the temporary directory
unlink(temp_out_dir, recursive = TRUE)
}
# }
Run the code above in your browser using DataLab