google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
10.79k stars 2.09k forks source link

routing-solver / constraint-solver: `profile_propagation` crashes (on official example) #3912

Open sschnug opened 10 months ago

sschnug commented 10 months ago

What version of OR-Tools and what language are you using? Version: 9.7 (shown) + 9.6. Language: C++ (bazel)

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

What operating system (Linux, Windows, ...) and version? Linux Ubuntu 22 LTS

I'm interested in some propagation-related timings similar to the output of print_local_search_profile which is very helpful. I don't know what to expect howewer as i did not succeed yet.

Let's use 9.7 + some official example and turn this on:

diff --git a/ortools/constraint_solver/samples/vrp_time_windows.cc b/ortools/constraint_solver/samples/vrp_time_windows.cc
index e69d3a4230..becb76eca8 100644
--- a/ortools/constraint_solver/samples/vrp_time_windows.cc
+++ b/ortools/constraint_solver/samples/vrp_time_windows.cc
@@ -121,7 +121,12 @@ void VrpTimeWindows() {

   // Create Routing Model.
   // [START routing_model]
-  RoutingModel routing(manager);
+
+  auto params = operations_research::DefaultRoutingModelParameters();
+  params.mutable_solver_parameters()->set_profile_propagation(true);
+  params.mutable_solver_parameters()->set_profile_file("profile_propagation");
+
+  RoutingModel routing(manager, params);
   // [END routing_model]

   // Create and register a transit callback.

This crashes with:

sascha@jimny:~/Dev/or_tools_vanilla/or-tools$ bazel-bin/ortools/constraint_solver/samples/vrp_time_windows_cc
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1694002316.168684   93886 constraint_solver.cc:2311] Exporting profile to profile_propagation
I0000 00:00:1694002316.171353   93886 constraint_solver.cc:2311] Exporting profile to profile_propagation
F0000 00:00:1694002316.171671   93886 demon_profiler.cc:351] Check failed: *demons == demons_per_constraint_[constraint].size() (1 vs. 2) 
*** Check failure stack trace: ***
    @     0x55a471afe7cd  absl::lts_20230125::log_internal::LogMessageFatal::~LogMessageFatal()
    @     0x55a47194f7fe  operations_research::DemonProfiler::ExportInformation()
    @     0x55a47194fbd7  operations_research::DemonProfiler::PrintOverview()
    @     0x55a471441beb  operations_research::Solver::EndSearch()
    @     0x55a47191cdaf  operations_research::Solver::Solve()
    @     0x55a47148f5d0  operations_research::RoutingModel::AppendAssignmentIfFeasible()
    @     0x55a4714aaaf4  operations_research::RoutingModel::SolveFromAssignmentsWithParameters()
    @     0x55a4714aad4b  operations_research::RoutingModel::SolveFromAssignmentWithParameters()
    @     0x55a471463158  operations_research::VrpTimeWindows()
    @     0x55a47145a9dd  main
    @     0x7fcf21153d90  (unknown)
Aborted

Remarks:

Are there any special considerations on how to use this feature?

iShallEatCode commented 3 months ago

What does DemonProfiler do? Can you please explain?