Skip to content

Commit c7aeea1

Browse files
committed
Fixed error with Rice 4.11
1 parent dc8c8be commit c7aeea1

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.17.1 (unreleased)
2+
3+
- Fixed error with Rice 4.11
4+
15
## 0.17.0 (2026-01-12)
26

37
- Updated OR-Tools to 9.15

ext/or-tools/constraint.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ void init_constraint(Rice::Module& m) {
9898
auto a = Array(literal);
9999
std::vector<BoolVar> vec;
100100
vec.reserve(a.size());
101-
for (const Object v : a) {
102-
if (v.is_a(rb_cSatIntVar)) {
101+
for (const auto& v : a) {
102+
if (Object(v).is_a(rb_cSatIntVar)) {
103103
vec.push_back(Rice::detail::From_Ruby<IntVar>().convert(v.value()).ToBoolVar());
104104
} else {
105105
vec.push_back(Rice::detail::From_Ruby<BoolVar>().convert(v.value()));

ext/or-tools/linear.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <memory>
2+
#include <optional>
23
#include <string>
34

45
#include <ortools/linear_solver/linear_solver.h>
@@ -114,11 +115,11 @@ void init_linear(Rice::Module& m) {
114115
[](MPSolverParameters& self) {
115116
int presolve = self.GetIntegerParam(MPSolverParameters::IntegerParam::PRESOLVE);
116117
if (presolve == MPSolverParameters::PresolveValues::PRESOLVE_ON) {
117-
return Rice::True;
118+
return std::optional<bool>{true};
118119
} else if (presolve == MPSolverParameters::PresolveValues::PRESOLVE_OFF) {
119-
return Rice::False;
120+
return std::optional<bool>{false};
120121
} else {
121-
return Rice::Nil;
122+
return std::optional<bool>{};
122123
}
123124
})
124125
.define_method(
@@ -137,11 +138,11 @@ void init_linear(Rice::Module& m) {
137138
[](MPSolverParameters& self) {
138139
int incrementality = self.GetIntegerParam(MPSolverParameters::IntegerParam::INCREMENTALITY);
139140
if (incrementality == MPSolverParameters::IncrementalityValues::INCREMENTALITY_ON) {
140-
return Rice::True;
141+
return std::optional<bool>{true};
141142
} else if (incrementality == MPSolverParameters::IncrementalityValues::INCREMENTALITY_OFF) {
142-
return Rice::False;
143+
return std::optional<bool>{false};
143144
} else {
144-
return Rice::Nil;
145+
return std::optional<bool>{};
145146
}
146147
})
147148
.define_method(
@@ -160,11 +161,11 @@ void init_linear(Rice::Module& m) {
160161
[](MPSolverParameters& self) {
161162
int scaling = self.GetIntegerParam(MPSolverParameters::IntegerParam::SCALING);
162163
if (scaling == MPSolverParameters::ScalingValues::SCALING_ON) {
163-
return Rice::True;
164+
return std::optional<bool>{true};
164165
} else if (scaling == MPSolverParameters::ScalingValues::SCALING_OFF) {
165-
return Rice::False;
166+
return std::optional<bool>{false};
166167
} else {
167-
return Rice::Nil;
168+
return std::optional<bool>{};
168169
}
169170
});
170171

ext/or-tools/routing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void init_routing(Rice::Module& m) {
295295
"cumulative",
296296
[](operations_research::Solver& self, Array rb_intervals, std::vector<int64_t> demands, int64_t capacity, const std::string& name) {
297297
std::vector<operations_research::IntervalVar*> intervals;
298-
for (const Object v : rb_intervals) {
298+
for (const auto& v : rb_intervals) {
299299
intervals.push_back(Rice::detail::From_Ruby<operations_research::IntervalVar*>().convert(v.value()));
300300
}
301301
return self.MakeCumulative(intervals, demands, capacity, name);

0 commit comments

Comments
 (0)