Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HYCAR-Hydro
airGR
Commits
4b4c4aee
Commit
4b4c4aee
authored
Jan 17, 2017
by
unknown
Browse files
v1.0.3 replace cat() by message() in Calibration_Michel()
parent
d090c5c7
Changes
1
Show whitespace changes
Inline
Side-by-side
R/Calibration_Michel.R
View file @
4b4c4aee
...
...
@@ -105,13 +105,13 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
iNewOptim
<-
0
;
Ncandidates
<-
nrow
(
CandidatesParamR
);
if
(
verbose
&
Ncandidates
>
1
){
if
(
PrefilteringType
==
1
){
cat
(
paste
(
"\t
List-Screening in progress ("
,
sep
=
""
));
}
if
(
PrefilteringType
==
2
){
cat
(
paste
(
"\t
Grid-Screening in progress ("
,
sep
=
""
));
}
cat
(
"0%"
);
if
(
PrefilteringType
==
1
){
message
(
"
List-Screening in progress ("
,
appendLF
=
FALSE
)
}
if
(
PrefilteringType
==
2
){
message
(
"
Grid-Screening in progress ("
,
appendLF
=
FALSE
)
}
message
(
"0%"
,
appendLF
=
FALSE
)
}
for
(
iNew
in
1
:
nrow
(
CandidatesParamR
)){
if
(
verbose
&
Ncandidates
>
1
){
for
(
k
in
c
(
2
,
4
,
6
,
8
)){
if
(
iNew
==
round
(
k
/
10
*
Ncandidates
)){
cat
(
past
e
(
" "
,
10
*
k
,
"%"
,
sep
=
""
));
}
}
for
(
k
in
c
(
2
,
4
,
6
,
8
)){
if
(
iNew
==
round
(
k
/
10
*
Ncandidates
)){
messag
e
(
" "
,
10
*
k
,
"%"
,
appendLF
=
FALSE
)
}
}
}
##Model_run
Param
<-
CandidatesParamR
[
iNew
,];
...
...
@@ -129,7 +129,7 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
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____________________________________
...
...
@@ -138,10 +138,14 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
CritStart
<-
CritOptim
;
NRuns
<-
NRuns
+
nrow
(
CandidatesParamR
);
if
(
verbose
){
if
(
Ncandidates
>
1
){
cat
(
paste
(
"\t Screening completed ("
,
NRuns
,
" runs): \n"
,
sep
=
""
));
}
if
(
Ncandidates
==
1
){
cat
(
paste
(
"\t Starting point for steepest-descent local search: \n"
,
sep
=
""
));
}
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 Screening completed ("
,
NRuns
,
" runs):"
)
}
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________________________________________________________
HistParamR
[
1
,]
<-
ParamStartR
;
...
...
@@ -192,7 +196,7 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
##Initialisation_of_variables
if
(
verbose
){
cat
(
"\t
Steepest-descent local search in progress
\n
"
)
;
message
(
"
Steepest-descent local search in progress"
)
}
Pace
<-
0.64
;
PaceDiag
<-
rep
(
0
,
NParam
);
...
...
@@ -307,7 +311,7 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
##Case_when_the_starting_parameter_set_remains_the_best_solution__________
if
(
CritOptim
==
CritStart
&
verbose
){
cat
(
"\t No progress achieved
\n
"
);
message
(
"\t No progress achieved"
);
}
##End_of_Steepest_Descent_Local_Search____________________________________
...
...
@@ -316,9 +320,9 @@ Calibration_Michel <- function(InputsModel,RunOptions,InputsCrit,CalibOptions,FU
CritFinal
<-
CritOptim
;
NIter
<-
1
+
ITER
;
if
(
verbose
){
cat
(
past
e
(
"\t Calibration completed ("
,
NIter
,
" iterations, "
,
NRuns
,
" runs)
: \n"
,
sep
=
""
));
cat
(
past
e
(
"\t Param = "
,
paste
(
formatC
(
ParamFinalR
,
format
=
"f"
,
width
=
8
,
digits
=
3
),
collapse
=
" , "
)
,
"\n"
,
sep
=
""
));
cat
(
past
e
(
"\t Crit "
,
format
(
CritName
,
width
=
12
,
justify
=
"left"
),
" = "
,
formatC
(
CritFinal
*
Multiplier
,
format
=
"f"
,
digits
=
4
),
"\n"
,
sep
=
""
));
messag
e
(
"\t Calibration completed ("
,
NIter
,
" iterations, "
,
NRuns
,
" runs)
"
)
messag
e
(
"\t Param = "
,
paste
(
formatC
(
ParamFinalR
,
format
=
"f"
,
width
=
8
,
digits
=
3
),
collapse
=
" , "
)
)
messag
e
(
"\t Crit "
,
format
(
CritName
,
width
=
12
,
justify
=
"left"
),
" = "
,
formatC
(
CritFinal
*
Multiplier
,
format
=
"f"
,
digits
=
4
))
}
##Results_archiving_______________________________________________________
HistParamR
<-
cbind
(
HistParamR
[
1
:
NIter
,]);
colnames
(
HistParamR
)
<-
paste
(
"Param"
,
1
:
NParam
,
sep
=
""
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment