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
9b61304e
Commit
9b61304e
authored
12 years ago
by
Mauricio Zambrano-Bigiarini
Browse files
Options
Downloads
Patches
Plain Diff
hydroPSO.R: 'MinMax' and 'pbest.fit' removed as arguments of 'ComputeSwarmRadiusAndDiameter'
parent
01a1a174
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
+5
-9
5 additions, 9 deletions
R/PSO_v2012.R
with
5 additions
and
9 deletions
R/PSO_v2012.R
+
5
−
9
View file @
9b61304e
...
...
@@ -1063,19 +1063,17 @@ UpdateNgbest <- function(pbest.fit, ngbest, MinMax) {
# Author : Mauricio Zambrano-Bigiarini
# Started: 12-Jan-2011
# Updates: 12-Jan-2011 ; 28-Oct-2011
# 06-Nov-2012
# 06-Nov-2012
; 07-Nov-2012
################################################################################
# Purpose: Function for computing the sarm radius, for detecting premature
# Purpose: Function for computing the s
w
arm radius, for detecting premature
# convergence, in order to avoid stagnation
################################################################################
# X : matrix, with the current parameter values for all the particles
# gbest : numeric, with the parameter values for the best particle in the swarm
# MinMax : character, indicating if PSO have to find a minimum or a
# maximum for the fitness function.
# Valid values are in: c('min', 'max')
# Lmax :
# Lmax :
vector with the range of the search space in each dimension
ComputeSwarmRadiusAndDiameter
<-
function
(
x
,
gbest
,
Lmax
,
MinMax
,
pbest.fit
)
{
ComputeSwarmRadiusAndDiameter
<-
function
(
x
,
gbest
,
Lmax
)
{
# number of parameters
n
<-
ncol
(
x
)
...
...
@@ -2617,12 +2615,10 @@ hydroPSO <- function(
gbest.fit.rate
<-
abs
(
(
gbest.fit
-
gbest.fit.prior
)
/
gbest.fit.prior
)
}
else
gbest.fit.rate
<-
+
Inf
out
<-
ComputeSwarmRadiusAndDiameter
(
x
=
X.bak
,
gbest
=
X.best.part
[
gbest.pos
,
],
Lmax
=
Lmax
,
MinMax
=
MinMax
,
pbest.fit
=
pbest.fit
)
out
<-
ComputeSwarmRadiusAndDiameter
(
x
=
X.bak
,
gbest
=
X.best.part
[
gbest.pos
,
],
Lmax
=
Lmax
)
swarm.radius
<-
out
[[
"swarm.radius"
]]
swarm.diameter
<-
out
[[
"swarm.diameter"
]]
NormSwarmRadius
<-
swarm.radius
/
swarm.diameter
#v.radius <- out[["v.radius"]]
if
(
(
verbose
)
&
(
iter
/
REPORT
==
floor
(
iter
/
REPORT
)
)
)
message
(
"iter:"
,
format
(
iter
,
width
=
6
,
justify
=
"right"
),
...
...
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