Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
1e657922
Commit
1e657922
authored
Sep 22, 2020
by
Tobias Meuser
Browse files
Merged tm/vehicular-services into master-integration
parents
2a24c1a4
2c04ab95
Changes
46
Expand all
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/vehicular/decision/DefaultVehicleDecisionComponent.java
0 → 100755
View file @
1e657922
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package
de.tud.kom.p2psim.impl.vehicular.decision
;
import
java.util.List
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.RoadInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkRoute
;
public
class
DefaultVehicleDecisionComponent
extends
AbstractVehicleDecisionComponent
{
public
DefaultVehicleDecisionComponent
(
Host
pHost
)
{
super
(
pHost
);
}
@Override
public
BenefitBasedRoute
getOptimalRoute
(
RoadNetworkRoute
pInvestigatedRoute
,
List
<
RoadInformation
>
knownInformation
)
{
if
(
getVehicleInformation
().
isValid
())
{
return
new
BenefitBasedRoute
(
0
,
pInvestigatedRoute
);
}
return
null
;
}
}
src/de/tud/kom/p2psim/impl/vehicular/decision/DynamicInformationVehicleDecisionComponent.java
0 → 100755
View file @
1e657922
This diff is collapsed.
Click to expand it.
src/de/tud/kom/p2psim/impl/vehicular/decision/LatestPossibleVehicleDecisionComponent.java
0 → 100755
View file @
1e657922
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package
de.tud.kom.p2psim.impl.vehicular.decision
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.routing.DijkstraAlgorithm
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.routing.LatestPossibleDijkstraAlgorithm
;
public
class
LatestPossibleVehicleDecisionComponent
extends
StaticInformationVehicleDecisionComponent
{
public
LatestPossibleVehicleDecisionComponent
(
Host
pHost
)
{
super
(
pHost
);
}
@Override
protected
DijkstraAlgorithm
getRoutingAlgorithm
()
{
return
new
LatestPossibleDijkstraAlgorithm
();
}
}
src/de/tud/kom/p2psim/impl/vehicular/decision/OptimalVehicleDecisionComponent.java
0 → 100755
View file @
1e657922
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package
de.tud.kom.p2psim.impl.vehicular.decision
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.routing.DijkstraAlgorithm
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.routing.GlobalKnowledgeDijkstraAlgorithm
;
public
class
OptimalVehicleDecisionComponent
extends
StaticInformationVehicleDecisionComponent
{
public
OptimalVehicleDecisionComponent
(
Host
pHost
)
{
super
(
pHost
);
}
@Override
protected
DijkstraAlgorithm
getRoutingAlgorithm
()
{
return
new
GlobalKnowledgeDijkstraAlgorithm
();
}
/*
@Override
public BenefitBasedRoute getOptimalRoute(RoadNetworkRoute pInvestigatedRoute, List<RoadInformation> knownInformation) {
if (getVehicleInformation().isValid()) {
DijkstraAlgorithm dijkstraAlgorithm = new GlobalKnowledgeDijkstraAlgorithm();
List<RoadInformation> relevant = new ArrayList<>();
if (knownInformation != null) {
for (RoadInformation roadInformation : knownInformation) {
RoadProperty property = roadInformation.getValue();
if (!property.getValue().equals(property.getDefaultProperty().getValue())) {
if (roadInformation.getValue().getDuration() == -1
|| roadInformation.getValue().getDetectionDate()
+ roadInformation.getValue().getDuration() > Time.getCurrentTime()
+ getTimeToEvent(pInvestigatedRoute, roadInformation.getEdge())) {
if (!relevant.contains(roadInformation)) {
relevant.add(roadInformation);
}
}
}
}
}
RoadNetworkRoute route = dijkstraAlgorithm.findRoute(RoadNetwork.CURRENT_ROAD_NETWORK, getVehicleInformation().getCurrentRoute().getStart(), getVehicleInformation().getCurrentRoute().getDestination(), Collections.emptyList(), Collections.emptyList(), relevant);
if (route != null) {
double oldCosts = 0;
for (RoadNetworkEdge edge : pInvestigatedRoute.getRoute()) {
oldCosts += edge.calculateStandardEdgeCosts();
if (relevant != null) {
for (RoadInformation roadInformation : relevant) {
double additionalCosts = edge.calculateAdditionalCostIfKnown(roadInformation.getValue());
if (additionalCosts > (Long) roadInformation
.getAttribute(AvailableInformationAttributes.EXPECTED_DURATION) / Time.SECOND) {
additionalCosts = (Long) roadInformation
.getAttribute(AvailableInformationAttributes.EXPECTED_DURATION) / (double) Time.SECOND;
}
oldCosts += additionalCosts;
}
}
}
double newCosts = 0;
for (RoadNetworkEdge edge : route.getRoute()) {
newCosts += edge.calculateStandardEdgeCosts();
if (relevant != null) {
for (RoadInformation roadInformation : relevant) {
double additionalCosts = edge.calculateAdditionalCostIfKnown(roadInformation.getValue());
if (additionalCosts > (Long) roadInformation
.getAttribute(AvailableInformationAttributes.EXPECTED_DURATION) / Time.SECOND) {
additionalCosts = (Long) roadInformation
.getAttribute(AvailableInformationAttributes.EXPECTED_DURATION) / (double) Time.SECOND;
}
newCosts += additionalCosts;
}
}
}
if (oldCosts > newCosts) {
return new BenefitBasedRoute(oldCosts - newCosts, route);
}
}
return new BenefitBasedRoute(0, pInvestigatedRoute);
}
return null;
}
private long getTimeToEvent(RoadNetworkRoute pRoute, RoadNetworkEdge pEventEdge) {
long timeToEvent = 0;
if (pRoute.getRoute().indexOf(pEventEdge) > 0) {
for (int i = 1; i < pRoute.getRoute().size(); i++) {
if (!pRoute.getRoute().get(i).equals(pEventEdge)) {
timeToEvent += VehiclePathTrackerFactory.getVehiclePathTracker().getTravelTime(pEventEdge);
} else {
break;
}
}
}
return (long) (timeToEvent * Time.SECOND * 0.9);
}
*/
}
src/de/tud/kom/p2psim/impl/vehicular/decision/StaticInformationVehicleDecisionComponent.java
0 → 100755
View file @
1e657922
This diff is collapsed.
Click to expand it.
src/de/tud/kom/p2psim/impl/vehicular/decision/VisionBasedVehicleDecisionComponent.java
0 → 100755
View file @
1e657922
This diff is collapsed.
Click to expand it.
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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