10.12., 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit d9d53034 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen

Merge branch 'master' of https://gitlab.lrz.de/vadere/vadere

parents b444e952 9f2c7595
Pipeline #68828 passed with stages
in 66 minutes and 26 seconds
......@@ -41,6 +41,7 @@ unit_tests_with_coverage:
stage: test
script:
- Documentation/version-control/git-hook-vadere-software
- mvn clean
- mvn -Dtest=!TestConvolution,!TestBitonicSort,!TestCLLinkedList test
- python3 Tools/ContinuousIntegration/collect_line_and_branch_coverage.py
......@@ -49,6 +50,7 @@ run_scenario_files:
stage: deploy
script:
- Documentation/version-control/git-hook-vadere-software
- mvn clean
- mvn -Dmaven.test.skip=true package
- python3 Tools/ContinuousIntegration/run_vadere_console_with_all_scenario_files.py
......
**Note:** Before writing into this file, read the guidelines in [Writing Changelog Entries.md](Documentation/contributing/Writing Changelog Entries.md).
# In Progress: v0.7
# v0.6 (2018-09-07)
## Added
- Graphical simulation result is displayed in a table view to show run-time and overlap information if the corresponding processors are loaded. The Simulation result dialog can be deactivated in the preferences. (5ffca5a3: Simulator, GUI)
- Added new OutputProcessors for Overlaps. (8028c523: Simulator)
- Added "fixedSeed" and "simulationSeed" to AttributesSimulation. (79268262: Simulator)
- VadereConsole.jar migrate will migrate all scenario files within the specified directory and all child directories. (37fde165: Simulator)
* To exclude specific sub-trees or only specific directories the igonoreDirs List can be expanded.
* DO_NOT_MIGRATE or .DO_NOT_MIGRATE: Ignore current directory but continue with existing child directories.
* DO_NOT_MIGRATE_TREE or .DO_NOT_MIGRATE_TREE: Ignore the directories and the complete sub-tree.
- Added a new OutputProcessor, NumberOverlapsProcessor. This processor saves the number of overlaps that occurred during a simulation run. It needs the PedestrianOverlapProcessor. (57d90e93: Simulator, State)
- Added sub commands to "VadereConsole": project-run, scenario-run, suq, migrate (c7e0538c: GUI)
- In the onlinevisualization it is now possible to display the target potential field of a selected pedestrian. (123457aa: GUI)
## Changed
- PedestrianOverlapProcessor returns two values "distance", "overlaps"for each overlap detected. (5ffca5a3: Simulator)
* If no overlap occurs the output is empty.
* "distance": The distance between the center of the two pedestrians
* "overlaps": The amount the two pedestrian overlap
- Moved and renamed attributes in scenario files. (c7e0538c: State)
* Move /scenario/attributesModel/org.vadere.state.attributes.models.AttributesCGM/groupSizeDistribution to each source in /scenario/topography/sources/[]/groupSizeDistribution. This allows different group size distribution for each source
* Rename /scenario/attributesModel/*/timeCostAttributes/standardDerivation to standardDeviation.
## Performance
- Faster distance computation. (6214738c: Simulator)
* To compute the distance from a point x the closest obstacle we compute the distances on a Cartesian grid of cell size equal to the default value of AttributesFloorField.potentialFieldResolution. There are two methods to compute the distances.
* Brute force (default): Compute the distance for a grid point x by computing all distances (for all obstacles) taking the minimal
* Eikonal Equation solvers (unused): Use obstacles to be the targets are of the eikonal equation and solve the equation using one of the solvers (default is the Fast Marching Method).
# v0.2 (2016-12-22)
## Added
- Stability and usability improved, additional pedestrian simulation models are supported. (babf0b67: GUI, Simulator, State, Utils)
# v0.1 (2016-08-05)
## Added
- Initial release of the software as open source. (72391fab: GUI, Simulator, State, Utils)
# Writing Changelog Entries
## Introduction
A good changelog entry should be descriptive and concise. It should explain the change to a reader who has **zero** context about the change. Each change should be categorized into one of the following types: `added`, `removed`, `changed`, `fixed`, `performance`, `security`, `deprecated` or `other`.
- **Bad:** Highlight agents.
- **Good:** In class `OnlineVisualization`, highlight the agent which was selected with left-mouse button.
The first example doest not provide any context where the change was made or what benefit it brings to the user.
## Writing into Changelog.md
1. Each new version number gets an own section prefixed with `#` and a date, e.g., `# v0.1 (2018-01-31)`.
Notes:
* Unreleased versions should be marked explicitly, e.g., `# 0.1 (unreleased)`.
* New versions should be added on top (and not at bottom).
2. Each change type gets an own subsection prefixed with `##`, e.g., `Added`.
3. Each changelog entry should contain following parts:
1. An own bullet point.
2. The description of the change.
3. The commit hash.
4. A list of affected simulator components: `Annotation`, `GUI`, `Simulator`, `State` or `Utils`.
5. Optional: More details as sub bullet points.
For instance:
```
# v0.1 (2018-01-31)
## Removed
- Removed obsolete model attribute "foo" from class "bar". (e8af1b77: State).
* ...
* ...
```
......@@ -18,7 +18,7 @@ However, we welcome contributions from external sources.
| Branch | Pipeline Status | Coverage |
|:--------|:----------------:|:--------:|
| master | [![pipeline status (master)](https://gitlab.lrz.de/vadere/vadere/badges/master/pipeline.svg)](https://gitlab.lrz.de/vadere/vadere/commits/master) | [![coverage report (master)](https://gitlab.lrz.de/vadere/vadere/badges/master/coverage.svg)](https://gitlab.lrz.de/vadere/vadere/commits/master) |
| develop | [![pipeline status (develop)](https://gitlab.lrz.de/vadere/vadere/badges/develop/pipeline.svg)](https://gitlab.lrz.de/vadere/vadere/commits/develop) | [![coverage report (develop)](https://gitlab.lrz.de/vadere/vadere/badges/develop/coverage.svg)](https://gitlab.lrz.de/vadere/vadere/commits/develop) |
| stable | [![pipeline status (stable)](https://gitlab.lrz.de/vadere/vadere/badges/stable/pipeline.svg)](https://gitlab.lrz.de/vadere/vadere/commits/stable) | [![coverage report (stable)](https://gitlab.lrz.de/vadere/vadere/badges/stable/coverage.svg)](https://gitlab.lrz.de/vadere/vadere/commits/stable) |
## Installation
......@@ -101,16 +101,15 @@ switch to another branch and switch back again using the command line or any oth
Please see [Contribution guidelines](CONTRIBUTING.md). The document defines guidelines for coding style and commit messages.
## Release History
- 0.1 initial release of the software as open source (2016-08-05)
- 0.2 stability and usability improved, additional pedestrian simulation models are supported (2016-12-22)
## Contributors
People who have contributed code to the project at the Munich University of Applied Sciences (in alphabetical order):
Florian Albrecht, Benjamin Degenhart, Felix Dietrich, Benedikt Kleinmeier, Jakob Schöttl, Michael Seitz, Swen Stemmer, Isabella von Sivers, Mario Teixeira Parente, Peter Zarnitz, Benedikt Zönnchen
Florian Albrecht, Benjamin Degenhart, Felix Dietrich, Marion Gödel, Benedikt Kleinmeier, Daniel Lehmberg, Jakob Schöttl, Stefan Schuhbäck, Michael Seitz, Swen Stemmer, Isabella von Sivers, Mario Teixeira Parente, Peter Zarnitz, Benedikt Zönnchen
## Changelog
See [CHANGELOG.md](CHANGELOG.md) for a list of changes.
## License
......
......@@ -2,7 +2,7 @@
# scenario files under "VadereModelTests" subdirectory.
#
# Note: script contains some print statements so that progress can be tracked
# a little bit
# a little bit while script is running in continuous integration pipeline.
# Wach out: call this script from root directory of project. E.g.
#
......@@ -32,9 +32,6 @@ def find_scenario_files(path="VadereModelTests", scenario_search_pattern = "*.sc
if scenario_path_excluded == False:
scenario_files.append(scenario_path)
print("Total scenario files: {}".format(len(scenario_files)))
# print("Exclude patterns: {}".format(exclude_patterns))
return sorted(scenario_files)
def run_scenario_files_with_vadere_console(scenario_files, vadere_console="VadereGui/target/vadere-console.jar", scenario_timeout_in_sec=60):
......@@ -50,13 +47,11 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
for i, scenario_file in enumerate(scenario_files):
try:
# Surpress this output to print only failed scenarios.
# print("Running scenario file ({}/{}): {}".format(i + 1, total_scenario_files, scenario_file))
print("Running scenario file ({}/{}): {}".format(i + 1, total_scenario_files, scenario_file))
# Measure wall time and not cpu because it is the easiest.
# Measure wall time and not CPU time simply because it is the simplest method.
wall_time_start = time.time()
# Use timout feature, check return value and capture stdout/stderr to a PIPE (use completed_process.stdout to get it).
completed_process = subprocess.run(args=["java", "-enableassertions", "-jar", vadere_console, "scenario-run", "-f", scenario_file, "-o", output_dir],
timeout=scenario_timeout_in_sec,
......@@ -67,16 +62,11 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
wall_time_end = time.time()
wall_time_delta = wall_time_end - wall_time_start
# Surpress this output to print only failed scenarios.
# print("Finished scenario file ({:.1f} s): {}".format(wall_time_delta, scenario_file))
print("Finished scenario file ({:.1f} s): {}".format(wall_time_delta, scenario_file))
passed_scenarios.append(scenario_file)
except subprocess.TimeoutExpired as exception:
prefix = ""
if "TestOSM" in scenario_file:
prefix = " * OSM * "
print(prefix + "Scenario file failed: {}".format(scenario_file))
print("Scenario file failed: {}".format(scenario_file))
print("-> Reason: timeout after {} s".format(exception.timeout))
failed_scenarios_with_exception.append((scenario_file, exception))
except subprocess.CalledProcessError as exception:
......@@ -87,15 +77,25 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
print("-> Reason: non-zero return value {}".format(exception.returncode))
failed_scenarios_with_exception.append((scenario_file, exception))
if os.path.exists(output_dir):
shutil.rmtree(output_dir)
return {"passed": passed_scenarios, "failed": failed_scenarios_with_exception}
if __name__ == "__main__":
print("Output is only shown for failed scenarios!")
def print_summary(passed_and_failed_scenarios):
total_passed_scenarios = len(passed_and_failed_scenarios["passed"])
total_failed_scenarios = + len(passed_and_failed_scenarios["failed"])
total_scenarios = total_passed_scenarios + total_failed_scenarios
print("###########")
print("# Summary #")
print("###########")
print("")
print("Total scenario runs: {}".format(total_scenarios))
print("Passed: {}".format(total_passed_scenarios))
print("Failed: {}".format(total_failed_scenarios))
if __name__ == "__main__":
long_running_scenarios = [
"basic_4_1_wall_gnm1",
"queueing",
......@@ -118,6 +118,7 @@ if __name__ == "__main__":
passed_and_failed_scenarios["passed"].extend(tmp_passed_and_failed_scenarios["passed"])
passed_and_failed_scenarios["failed"].extend(tmp_passed_and_failed_scenarios["failed"])
print_summary(passed_and_failed_scenarios)
if len(passed_and_failed_scenarios["failed"]) > 0:
exit(1)
......
package org.vadere.simulator.util;
import org.apache.commons.math3.util.Pair;
import org.jetbrains.annotations.NotNull;
import org.vadere.state.scenario.Obstacle;
import org.vadere.state.scenario.Source;
import org.vadere.state.scenario.Topography;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class TopographyChecker {
private final Topography topography;
public TopographyChecker(@NotNull final Topography topography) {
this.topography = topography;
}
public List<Pair<Obstacle, Obstacle>> checkObstacleOverlap() {
List<Pair<Obstacle, Obstacle>> intersectList = new ArrayList<>();
for (int i = 0; i < topography.getObstacles().size(); i++) {
for (int j = i + 1; j < topography.getObstacles().size(); j++) {
Obstacle obs1 = topography.getObstacles().get(i);
Obstacle obs2 = topography.getObstacles().get(j);
if (obs1.getShape().intersects(obs2.getShape())) {
intersectList.add(Pair.create(obs1, obs2));
}
}
}
return intersectList;
}
public boolean hasObstacleOverlaps() {
return checkObstacleOverlap().size() > 0;
}
public List<Source> getSourceWithoutTarget() {
return topography.getSources().stream()
.filter(s -> s.getAttributes().getTargetIds().size() == 0)
.collect(Collectors.toList());
}
}
package org.vadere.simulator.util;
import org.apache.commons.math3.util.Pair;
import org.junit.Test;
import org.vadere.state.attributes.scenario.AttributesObstacle;
import org.vadere.state.scenario.Obstacle;
import org.vadere.state.scenario.Topography;
import org.vadere.util.geometry.shapes.VRectangle;
import org.vadere.util.geometry.shapes.VShape;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
public class TopographyCheckerTest {
@Test
public void testCheckObstacleOverlapHasOverlap(){
Topography topography = new Topography();
Obstacle obs1 = new Obstacle(new AttributesObstacle(0, new VRectangle(0,0,1,1)));
Obstacle obs2 = new Obstacle(new AttributesObstacle(1, new VRectangle(0,0,1,1)));
topography.addObstacle(obs1);
topography.addObstacle(obs2);
TopographyChecker topcheck = new TopographyChecker(topography);
List<Pair<Obstacle, Obstacle>> actualList = topcheck.checkObstacleOverlap();
assertEquals(1, actualList.size());
}
@Test
public void testCheckObstacleOverlapHasNoOverlap(){
Topography topography = new Topography();
Obstacle obs1 = new Obstacle(new AttributesObstacle(0, new VRectangle(0,0,1,1)));
Obstacle obs2 = new Obstacle(new AttributesObstacle(1, new VRectangle(1.1,0,1,1)));
topography.addObstacle(obs1);
topography.addObstacle(obs2);
TopographyChecker topcheck = new TopographyChecker(topography);
List<Pair<Obstacle, Obstacle>> actualList = topcheck.checkObstacleOverlap();
assertEquals(0, actualList.size());
}
@Test
public void testCheckObstacleOverlapReturnsNoOverlapsIfTwoSegmentsTouch(){
Topography topography = new Topography();
Obstacle obs1 = new Obstacle(new AttributesObstacle(0, new VRectangle(0,0,1,1)));
Obstacle obs2 = new Obstacle(new AttributesObstacle(1, new VRectangle(1,0,1,1)));
topography.addObstacle(obs1);
topography.addObstacle(obs2);
TopographyChecker topcheck = new TopographyChecker(topography);
List<Pair<Obstacle, Obstacle>> actualList = topcheck.checkObstacleOverlap();
assertEquals(0, actualList.size());
}
}
\ No newline at end of file
package org.vadere.state.scenario;
import org.jetbrains.annotations.NotNull;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.attributes.scenario.AttributesObstacle;
......@@ -10,10 +11,7 @@ public class Obstacle extends ScenarioElement {
private AttributesObstacle attributes;
public Obstacle(AttributesObstacle attributes) {
if (attributes == null)
throw new IllegalArgumentException("Attributes must not be null.");
public Obstacle(@NotNull AttributesObstacle attributes) {
this.attributes = attributes;
}
......
package org.vadere.util.geometry.shapes;
import java.awt.Shape;
import java.awt.geom.Area;
import org.vadere.util.geometry.ShapeType;
......@@ -26,4 +27,12 @@ public interface VShape extends Shape, Cloneable {
VPoint getCentroid();
ShapeType getType();
default boolean intersects(VShape shape){
Area thisShape = new Area(this);
Area otherShape = new Area(shape);
Area thisShapeCpy = new Area(this);
thisShape.subtract(otherShape);
return !thisShape.equals(thisShapeCpy);
}
}
package org.vadere.util.geometry.shapes;
import org.junit.Test;
import static org.junit.Assert.*;
public class VShapeTest {
@Test
public void testIntersectShapesReturnsTrueWithOverlappingShapes(){
VShape a = new VRectangle(0,0,1,1);
VShape b = new VRectangle(0,0,1,1);
assertTrue(a.intersects(b));
}
@Test
public void testIntersectShapesReturnsFalseWithNonOverlappingShapes(){
VShape a = new VRectangle(0,0,1,1);
VShape b = new VRectangle(1.1,0,1,1);
assertFalse(a.intersects(b));
}
@Test
public void testIntersectShapesReturnsTrueWithOverlappingCircles(){
VShape a = new VRectangle(0,0,1,1);
VShape b = new VCircle(new VPoint(-1, -1), 5.0);
assertTrue(a.intersects(b));
}
}
\ No newline at end of file
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