Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvements #2242

Merged
merged 10 commits into from
Oct 30, 2019
Merged

Conversation

REASY
Copy link
Collaborator

@REASY REASY commented Oct 27, 2019

Main changes in PR:

  • Replace data structures to appropriate one to reduce runtime
  • Explicitly put check for the log level because Actor Logging need to calculate args before calling logging method
  • Intensive operation to get idle vehicles is cached and passed instead of re-computing it

Run params:

Results

Run Iter 0, s Iter 1, s Iter 2, s Iter 3, s Iter 4, s Iter 5, s Sum, s
Baseline 4212 3145 3203 3102 3253 3133 20048
Optimized 2775 1927 1886 1895 1901 2005 12389
Baseline / Optimized 1.52 1.63 1.70 1.64 1.71 1.56 1.62

Profiling tool results

Baseline overall

image

Baseline 1-th iteration

image

Optimized overall

image

Optimized 1-th iteration

image


This change is Reviewable

@@ -150,15 +150,15 @@ class VehicleCentricMatchingForRideHail(
}

private def greedyAssignment(trips: List[AssignmentKey]): List[AssignmentKey] = {
val Rok = mutable.ListBuffer.empty[CustomerRequest]
val Vok = mutable.ListBuffer.empty[VehicleAndSchedule]
val Rok = mutable.HashSet.empty[CustomerRequest]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haitamlaarabi please, take a look to these changes. It should not break anything, but still.

@@ -177,8 +177,8 @@ object AlonsoMoraPoolingAlgForRideHail {
solutionSpaceSizePerVehicle: Int
): List[(RideHailTrip, VehicleAndSchedule, Double)] = {
import scala.collection.mutable.{ListBuffer => MListBuffer}
val Rok = MListBuffer.empty[CustomerRequest]
val Vok = MListBuffer.empty[VehicleAndSchedule]
val Rok = collection.mutable.HashSet.empty[CustomerRequest]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haitamlaarabi please, take a look to these changes. It should not break anything, but still.

Copy link
Contributor

@colinsheppard colinsheppard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@JustinPihony JustinPihony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments which I need addressed before approving.

VehicleAllocations(allocResponses)
}

val repositioningManager: RepositioningManager = createRepositioningManager()
logger.info(s"Using ${repositioningManager.getClass.getSimpleName} as RepositioningManager")

def findDepotsForVehiclesInNeedOfRefueling(cavOnly: Boolean = true): Vector[(Id[Vehicle], ParkingStall)] = {
val idleVehicleIdsAndLocation: Vector[(Id[Vehicle], RideHailAgentLocation)] =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems dangerous to push back to the caller. If the filtering of excluded is required then it should be handled inside of the implementation itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JustinPihony not sure why this is dangerous? I've changed the contract - now you have to provide idleVehicles. Maybe I should rename it just to vehicles?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colinsheppard what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah....if the contract is fine to change then I'm ok with that - but it is definitely a contract change - if we are ok with the potential for non-idle and exclusionary coming in in other means then that's fine. But if it should always be idle excluded then it is not ok.

@@ -81,8 +81,11 @@ class DemandFollowingRepositioningManager(val beamServices: BeamServices, val ri
createClusters
}

def repositionVehicles(tick: Int): Vector[(Id[Vehicle], Location)] = {
val nonRepositioningIdleVehicles = rideHailManager.vehicleManager.getIdleVehiclesAndFilterOutExluded.values
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above - we shouldn't push this to the calling method - unless it is NOT an implementation detail.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're repositioning only idle vehicles so it seems ok for me to pass the vehicles to this method.

@REASY
Copy link
Collaborator Author

REASY commented Oct 29, 2019

test!

@wrashid wrashid merged commit 98eaff4 into develop Oct 30, 2019
@wrashid wrashid deleted the art/perf-improvements-for-b-highttech-4ci branch October 30, 2019 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants