Skip to content
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

Cannot use RoutingModel routing status flags anymore #4553

Open
RaphaelTlse opened this issue Feb 19, 2025 · 2 comments
Open

Cannot use RoutingModel routing status flags anymore #4553

RaphaelTlse opened this issue Feb 19, 2025 · 2 comments
Assignees
Labels
Bug Lang: Python Python wrapper issue Solver: Routing Uses the Routing library and the original CP solver
Milestone

Comments

@RaphaelTlse
Copy link

RaphaelTlse commented Feb 19, 2025

What version of OR-Tools and what language are you using?
9.12.4544
Language: Python

Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
Routing Solver

What operating system (Linux, Windows, ...) and version?
Windows 11

What did you do?
Steps to reproduce the behavior:
With version 9.12.4544: Attempt to access ortools.constraint_solver.pywrapcp.RoutingModel.ROUTING_SUCCESS or any other flag

What did you expect to see
With version 9.11.4210: Getting the routing status

What did you see instead?
With version 9.12.4544: AttributeError: type object 'RoutingModel' has no attribute 'ROUTING_SUCCESS'

Image

Image

I was not able to identify the reason and nature of this change, what is the new expected process to access the routing status in the new version?

@Mizux Mizux self-assigned this Feb 19, 2025
@Mizux Mizux added this to the v9.13 milestone Feb 19, 2025
@Mizux Mizux added Bug Lang: Python Python wrapper issue Solver: Routing Uses the Routing library and the original CP solver labels Feb 19, 2025
@lperron
Copy link
Collaborator

lperron commented Feb 20, 2025

Indeed, all RoutingModel enums have been removed in favor of the protobuf enums. This removed duplication.

so the enum is available as routing_enums_pb2.RoutingSearchStatus.ROUTING_SUCCESS

We will update the release notes

@Mizux
Copy link
Collaborator

Mizux commented Feb 24, 2025

FYI

/// Returns the current status of the routing model.
RoutingSearchStatus::Value status() const { return status_; }

// Used by `RoutingModel` to report the status of the search for a solution.
message RoutingSearchStatus {
enum Value {
// Problem not solved yet (before calling RoutingModel::Solve()).
ROUTING_NOT_SOLVED = 0;
// Problem solved successfully after calling RoutingModel::Solve().
ROUTING_SUCCESS = 1;
// Problem solved successfully after calling RoutingModel::Solve(), except
// that a local optimum has not been reached. Leaving more time would allow
// improving the solution.
ROUTING_PARTIAL_SUCCESS_LOCAL_OPTIMUM_NOT_REACHED = 2;
// No solution found to the problem after calling RoutingModel::Solve().
ROUTING_FAIL = 3;
// Time limit reached before finding a solution with RoutingModel::Solve().
ROUTING_FAIL_TIMEOUT = 4;
// Model, model parameters or flags are not valid.
ROUTING_INVALID = 5;
// Problem proven to be infeasible.
ROUTING_INFEASIBLE = 6;
// Problem has been solved to optimality.
ROUTING_OPTIMAL = 7;
}
}

Still remain

class OR_DLL RoutingModel {
public:
/// Types of precedence policy applied to pickup and delivery pairs.
enum PickupAndDeliveryPolicy {
/// Any precedence is accepted.
PICKUP_AND_DELIVERY_NO_ORDER,
/// Deliveries must be performed in reverse order of pickups.
PICKUP_AND_DELIVERY_LIFO,
/// Deliveries must be performed in the same order as pickups.
PICKUP_AND_DELIVERY_FIFO
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Lang: Python Python wrapper issue Solver: Routing Uses the Routing library and the original CP solver
Projects
None yet
Development

No branches or pull requests

3 participants