Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
rewertvsp committed Jun 21, 2024
1 parent 4646328 commit ef954c1
Showing 1 changed file with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -902,8 +902,8 @@ else if (population == null)
HashMap<Id<Link>, Link> demandBasesLinks;
double sumOfDemandBasedLinks;
boolean pickupIsDemandBase = true;
Link linkPickup;
Link linkDelivery;
Link linkPickup = null;
Link linkDelivery= null;
double sumOfPossibleLinkLengthPickup = possibleLinksPickup.values().stream().mapToDouble(Link::getLength).sum();
double sumOfPossibleLinkLengthDelivery = possibleLinksDelivery.values().stream().mapToDouble(Link::getLength).sum();
if (numberOfPickupLocations == null && numberOfDeliveryLocations == null)
Expand All @@ -928,11 +928,7 @@ else if (numberOfPickupLocations != null) {
demandBasedLink);
if (pickupIsDemandBase) {
linkPickup = demandBasedLink;
linkDelivery = findNextUsedLink(scenario, indexShape, possibleLinksDelivery,
numberOfDeliveryLocations, areasForDeliveryLocations, setLocationsOfDelivery,
usedDeliveryLocations, possiblePersonsDelivery, nearestLinkPerPersonDelivery,
crsTransformationNetworkAndShape, countOfLinks - 1);
while (usedDeliveryLocations.contains(linkDelivery.getId().toString())) {
while (linkDelivery == null || usedDeliveryLocations.contains(linkDelivery.getId().toString())) {
linkDelivery = findNextUsedLink(scenario, indexShape, possibleLinksDelivery,
numberOfDeliveryLocations, areasForDeliveryLocations, setLocationsOfDelivery,
usedDeliveryLocations, possiblePersonsDelivery, nearestLinkPerPersonDelivery,
Expand All @@ -944,11 +940,7 @@ else if (numberOfPickupLocations != null) {
}
} else {
linkDelivery = demandBasedLink;
linkPickup = findNextUsedLink(scenario, indexShape, possibleLinksPickup,
numberOfPickupLocations, areasForPickupLocations, setLocationsOfPickup,
usedPickupLocations, possiblePersonsPickup, nearestLinkPerPersonPickup,
crsTransformationNetworkAndShape, countOfLinks - 1);
while (usedPickupLocations.contains(linkPickup.getId().toString())) {
while (linkPickup == null || usedPickupLocations.contains(linkPickup.getId().toString())) {
linkPickup = findNextUsedLink(scenario, indexShape, possibleLinksPickup,
numberOfPickupLocations, areasForPickupLocations, setLocationsOfPickup,
usedPickupLocations, possiblePersonsPickup, nearestLinkPerPersonPickup,
Expand Down

0 comments on commit ef954c1

Please sign in to comment.