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

Heterogeneous vehicle type #245

Merged
merged 99 commits into from
Jun 22, 2023
Merged

Heterogeneous vehicle type #245

merged 99 commits into from
Jun 22, 2023

Conversation

wouterkool
Copy link
Collaborator

@wouterkool wouterkool commented Jun 16, 2023

This PR:

  • Implements heterogeneous vehicle types and uses it to support heterogeneous vehicle capacities
  • This PR supersedes Heterogeneous capacity #203
  • Partially implements Heterogeneous fleet #188 (does not support heterogeneous cost).
  • Adds and passes relevant tests.
  • Has well-formatted code and documentation.

Benchmark

On VRPTW.

This PR (c25917c; job ID 2670926; 10x seeds/1h runtime with configs/vrptw.toml):

 Avg. objective: 333197.6 (min: 333086, max: 333324)
Avg. iterations: 123194.3 (min: 107088, max: 130939)

Notes:

  • It is essential that you add a test when making code changes.
    This keeps the code coverage level up, and helps ensure the changes work as intended.
  • When fixing a bug, you must add a test that would produce the bug in the master branch, and then show that it is fixed with the new code.
  • New code additions must be well formatted. Changes should pass the pre-commit workflow, which you can set up locally using pre-commit.
  • Docstring additions must render correctly, including escapes and LaTeX.

wouterkool and others added 30 commits March 29, 2023 16:19
* Remove angleCenter from route
* Remove sorting of routes in LocalSearch::exportIndividual
* Take into account route assignment when comparing individuals
* Add tests for heterogeneous capacities
Co-authored-by: Leon Lan <30997278+leonlan@users.noreply.github.com>
Co-authored-by: Leon Lan <30997278+leonlan@users.noreply.github.com>
Co-authored-by: Leon Lan <30997278+leonlan@users.noreply.github.com>
Co-authored-by: Leon Lan <30997278+leonlan@users.noreply.github.com>
Co-authored-by: Leon Lan <30997278+leonlan@users.noreply.github.com>
Co-authored-by: Leon Lan <30997278+leonlan@users.noreply.github.com>
* Rename num_vehicles to max_num_routes
* Rename num_routes to num_non_empty_routes
@wouterkool
Copy link
Collaborator Author

Summarizing, I think there are a few leftover issues which I think should be non-blocking. Can we finish this PR and put this in a seperate issue?

These I think we should definitely address:

  • How to read heterogeneous instances and solutions
  • How to print heterogeneous solutions

These I am happy with the current situation but we could change if you feel strongly

  • Whether or not to check all vehicle types for empty after an improving move (now yes, unlikely to make a difference)
  • Whether using VehicleType = int vs std::optional<size_t> (now int with -1 unassigned)
  • Whether to keep assignedVehicleTypes as attribute (now yes)
  • Whether to allow empty routes in the solution (now no)
  • Which argument order to use for VehicleType (now capacity, num_available)
  • Whether we can do transformRoutes as a separate function or in the constructor (now seperate function, suggestions welcome)
  • Whether we can remove make_heterogeneous helper (not necessary I think)

@N-Wouda
Copy link
Member

N-Wouda commented Jun 21, 2023

  • How to read heterogeneous instances and solutions
  • How to print heterogeneous solutions
  • Whether we can remove make_heterogeneous helper (not necessary I think)

Agree, the first two are most important. I proposed above that we revert our printing to current main. I also want to get rid of make_heterogeneous because it seems unnecessary once we can read heterogeneous instances. We similarly do not modify ProblemData instances for other things; we just create a new instance and read() that.

  • Whether or not to check all vehicle types for empty after an improving move (now yes, unlikely to make a difference)

I think the current implementation is fine and much simpler than the initial one.

  • Whether to keep assignedVehicleTypes as attribute (now yes)

I want to get rid of this. A client has neighbours, sure, but how is a client assigned a vehicle type? A client is part of a Route, which has a vehicle (type). Something like client2route makes more sense to me than assignedVehicleTypes. Those assignments could then, hypothetically, be used to determine the vehicle types 'of' each client.

  • Whether to allow empty routes in the solution (now no)

No is OK, but I'm really not sure why this was in the scope of this PR in the first place.

  • Which argument order to use for VehicleType (now capacity, num_available)

I'd like to go back to the original, but this isn't worth the discussion to me.

  • Whether we can do transformRoutes as a separate function or in the constructor (now seperate function, suggestions welcome)

Removed this in the other PR.

@wouterkool
Copy link
Collaborator Author

@N-Wouda thanks for the contributions, feel free to propose an alternative for the assignedVehicleTypes and can you then do a benchmark run? Please merge it when you think it's ready.

@N-Wouda N-Wouda self-requested a review June 21, 2023 20:56
Copy link
Member

@N-Wouda N-Wouda left a comment

Choose a reason for hiding this comment

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

I'm going to commit a few more changes after reading this again, but I'm OK with this. Let's copy the reading stuff over to a new issue and merge this after the benchmark completes OK.

Benchmark should be in tomorrow morning.

@N-Wouda
Copy link
Member

N-Wouda commented Jun 22, 2023

Avg. objective: 333197.6 (min: 333086, max: 333324)
Avg. iterations: 123194.3 (min: 107088, max: 130939)

Slightly better than #240, which was the last benchmark I could find. Good!

@N-Wouda N-Wouda merged commit 772eed1 into main Jun 22, 2023
9 of 11 checks passed
@N-Wouda N-Wouda deleted the heterogeneous-vehicle-type branch June 22, 2023 06:58
@N-Wouda N-Wouda mentioned this pull request Jun 22, 2023
3 tasks
@wouterkool wouterkool restored the heterogeneous-vehicle-type branch June 22, 2023 07:56
@N-Wouda N-Wouda mentioned this pull request Jul 4, 2023
@N-Wouda N-Wouda deleted the heterogeneous-vehicle-type branch August 11, 2023 20:46
@leonlan leonlan mentioned this pull request Sep 3, 2023
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.

None yet

3 participants