Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hydroPSO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Senoner Samuel
hydroPSO
Commits
1c5098b7
Commit
1c5098b7
authored
12 years ago
by
Mauricio Zambrano-Bigiarini
Browse files
Options
Downloads
Patches
Plain Diff
hydroPSO.R: parameter's names are now preserved wehn 'normalise=TRUE'
parent
3bd3660b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
R/PSO_v2012.R
+24
-23
24 additions, 23 deletions
R/PSO_v2012.R
with
24 additions
and
23 deletions
R/PSO_v2012.R
+
24
−
23
View file @
1c5098b7
...
...
@@ -1768,53 +1768,57 @@ hydroPSO <- function(
if
(
fn.name
==
"hydromod"
)
{
if
(
drty.in
==
basename
(
drty.in
)
)
drty.in
<-
paste
(
getwd
(),
"/"
,
drty.in
,
sep
=
""
)
drty.in
<-
paste
(
getwd
(),
"/"
,
drty.in
,
sep
=
""
)
if
(
!
file.exists
(
file.path
(
drty.in
)
)
)
stop
(
"Invalid argument: The directory '"
,
drty.in
,
"' doesn't exist !"
)
stop
(
"Invalid argument: The directory '"
,
drty.in
,
"' doesn't exist !"
)
if
(
param.ranges
==
basename
(
param.ranges
)
)
param.ranges
<-
paste
(
file.path
(
drty.in
),
"/"
,
param.ranges
,
sep
=
""
)
param.ranges
<-
paste
(
file.path
(
drty.in
),
"/"
,
param.ranges
,
sep
=
""
)
if
(
!
file.exists
(
param.ranges
)
)
stop
(
"Invalid argument: The file '"
,
param.ranges
,
"' doesn't exist !"
)
stop
(
"Invalid argument: The file '"
,
param.ranges
,
"' doesn't exist !"
)
if
(
is.null
(
model.FUN
)
)
{
stop
(
"'model.FUN' has to be defined !"
)
stop
(
"'model.FUN' has to be defined !"
)
}
else
{
model.FUN.name
<-
model.FUN
model.FUN
<-
match.fun
(
model.FUN
)
}
# ELSE end
model.FUN.name
<-
model.FUN
model.FUN
<-
match.fun
(
model.FUN
)
}
# ELSE end
if
(
length
(
model.FUN.args
)
==
0
)
{
warning
(
"['model.FUN.args' is an empty list. Are you sure your model does not have any argument(s) ?]"
)
warning
(
"['model.FUN.args' is an empty list. Are you sure your model does not have any argument(s) ?]"
)
}
else
{
model.FUN.argsDefaults
<-
formals
(
model.FUN
)
model.FUN.args
<-
modifyList
(
model.FUN.argsDefaults
,
model.FUN.args
)
}
# ELSe end
model.FUN.argsDefaults
<-
formals
(
model.FUN
)
model.FUN.args
<-
modifyList
(
model.FUN.argsDefaults
,
model.FUN.args
)
}
# ELSe end
}
# IF end
# checking 'X.Boundaries'
if
(
fn.name
==
"hydromod"
)
{
if
(
verbose
)
message
(
"================================================================================"
)
if
(
verbose
)
message
(
"[ Reading 'param.ranges' ... ]"
)
if
(
verbose
)
message
(
"================================================================================"
)
if
(
verbose
)
message
(
"================================================================================"
)
if
(
verbose
)
message
(
"[ Reading 'param.ranges' ... ]"
)
if
(
verbose
)
message
(
"================================================================================"
)
X.Boundaries
<-
read.ParameterRanges
(
ParamRanges.fname
=
param.ranges
)
X.Boundaries
<-
read.ParameterRanges
(
ParamRanges.fname
=
param.ranges
)
lower
<-
X.Boundaries
[,
1
]
upper
<-
X.Boundaries
[,
2
]
}
else
{
if
(
(
lower
[
1L
]
==
-
Inf
)
||
(
upper
[
1L
]
==
Inf
)
)
{
stop
(
"Invalid argument: 'lower' and 'upper' boundaries must be finite !!'"
)
}
else
X.Boundaries
<-
cbind
(
lower
,
upper
)
if
(
(
lower
[
1L
]
==
-
Inf
)
||
(
upper
[
1L
]
==
Inf
)
)
{
stop
(
"Invalid argument: 'lower' and 'upper' boundaries must be finite !!'"
)
}
else
X.Boundaries
<-
cbind
(
lower
,
upper
)
}
# ELSE end
n
<-
nrow
(
X.Boundaries
)
if
(
is.null
(
rownames
(
X.Boundaries
)))
{
param.IDs
<-
paste
(
"Param"
,
1
:
n
,
sep
=
""
)
}
else
param.IDs
<-
rownames
(
X.Boundaries
)
if
(
normalise
)
{
# Backing up the orinal boundaries
lower.ini
<-
lower
...
...
@@ -1826,12 +1830,9 @@ hydroPSO <- function(
lower
<-
rep
(
0
,
n
)
upper
<-
rep
(
1
,
n
)
X.Boundaries
<-
cbind
(
lower
,
upper
)
rownames
(
X.Boundaries
)
<-
}
# IF end
if
(
is.null
(
rownames
(
X.Boundaries
)))
{
param.IDs
<-
paste
(
"Param"
,
1
:
n
,
sep
=
""
)
}
else
param.IDs
<-
rownames
(
X.Boundaries
)
if
(
drty.out
==
basename
(
drty.out
)
)
drty.out
<-
paste
(
getwd
(),
"/"
,
drty.out
,
sep
=
""
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment