ankane / or-tools-ruby

Operations research tools for Ruby
Apache License 2.0
179 stars 25 forks source link

Service times for VRP PD/TW problem. #22

Closed stevenshack closed 3 years ago

stevenshack commented 3 years ago

I'm trying to figure out how to add service times to a VRP problem with PD/TW constraints.

I can simply add service time to the transit time in my transit cost callback. But that's tacky.

Is there a way to register a unary callback in addition to the regular transit callback? They should increment the time for that vehicle so eg: Vehicle leaves an hour later from that location after servicing for 60 minutes.

In ideal circumstances I'd like to add multiple callbacks - One for pickup labour, one for delivery labour, one for service time. Is there a way to do this with OR-tools? Am I missing something?

ankane commented 3 years ago

Hey @stevenshack, not sure about this specifically, but if the Python library has a method for it that's missing in Ruby, we can add it.

stevenshack commented 3 years ago

I'm still stuck on service times and having to hack an extra long trip (drivetime+servicetime) then subtracting out the service time when I output my schedule. Yech. This is a limit from or-tools though, not you.

But I've run up across a new problem. How to take in existing route dispatches. ala https://github.com/google/or-tools/issues/1202

The python api has a SetValues method, which doesn't seem to exist in our ruby API. There is a set_range, but I don't think that's what I need. I'd like to do something like this.

location_index = manager.node_to_index(location)

Only this vehicle can visit this location.

routing.vehicle_var(location_index).set_values([-1, vehicle])

So I can take in existing dispatches, and fix the driver to visit that location. That way a driver would only see new visit locations, and never have his existing assignments changed.

Can ee add a set_values?