Skip to content

routing: SetAllowedVehiclesForIndex not working in C# wrappers (changed C++ signature) #4982

Closed

Description

@armeniomiranda-dev

Version: v9.15
Language: C#

Routing Solver

Windows

After updating to 9.15 i saw this error in my code in SetAllowedVehiclesForIndex

Image

I have searched and saw that it has changed

Image

How to fix it for using 9.15?

Regards

Activity

  1. self-assigned this
    on Jan 12, 2026
  2. added this to the v9.16 milestone on Jan 12, 2026
  3. Mizux commented on Jan 12, 2026

    @Mizux
    Collaborator
    1. Need to support absl::Span in our SWIG wrapper

    2. Add test to Routing to verify AllowedVehcileForIndex API is usable...

    3. Check Java and Python pretty sure we will have the same kind of issue...

    ref:

    /// Sets the vehicles which can visit a given node. If the node is in a
    /// disjunction, this will not prevent it from being unperformed.
    /// Specifying an empty vector of vehicles has no effect (all vehicles
    /// will be allowed to visit the node).
    void SetAllowedVehiclesForIndex(absl::Span<const int> vehicles,
    int64_t index);

  4. armeniomiranda-dev commented on Jan 12, 2026

    @armeniomiranda-dev
    Author

    Thanks for the explanation! Currently, this means the API doesn’t work in C# right? Is there something I could help with in the meantime?

  5. changed the title [-]SetAllowedVehiclesForIndex changed parameters[/-] [+]routing: SetAllowedVehiclesForIndex not working in wrappers (changed parameters)[/+] on Jan 12, 2026
  6. changed the title [-]routing: SetAllowedVehiclesForIndex not working in wrappers (changed parameters)[/-] [+]routing: SetAllowedVehiclesForIndex not working in C# wrappers (changed C++ signature)[/+] on Jan 13, 2026
  7. armeniomiranda-dev commented on Jan 13, 2026

    @armeniomiranda-dev
    Author

    lperron the bug is only in c#? In Java and python it works? Are you planning to make a release with fix soon or just in April (referring the new 9.16 milestone)?

  8. Grenby commented on Jan 26, 2026

    @Grenby

    Python has the same problem:
    Code

    routing.SetAllowedVehiclesForIndex([1], manager.NodeToIndex(1))

    Error

    SetAllowedVehiclesForIndex
        return _pywrapcp.RoutingModel_SetAllowedVehiclesForIndex(self, vehicles, index)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: in method 'RoutingModel_SetAllowedVehiclesForIndex', argument 2 of type 'absl::Span< int const >'
    
    
  9. modified the milestones: v9.16, v10.0 Beta on Mar 11, 2026
  10. Mizux commented on Aug 24, 2026

    @Mizux
    Collaborator

    should be fixed by #5290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions