Skip to content

Commit 6e8f667

Browse files
committed
Fixed error with Rice 4.8
1 parent 14fdc94 commit 6e8f667

8 files changed

Lines changed: 12 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.16.2 (unreleased)
2+
3+
- Fixed error with Rice 4.8
4+
15
## 0.16.1 (2025-10-26)
26

37
- Added `add_allowed_assignments` and `add_forbidden_assignments` methods to `CpModel`

ext/or-tools/bin_packing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace Rice::detail {
2424

2525
explicit From_Ruby(Arg* arg) : arg_(arg) { }
2626

27-
Convertible is_convertible(VALUE value) { return Convertible::Cast; }
27+
double is_convertible(VALUE value) { return Convertible::Exact; }
2828

2929
KnapsackSolver::SolverType convert(VALUE x) {
3030
auto s = Symbol(x).str();

ext/or-tools/constraint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace Rice::detail {
4444

4545
explicit From_Ruby(Arg* arg) : arg_(arg) { }
4646

47-
Convertible is_convertible(VALUE value) { return Convertible::Cast; }
47+
double is_convertible(VALUE value) { return Convertible::Exact; }
4848

4949
LinearExpr convert(VALUE v) {
5050
LinearExpr expr;

ext/or-tools/linear.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace Rice::detail {
3030

3131
explicit From_Ruby(Arg* arg) : arg_(arg) { }
3232

33-
Convertible is_convertible(VALUE value) { return Convertible::Cast; }
33+
double is_convertible(VALUE value) { return Convertible::Exact; }
3434

3535
static MPSolver::OptimizationProblemType convert(VALUE x) {
3636
auto s = Symbol(x).str();

ext/or-tools/math_opt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace Rice::detail {
2929

3030
explicit From_Ruby(Arg* arg) : arg_(arg) { }
3131

32-
Convertible is_convertible(VALUE value) { return Convertible::Cast; }
32+
double is_convertible(VALUE value) { return Convertible::Exact; }
3333

3434
static SolverType convert(VALUE x) {
3535
auto s = Symbol(x).str();

ext/or-tools/routing.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace Rice::detail {
4040

4141
explicit From_Ruby(Arg* arg) : arg_(arg) { }
4242

43-
Convertible is_convertible(VALUE value) { return Convertible::Cast; }
43+
double is_convertible(VALUE value) { return Convertible::Exact; }
4444

4545
RoutingNodeIndex convert(VALUE x) {
4646
const RoutingNodeIndex index{From_Ruby<int>().convert(x)};
@@ -297,6 +297,7 @@ void init_routing(Rice::Module& m) {
297297
return operations_research::DefaultRoutingModelParameters();
298298
});
299299

300+
Rice::define_enum_under<RoutingModel::PenaltyCostBehavior>("PenaltyCostBehavior", m);
300301
Rice::define_class_under<RoutingModel::ResourceGroup>(m, "ResourceGroup");
301302

302303
Rice::define_class_under<RoutingModel>(m, "RoutingModel")

or-tools.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ Gem::Specification.new do |spec|
1616

1717
spec.required_ruby_version = ">= 3.1"
1818

19-
spec.add_dependency "rice", ">= 4.7"
19+
spec.add_dependency "rice", ">= 4.8"
2020
end

test/constraint_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def test_add_hint
232232
error = assert_raises(RuntimeError) do
233233
model.add_hint("z", 1)
234234
end
235-
assert_equal "The provided Ruby object does not wrap a C++ object", error.message
235+
assert_equal "The Ruby object does not wrap a C++ object. It is actually a String.", error.message
236236
end
237237

238238
def test_int_var_domain

0 commit comments

Comments
 (0)