How to prohibit parallel visits (overlapping visits) when delivering split demands?

49 Views Asked by At

I have a VRP where some demands are greater than the vehicles' capacity.

I split the big demands in multiples nodes to deliver them separately. However, these nodes that represent the same location are receiving visits from multiple vehicles at the same time, which the problem does not allow.

To avoid parallel visits, I implemented the following constraint:

std::vector<IntervalVar*> intervals;
// Node 0 is the depot.
for (size_t node_index = 1; node_index < data.num_nodes; node_index++) {
    int64_t index = manager.NodeToIndex(RoutingIndexManager::NodeIndex(node_index));
    intervals.push_back(solver->MakeFixedDurationIntervalVar(
        time_dimension.CumulVar(index), data.service_time, "service_interval"));
}
solver->AddConstraint(solver->MakeDisjunctiveConstraint(
    intervals, "split_node_invervals"));

I used the "MakeDisjunctiveConstraint" function to prohibit overlapping visits, but it doesn't work. I never used this function before, so maybe I'm doing something wrong. Is there a way to use this function differently or use another function to avoid parallel visits?

I'm implementing in c++.

0

There are 0 best solutions below