diff --git a/DESCRIPTION b/DESCRIPTION index 1df268577ddaef5b7a25eb201927e4cd0e46f202..f9b2db7c699e2d16c48194071a3c86d6e7b433f6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: airGR Type: Package Title: Suite of GR hydrological models for precipitation-runoff modelling -Version: 1.0.4.2 +Version: 1.0.4.3 Date: 2017-01-18 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl")), diff --git a/R/Calibration_Michel.R b/R/Calibration_Michel.R index 3f457930d425d370ac39c46417fbf401b0178c24..5b2bba5c887b9b4d640fe5086f7160650e4138dc 100644 --- a/R/Calibration_Michel.R +++ b/R/Calibration_Michel.R @@ -119,41 +119,8 @@ Calibration_Michel <- function(InputsModel, RunOptions, InputsCrit, CalibOptions ##Definition_of_the_function_creating_all_possible_parameter_sets_from_different_values_for_each_parameter ProposeCandidatesGrid <- function(DistribParam) { - ##Managing_matrix_sizes - Nvalmax <- nrow(DistribParam) - NParam <- ncol(DistribParam) - ##we_add_columns_to_MatDistrib_until_it_has_20_columns - DistribParam2 <- matrix(NA, nrow = Nvalmax, ncol = 20) - DistribParam2[1:Nvalmax, 1:NParam] <- DistribParam - ##we_check_the_number_of_values_to_test_for_each_param - NbDistrib <- rep(1, 20) - for (iC in 1:20) { - NbDistrib[iC] <- max(1, Nvalmax-sum(is.na(DistribParam2[, iC]))) - } - ##Loop_on_the_various_values_to_test ###(if 4 param and 3 values for each => 3^4 sets) - ##NB_we_always_do_20_loops ###which_is_here_the_max_number_of_param_that_can_be_optimised - VECT <- NULL - for (iL01 in 1:NbDistrib[01]) { for (iL02 in 1:NbDistrib[02]) { for (iL03 in 1:NbDistrib[03]) { for (iL04 in 1:NbDistrib[04]) { for (iL05 in 1:NbDistrib[05]) { - for (iL06 in 1:NbDistrib[06]) { for (iL07 in 1:NbDistrib[07]) { for (iL08 in 1:NbDistrib[08]) { for (iL09 in 1:NbDistrib[09]) { for (iL10 in 1:NbDistrib[10]) { - for (iL11 in 1:NbDistrib[11]) { for (iL12 in 1:NbDistrib[12]) { for (iL13 in 1:NbDistrib[13]) { for (iL14 in 1:NbDistrib[14]) { for (iL15 in 1:NbDistrib[15]) { - for (iL16 in 1:NbDistrib[16]) { for (iL17 in 1:NbDistrib[17]) { for (iL18 in 1:NbDistrib[18]) { for (iL19 in 1:NbDistrib[19]) { for (iL20 in 1:NbDistrib[20]) { - VECT <- c(VECT, - DistribParam2[iL01,01],DistribParam2[iL02,02],DistribParam2[iL03,03],DistribParam2[iL04,04],DistribParam2[iL05,05], - DistribParam2[iL06,06],DistribParam2[iL07,07],DistribParam2[iL08,08],DistribParam2[iL09,09],DistribParam2[iL10,10], - DistribParam2[iL11,11],DistribParam2[iL12,12],DistribParam2[iL13,13],DistribParam2[iL14,14],DistribParam2[iL15,15], - DistribParam2[iL16,16],DistribParam2[iL17,17],DistribParam2[iL18,18],DistribParam2[iL19,19],DistribParam2[iL20,20]) - } } } } } - } } } } } - } } } } } - } } } } } - MAT <- matrix(VECT, ncol = 20, byrow = TRUE)[, 1:NParam] - if (!is.matrix(MAT)) { - MAT <- cbind(MAT) - } - Output <- NULL - Output$NewCandidates <- MAT - return(Output) - } + Output <- list(NewCandidates = expand.grid(lapply(seq_len(ncol(DistribParamR)), function(x) DistribParam[, x]))) + } ##Creation_of_new_candidates_______________________________________________