Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 9950c9b5 authored by Benedikt Zoennchen's avatar 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
......@@ -88,7 +88,7 @@
},
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 18,
"numberOfCircles" : 1,
"numberOfCircles" : 3,
"varyStepDirection" : false,
"stepLengthIntercept" : 0.4625,
"stepLengthSlopeSpeed" : 0.2345,
......
......@@ -88,7 +88,7 @@
},
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 18,
"numberOfCircles" : 1,
"numberOfCircles" : 3,
"varyStepDirection" : false,
"stepLengthIntercept" : 0.4625,
"stepLengthSlopeSpeed" : 0.2345,
......
......@@ -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;
......
......@@ -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 false;
return improvementIterations >= attributesPSO.maxNoUpdate;
}
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 lastGBest = gBest;
gLastBest = 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();
}
}
......
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