Reputation: 33
I am working on an application of the google or-tools to a scheduling problem. I am pretty satisfied with the cp_model
api, still it seems to lack some functionality only available in the vehicle routing module pywrapcp
.
Here is the basic example of a program utilizing the cp_model
module available on the official page: https://developers.google.com/optimization/scheduling/job_shop#entire-program
My question is: would it be somehow possible to introduce the setup time dimention in the above code as we would do in a regular TSP problem like this:
def distance_callback(from_index, to_index):
"""Returns the distance between the two nodes."""
# Convert from routing variable Index to distance matrix NodeIndex.
from_node = manager.IndexToNode(from_index)
to_node = manager.IndexToNode(to_index)
return data['distance_matrix'][from_node][to_node]
transit_callback_index = routing.RegisterTransitCallback(distance_callback)
# Define cost of each arc.
routing.SetArcCostEvaluatorOfAllVehicles(transit_callback_index)
The only close example found was this one: https://github.com/google/or-tools/blob/stable/examples/python/single_machine_scheduling_with_setup_release_due_dates_sat.py However, it seems to be working only with one machine.
Upvotes: 0
Views: 1252