google / google/or-tools

Error initializing DefaultRoutingSearchParameters: default '0.5' for field operations_research.sat.SatParameters.clause_cleanup_ratio of type 1

Open
#4,427 6 comments 0 reactions 2 assignees Claimed by @Mizux View on GitHub
Bug Lang: Python Solver: CP-SAT Solver Solver: Routing
Dominant language
C++
Stars
14.1k
Forks
2.5k
Avg merge
8h 39m
Merged PRs (30d)
72

Description

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

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

**What operating system (Linux, Windows, ...) and version?**
MacOs (but all happening in a docker container with conjunction with django)

**What did you do?**
It's not easy to reproduce since it only happened for me in certain conditions:
- Dockerized container with python 3.11
- Using Django (5.0.8) plus protobuf (5.26.1) and ortools
**More detailed epxlanation**
I am able to successfully build the container and can get into it. If I run plain python and do the following it all works fine
`python -c "from ortools.constraint_solver import pywrapcp; search_parameters = pywrapcp.DefaultRoutingSearchParameters(); print(search_parameters)"
`

However if I have run it within the code itself or within the Djangp shell (python manage.py shell) then I get this error
`Error initializing DefaultRoutingSearchParameters: Couldn't build proto file into descriptor pool: Invalid default '0.5' for field operations_research.sat.SatParameters.clause_cleanup_ratio of type 1`

Here is a print statemant
```
Python version: 3.11.10 (main, Oct 19 2024, 18:56:55) [GCC 12.2.0]
**pywrapcp:**

**Protobuf:**

**Dir in pywrapcp:**
['Assignment', 'AssignmentElement', 'BOOL_FALSE', 'BOOL_TRUE', 'BOOL_UNSPECIFIED', 'BaseLns', 'BaseObject', 'BooleanVar', 'BoundCost', 'ChangeValue', 'Constraint', 'Decision', 'DecisionBuilder', 'DefaultPhaseParameters', 'DefaultRoutingModelParameters', 'DefaultRoutingSearchParameters', 'Demon', 'DisjunctiveConstraint', 'FindErrorInRoutingSearchParameters', 'FirstSolutionStrategy', 'GlobalVehicleBreaksConstraint', 'IntExpr', 'IntVar', 'IntVarContainer', 'IntVarElement', 'IntVarIterator', 'IntVarLocalSearchFilter', 'IntVarLocalSearchOperator', 'IntervalVar', 'IntervalVarContainer', 'IntervalVarElement', 'LocalSearchFilter', 'LocalSearchFilterManager', 'LocalSearchMetaheuristic', 'LocalSearchOperator', 'NumericalRevInteger', 'OptimizeVar', 'Pack', 'PathOperator', 'PathsMetadata', 'PropagationBaseObject', 'PyConstraint', 'PyConstraintDemon', 'PyDecision', 'PyDecisionBuilder', 'PyDemon', 'RevBool', 'RevInteger', 'RoutingDimension', 'RoutingIndexManager', 'RoutingModel', 'RoutingModelVisitor', 'SearchLimit', 'SearchMonitor', 'SequenceVar', 'SequenceVarContainer', 'SequenceVarElement', 'SimpleBoundCosts', 'SolutionCollector', 'SolveModelWithSat', 'Solver', 'TypeIncompatibilityChecker', 'TypeRegulationsChecker', 'TypeRegulationsConstraint', 'TypeRequirementChecker', '_SwigNonDynamicMeta', '__builtin__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__lshift__', '__name__', '__package__', '__spec__', '_pywrapcp', '_swig_add_metaclass', '_swig_python_version_info', '_swig_repr', '_swig_setattr_nondynamic_class_variable', '_swig_setattr_nondynamic_instance_variable', 'cvar', 'weakref']
**Accessing DefaultRoutingSearchParameters via pywrapcp.DefaultRoutingSearchParameters():**
Error initializing DefaultRoutingSearchParameters: Couldn't build proto file into descriptor pool: Invalid default '0.5' for field operations_research.sat.SatParameters.clause_cleanup_ratio of type 1
```

**What did you expect to see**
I would expect to just initialize the DefaultRoutingSearchParameters with its default parameter

**What did you see instead?**
_Error initializing DefaultRoutingSearchParameters: Couldn't build proto file into descriptor pool: Invalid default '0.5' for field operations_research.sat.SatParameters.clause_cleanup_ratio of type 1_

Make sure you include information that can help us debug (full error message, model Proto).
I am quiet inexperienced with it and I just really noticed that the only issue when this happened was within the Django context.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.