Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Driver Breaks #2193

Closed
GuyBenhaim opened this issue Oct 8, 2020 · 11 comments
Closed

Driver Breaks #2193

GuyBenhaim opened this issue Oct 8, 2020 · 11 comments
Assignees
Labels
Help Needed Modeling/Usage problem Lang: .NET .Net wrapper issue Solver: Routing - break Routing break related issue Solver: Routing Uses the Routing library and the original CP solver
Milestone

Comments

@GuyBenhaim
Copy link

GuyBenhaim commented Oct 8, 2020

Hello,
For Google.OrTools.7.5.7466 in .Net, using Routing

I'm checking Breaks using IntervalVar. Aiming for one break per vehicle, that occurs anytime within a certain time-window.
With a small set (1 vehicle, 2 nodes: P + D) adding the breaks does not seem to change the solution times at all. I do get a solution.

I used the newer version of the API:

SetBreakIntervalsOfVehicle(
    std::vector<IntervalVar*> breaks,
    int vehicle,
    int pre_travel_evaluator,
    int post_travel_evaluator);

To simplify I set the last two parameters to -1 (which should make these return 0 for pre and post times).

Anyone successful with implementing such case? (i.e. getting a correct and consistent solution)
Can this API work, are we forced to use wacky fake-nodes?

p.s. Posted also in GitHub

Thanks

@Mizux Mizux added Help Needed Modeling/Usage problem Lang: .NET .Net wrapper issue Solver: Routing Uses the Routing library and the original CP solver labels Oct 8, 2020
@Mizux Mizux added this to the v8.1 milestone Oct 8, 2020
@Mizux
Copy link
Collaborator

Mizux commented Oct 8, 2020

did you try master ? v7.5 is quite old and IIRC there was some dev on break recently...

@Mizux Mizux added the Solver: Routing - break Routing break related issue label Oct 8, 2020
@GuyBenhaim
Copy link
Author

GuyBenhaim commented Oct 8, 2020

Changed to v7.8 and used this:

break_intervals[vehicle] = model.solver().MakeFixedDurationIntervalVar(
                             0, end_time, 10000, false, "vehicle " + vehicle.ToString());
time_dimension.SetBreakIntervalsOfVehicle(break_intervals, vehicle, -1,-1);

With the SetBreakIntervalsOfVehicle condition solver seems to push the visits to be as late as possible, i.e. the solution always visits the end point at the latest possibe (end time = 60000). This occurs even when setting IntervalVar Duration=0.
However, commenting-out just this condition pulls the visits to be as early as possible and the end point is visited early.
The total time remains the same, the differences in visit times are the same ....

For example if visits with the condition are 57000 > 58000 > 59000 > 60000
Voiding it gives 0 > 1000 > 2000 > 3000

@GuyBenhaim
Copy link
Author

GuyBenhaim commented Oct 8, 2020

Probing IntervalVar:
long startvalue = solution.StartValue(brk_var);
long endvalue = solution.EndValue(brk_var);

It is performed and gets start and end values assigned to it, but only pushes the visit times (i.e. no effect on time between node and total solution time )
Its gets more weird: setting span cost to 0, prevents the visits being pushed to the latest possible, but still no effect on visits and total time.
time_dimension.SetSpanCostCoefficientForVehicle(0, vehicle);

@GuyBenhaim
Copy link
Author

GuyBenhaim commented Oct 12, 2020

I would like to know whether a basic one-break with one vehicle case works using time_dimension.SetBreakIntervalsOfVehicle
Any experience ? I did not yet mange to get this to work ... (v7.5 or v7.8)

@GuyBenhaim
Copy link
Author

GuyBenhaim commented Oct 12, 2020

Is there a way for the vehicle break to start certain T time-units after the vehicle's start time, which is
IntVar start = time_dimension.CumulVar(routing.Start(v))

Either by setting the intervalvar's min_start and max_start parameters, using start:
break_intervals[vehicle] = model.solver().MakeFixedDurationIntervalVar(start, start+T, 10000, false, "vehicle " + vehicle.ToString());

Or by adding a proper constraint:
model.solver().MakeIntervalVarRelation(break_interval, start) ?
model.solver().Add(break_interval.StartMin() > start) ?
break_interval.SetStartMin(start) ?

@GuyBenhaim
Copy link
Author

GuyBenhaim commented Oct 16, 2020

Any ideas? When vehicles start after t=0, defining breaks based on an absolute start time does not work ...

@Mizux Mizux self-assigned this Nov 4, 2020
@Mizux Mizux modified the milestones: v8.1, v8.2 Nov 25, 2020
@GuyBenhaim
Copy link
Author

Is this a feature to be supported? or a possible to trick to support on 7.X ?

@Mizux
Copy link
Collaborator

Mizux commented Dec 4, 2020

so using a duration dimension like explaining in another thread won't make it ?

@GuyBenhaim
Copy link
Author

Should work as long as no is added Slack in the time-dimension.

BTW: I saw Laurent's earlier request. Should we move all discussion to GitHub?

@lperron
Copy link
Collaborator

lperron commented Dec 4, 2020 via email

@Mizux
Copy link
Collaborator

Mizux commented Dec 4, 2020

Since break is a hot and specific topic, I like github issue since you can have several labels while discussion seems to be one category only. 😞
e.g.: https://github.com/google/or-tools/labels/routing_break it's nice to see all related routing break issues/topics
note: waiting for community/community#19 🤞

@Mizux Mizux modified the milestones: v8.2, v8.3 Feb 10, 2021
@Mizux Mizux modified the milestones: v9.0, v9.1 Mar 22, 2021
@Mizux Mizux modified the milestones: v9.1, v9.2 Aug 9, 2021
@Mizux Mizux modified the milestones: v9.2, Backlog Oct 5, 2021
@google google locked and limited conversation to collaborators Dec 7, 2021
@lperron lperron converted this issue into discussion #2982 Dec 7, 2021
@Mizux Mizux removed this from the Backlog milestone May 2, 2022
@Mizux Mizux added this to the v9.4 milestone May 2, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Help Needed Modeling/Usage problem Lang: .NET .Net wrapper issue Solver: Routing - break Routing break related issue Solver: Routing Uses the Routing library and the original CP solver
Projects
None yet
Development

No branches or pull requests

3 participants