Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
vadere
vadere
Commits
9950c9b5
Commit
9950c9b5
authored
Nov 27, 2018
by
Benedikt Zoennchen
Browse files
update PSO tests so they dont fail the evacuation test.
parent
e9d20529
Pipeline
#77378
failed with stages
in 101 minutes and 34 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
VadereModelTests/TestOSM/scenarios/rimea_09_public_room_2_exits_pso.scenario
View file @
9950c9b5
...
...
@@ -88,7 +88,7 @@
},
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 18,
"numberOfCircles" :
1
,
"numberOfCircles" :
3
,
"varyStepDirection" : false,
"stepLengthIntercept" : 0.4625,
"stepLengthSlopeSpeed" : 0.2345,
...
...
VadereModelTests/TestOSM/scenarios/rimea_09_public_room_4_exits_pso.scenario
View file @
9950c9b5
...
...
@@ -88,7 +88,7 @@
},
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 18,
"numberOfCircles" :
1
,
"numberOfCircles" :
3
,
"varyStepDirection" : false,
"stepLengthIntercept" : 0.4625,
"stepLengthSlopeSpeed" : 0.2345,
...
...
VadereUtils/src/org/vadere/util/math/pso/AttributesPSO.java
View file @
9950c9b5
...
...
@@ -6,7 +6,9 @@ package org.vadere.util.math.pso;
public
class
AttributesPSO
{
final
int
numberOfInformedParticles
=
3
;
final
int
swarmSize
=
30
;
final
int
maxIteration
=
15
;
final
int
minIteration
=
4
;
final
int
maxNoUpdate
=
6
;
final
int
maxIteration
=
10
;
final
int
problemDimension
=
2
;
final
double
c1
=
2.0
;
final
double
c2
=
2.0
;
...
...
VadereUtils/src/org/vadere/util/math/pso/PSO.java
View file @
9950c9b5
...
...
@@ -19,12 +19,14 @@ public class PSO {
private
final
ICircleSector
circle
;
private
final
double
errorToleranz
=
0.0001
;
private
double
gBest
;
private
double
gLastBest
;
private
VPoint
gBestLocation
;
private
final
Function
<
VPoint
,
Double
>
f
;
private
int
iterationCounter
;
private
final
double
maxVelocity
;
private
final
double
minAngle
;
private
final
double
maxAngle
;
private
int
improvementIterations
;
public
PSO
(
@NotNull
final
Function
<
VPoint
,
Double
>
f
,
...
...
@@ -44,6 +46,7 @@ public class PSO {
this
.
minAngle
=
minAngle
;
this
.
maxAngle
=
maxAngle
;
this
.
particles
=
initialSwarm
(
swarmPositions
);
this
.
improvementIterations
=
0
;
}
public
VPoint
getOptimumArg
()
{
...
...
@@ -69,20 +72,21 @@ public class PSO {
}
public
boolean
hasFinished
()
{
return
iterationCounter
>=
attributesPSO
.
maxIteration
||
hasConverged
();
return
iterationCounter
>=
attributesPSO
.
maxIteration
||
(
iterationCounter
>=
attributesPSO
.
minIteration
&&
hasConverged
()
)
;
}
public
boolean
hasConverged
()
{
return
fals
e
;
return
improvementIterations
>=
attributesPSO
.
maxNoUpdat
e
;
}
public
void
update
()
{
if
(
iterationCounter
<
attributesPSO
.
maxIteration
)
{
if
(
!
hasFinished
()
)
{
iterationCounter
++;
updateLocalBest
();
updateGlobalBest
();
double
omega
=
attributesPSO
.
wUpperBound
-
(
iterationCounter
/
attributesPSO
.
maxIteration
)
*
(
attributesPSO
.
wUpperBound
-
attributesPSO
.
wLowerBound
);
double
omega
=
attributesPSO
.
wUpperBound
-
(
iterationCounter
/
attributesPSO
.
minIteration
)
*
(
attributesPSO
.
wUpperBound
-
attributesPSO
.
wLowerBound
);
particles
.
forEach
(
particle
->
updateParticle
(
particle
,
omega
));
}
}
...
...
@@ -134,7 +138,7 @@ public class PSO {
* than the old one, particles inform each other about their best values and locations.
*/
private
void
updateGlobalBest
()
{
double
l
ast
G
Best
=
gBest
;
gL
astBest
=
gBest
;
for
(
Particle
particle
:
particles
)
{
double
globalBest
=
particle
.
getGlobalBestFitnessValue
();
...
...
@@ -144,7 +148,16 @@ public class PSO {
}
}
if
(
gBest
>=
lastGBest
)
{
// no or small improvement
if
(
gBest
>=
gLastBest
||
Math
.
abs
(
gBest
-
gLastBest
)
<
0.001
)
{
improvementIterations
++;
}
else
{
improvementIterations
=
0
;
}
// no global improvement
if
(
gBest
>=
gLastBest
)
{
informKParticle
();
}
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment