Commit 4b4c4aee authored by unknown's avatar unknown
Browse files

v1.0.3 replace cat() by message() in Calibration_Michel()

parent d090c5c7
...@@ -105,13 +105,13 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU ...@@ -105,13 +105,13 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
iNewOptim <- 0; iNewOptim <- 0;
Ncandidates <- nrow(CandidatesParamR); Ncandidates <- nrow(CandidatesParamR);
if(verbose & Ncandidates>1){ if(verbose & Ncandidates>1){
if(PrefilteringType==1){ cat(paste("\t List-Screening in progress (",sep="")); } if(PrefilteringType==1){ message("List-Screening in progress (", appendLF = FALSE) }
if(PrefilteringType==2){ cat(paste("\t Grid-Screening in progress (",sep="")); } if(PrefilteringType==2){ message("Grid-Screening in progress (", appendLF = FALSE) }
cat("0%"); message("0%", appendLF = FALSE)
} }
for(iNew in 1:nrow(CandidatesParamR)){ for(iNew in 1:nrow(CandidatesParamR)){
if(verbose & Ncandidates>1){ if(verbose & Ncandidates>1){
for(k in c(2,4,6,8)){ if(iNew==round(k/10*Ncandidates)){ cat(paste(" ",10*k,"%",sep="")); } } for(k in c(2,4,6,8)){ if(iNew==round(k/10*Ncandidates)){ message(" ", 10*k, "%",appendLF = FALSE) } }
} }
##Model_run ##Model_run
Param <- CandidatesParamR[iNew,]; Param <- CandidatesParamR[iNew,];
...@@ -129,7 +129,7 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU ...@@ -129,7 +129,7 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
Multiplier <- OutputsCrit$Multiplier; Multiplier <- OutputsCrit$Multiplier;
} }
} }
if(verbose & Ncandidates>1){ cat(" 100%) \n"); } if(verbose & Ncandidates>1){ message(" 100%)\n", appendLF = FALSE) }
##End_of_first_step_Parameter_Screening____________________________________ ##End_of_first_step_Parameter_Screening____________________________________
...@@ -138,10 +138,14 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU ...@@ -138,10 +138,14 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
CritStart <- CritOptim; CritStart <- CritOptim;
NRuns <- NRuns+nrow(CandidatesParamR); NRuns <- NRuns+nrow(CandidatesParamR);
if(verbose){ if(verbose){
if(Ncandidates> 1){ cat(paste("\t Screening completed (",NRuns," runs): \n",sep="")); } if(Ncandidates> 1){
if(Ncandidates==1){ cat(paste("\t Starting point for steepest-descent local search: \n",sep="")); } message("\t Screening completed (", NRuns, " runs):")
cat(paste("\t Param = ",paste(formatC(ParamStartR,format="f",width=8,digits=3),collapse=" , "),"\n",sep="")); }
cat(paste("\t Crit ",format(CritName,width=12,justify="left")," = ",formatC(CritStart*Multiplier,format="f",digits=4),"\n",sep="")); if(Ncandidates==1){
message("\t Starting point for steepest-descent local search:")
}
message("\t Param = ", paste(formatC(ParamStartR, format = "f", width = 8, digits = 3), collapse = " , "))
message("\t Crit ", format(CritName, width = 12, justify = "left"), " = ", formatC(CritStart*Multiplier, format = "f", digits = 4))
} }
##Results_archiving________________________________________________________ ##Results_archiving________________________________________________________
HistParamR[1,] <- ParamStartR; HistParamR[1,] <- ParamStartR;
...@@ -192,7 +196,7 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU ...@@ -192,7 +196,7 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
##Initialisation_of_variables ##Initialisation_of_variables
if(verbose){ if(verbose){
cat("\t Steepest-descent local search in progress \n"); message("Steepest-descent local search in progress")
} }
Pace <- 0.64; Pace <- 0.64;
PaceDiag <- rep(0,NParam); PaceDiag <- rep(0,NParam);
...@@ -307,7 +311,7 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU ...@@ -307,7 +311,7 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
##Case_when_the_starting_parameter_set_remains_the_best_solution__________ ##Case_when_the_starting_parameter_set_remains_the_best_solution__________
if(CritOptim==CritStart & verbose){ if(CritOptim==CritStart & verbose){
cat("\t No progress achieved \n"); message("\t No progress achieved");
} }
##End_of_Steepest_Descent_Local_Search____________________________________ ##End_of_Steepest_Descent_Local_Search____________________________________
...@@ -316,9 +320,9 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU ...@@ -316,9 +320,9 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
CritFinal <- CritOptim; CritFinal <- CritOptim;
NIter <- 1+ITER; NIter <- 1+ITER;
if(verbose){ if(verbose){
cat(paste("\t Calibration completed (",NIter," iterations, ",NRuns," runs): \n",sep="")); message("\t Calibration completed (", NIter, " iterations, ", NRuns, " runs)")
cat(paste("\t Param = ",paste(formatC(ParamFinalR,format="f",width=8,digits=3),collapse=" , "),"\n",sep="")); message("\t Param = ", paste(formatC(ParamFinalR, format = "f", width = 8, digits = 3), collapse = " , "))
cat(paste("\t Crit ",format(CritName,width=12,justify="left")," = ",formatC(CritFinal*Multiplier,format="f",digits=4),"\n",sep="")); message("\t Crit ", format(CritName, width = 12, justify = "left"), " = ", formatC(CritFinal*Multiplier, format = "f", digits = 4))
} }
##Results_archiving_______________________________________________________ ##Results_archiving_______________________________________________________
HistParamR <- cbind(HistParamR[1:NIter,]); colnames(HistParamR) <- paste("Param",1:NParam,sep=""); HistParamR <- cbind(HistParamR[1:NIter,]); colnames(HistParamR) <- paste("Param",1:NParam,sep="");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment