Skip to content
Discussion options

You must be logged in to vote

Fixed using

    # Create counter dimension
    def counter_callback(from_index):
        return 1

    counter_callback_index = routing.RegisterUnaryTransitCallback(counter_callback)
    # Add Counter constraint.
    name = 'Counter'
    routing.AddDimension(
        counter_callback_index,
        0,  # no slack
        10,  # vehicle maximum travel distance
        True,  # start cumul to zero
        name)
    counter_dimension = routing.GetDimensionOrDie(name)

    idx2 = manager.NodeToIndex(2)
    idx4 = manager.NodeToIndex(4)
    routing.solver().Add(
            counter_dimension.CumulVar(idx2) <=
            counter_dimension.CumulVar(idx4))

    search_parameters = pywrapcp.Defau…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Mizux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants