Skip to content

Commit

Permalink
Release 21.0 (#64)
Browse files Browse the repository at this point in the history
* Set version to 21.0
* applications for Sievekingplatz have been put in wrong dir

Signed-off-by: Karl Schrab <[email protected]>
  • Loading branch information
kschrab authored Mar 10, 2021
1 parent 84a4eac commit 01e50c1
Show file tree
Hide file tree
Showing 34 changed files with 224 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Each Java file must include the following license header at the top of each file

```java
/*
* Copyright (c) 2020 Fraunhofer FOKUS and others. All rights reserved.
* Copyright (c) 2021 Fraunhofer FOKUS and others. All rights reserved.
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion app/tutorials/example-applications/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion app/tutorials/highway-management/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion app/tutorials/traffic-light-communication/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion app/tutorials/weather-warning/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion bundle/src/assembly/mosaic-bundle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>scenarios/Multimodal/application</outputDirectory>
<outputDirectory>scenarios/Sievekingplatz/application</outputDirectory>
<includes>
<include>org.eclipse.mosaic.app:example-applications</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion bundle/src/assembly/resources/fed/ns3/ns3_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ns3_scratch="${ns3_simulator_folder}/scratch"
ns3_source="${ns3_simulator_folder}/src"

####### semi automatic parameters ########
ns3_federate_url="https://github.com/mosaic-addons/ns3-federate/archive/main.zip"
ns3_federate_url="https://github.com/mosaic-addons/ns3-federate/archive/21.0.zip"
ns3_url="http://www.nsnam.org/release/$ns3_version_affix.tar.bz2"

###### more automatic parameters #########
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ check_shell
required_programs=( unzip tar bison flex protoc gcc python )
required_libraries=( "libprotobuf-dev >= 3.3.0" )

omnet_federate_url="https://github.com/mosaic-addons/omnetpp-federate/archive/main.zip"
omnet_federate_url="https://github.com/mosaic-addons/omnetpp-federate/archive/21.0.zip"
inet_src_url="https://github.com/inet-framework/inet/releases/download/v4.1.1/inet-4.1.1-src.tgz"

premake5_url="https://github.com/premake/premake-core/releases/download/v5.0.0-alpha14/premake-5.0.0-alpha14-linux.tar.gz"
Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-cell/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-environment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-mapping/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-ns3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-omnetpp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-output/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-sns/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-sumo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
12 changes: 12 additions & 0 deletions legal/templates/license-header-2021.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Copyright (c) 2021 Fraunhofer FOKUS and others. All rights reserved.

See the NOTICE file(s) distributed with this work for additional
information regarding copyright ownership.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0

SPDX-License-Identifier: EPL-2.0

Contact: [email protected]
2 changes: 1 addition & 1 deletion lib/mosaic-communication/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion lib/mosaic-database/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion lib/mosaic-docker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion lib/mosaic-geomath/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>20.1-SNAPSHOT</version>
<version>21.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
/*
* Copyright (c) 2021 Fraunhofer FOKUS and others. All rights reserved.
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contact: [email protected]
*/

package org.eclipse.mosaic.lib.spatial;

import org.eclipse.mosaic.lib.geo.Point;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Set;

/**
* Generic implementation of a node-based A* algorithm for routing across {@link Point} based road networks. In order to use
* this, the routing network has to be presented as a list of network nodes implementing {@link AStar.Node}. The
* routing behavior can be influenced by the costs returned by the node implementation.
*/
public class AStar<T extends AStar.Node<T, P>, P extends Point<P>> {

private final PriorityQueue<CostNode> openList = new PriorityQueue<>();
private final Map<Node<T, P>, CostNode> openListNodes = new HashMap<>();
private final Set<Node<T, P>> closedList = new HashSet<>();

public List<T> route(Node<T, P> from, Node<T, P> to) {
CostNode destinationNode = null;
closedList.clear();
openList.clear();
boolean routeFound = false;

openList.add(new CostNode(from, 0));
// loop until destination is found or no candidates are left in open list
while (!openList.isEmpty()) {
// get node with smallest f from open list (and remove it from open list)
CostNode current = openList.poll();
openListNodes.remove(current.node);
if (current.node == to) {
// route found
routeFound = true;
destinationNode = current;
break;
}

// add succeeding nodes to open list
expandNode(current, to);

// current node is examined
closedList.add(current.node);
}

if (routeFound) {
List<T> route = new ArrayList<>();
CostNode routeNode = destinationNode;
route.add(routeNode.node.getSelf());
while (routeNode.predecessor != null) {
routeNode = routeNode.predecessor;
route.add(routeNode.node.getSelf());
}
Collections.reverse(route);
return route;
} else {
return null;
}
}

private void expandNode(CostNode node, Node<T, P> dest) {
for (Node<T, P> nextNode : node.node.getNexts()) {
if (closedList.contains(nextNode)) {
// node is already fully evaluated - skip it
continue;
}

double temporaryCosts = node.costs + node.node.getCost(nextNode);
double estimatedCostsToDestination = temporaryCosts + node.node.estimateCost(dest);

// check if next node is already in open list
CostNode nextCostNode = openListNodes.get(nextNode);
if (nextCostNode == null) {
// node is not yet in open list - add it
nextCostNode = new CostNode(nextNode, estimatedCostsToDestination);
nextCostNode.costs = temporaryCosts;
nextCostNode.predecessor = node;
openList.add(nextCostNode);
openListNodes.put(nextNode, nextCostNode);

} else if (temporaryCosts < nextCostNode.costs) {
// next node is already in open list but this way is cheaper
// remove and re-add node with updated weight to maintain queue order
openList.remove(nextCostNode);
nextCostNode.estimate = estimatedCostsToDestination;
nextCostNode.costs = temporaryCosts;
nextCostNode.predecessor = node;
openList.add(nextCostNode);
}
}
}

private class CostNode implements Comparable<CostNode> {
/**
* cost of the cheapest path from start to node
*/
private double costs;
/**
* best guess of total cost of path from start to destination if it goes through node
*/
private double estimate;

private final Node<T, P> node;
private CostNode predecessor;

private CostNode(Node<T, P> node, double estimatedCostsToDestination) {
this.node = node;
this.estimate = estimatedCostsToDestination;
this.costs = 0;
}

@Override
public int compareTo(CostNode o) {
return Double.compare(estimate, o.estimate);
}
}

/**
* A* routing network node.
*/
public interface Node<T extends Node<T, P>, P extends Point<P>> {

T getSelf();

P getPosition();

/**
* Returns a list of network nodes directly reachable from this node.
*/
List<? extends Node<T, P>> getNexts();

/**
* Returns the exact cost between adjacent network nodes.
* <p>
* Costs are typically based on distance: traveling from one node to another is cheap if the nodes are
* very close and expensive if they are far apart. However there might be other factors influencing the
* cost: e.g. travel speed, road capacity, etc.
*/
default double getCost(Node<T, P> nextNode) {
return getPosition().distanceTo(nextNode.getPosition());
}

/**
* Returns the estimated cost in order to reach the final destination node from this node.
* <p>
* The estimated cost must be lower or equal to the exact cost. If the returned value is higher than the final
* exact cost would be this node might be excluded from the routing graph before the exact cost is known
* and a potentially more expensive route might win.
* <p>
* Typically, the cost is estimated by using the straight line distance between this node and the destination
* node. However, care must be taken if exact costs between nodes do not only depend on distance but consider
* other factors (travel speed, ...) as well.
*/
default double estimateCost(Node<T, P> destinationNode) {
return getPosition().distanceTo(destinationNode.getPosition());
}
}
}
Loading

0 comments on commit 01e50c1

Please sign in to comment.