or-tools 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea0dcf083694be566f08e7c531e3bbd7cd817fb454c6590a1edff5411e58b9c7
4
- data.tar.gz: 334369dda3337181b10722f96a52211a079f29409e709a8bfd6685a3d9100916
3
+ metadata.gz: cf6aeeb8a03deeb23478d655a7844b3e49115252fd8ad5cc7285074370580952
4
+ data.tar.gz: 67db36ddc806b7a2695ea89c9bb2dc3969161df739059e186aed6d67506c4348
5
5
  SHA512:
6
- metadata.gz: 2d8956c463c473ceabe4803f23076d8c96617a4abbd64b7bc2873492bd9e41eed50929567ae71acdf42ea42c8bbbaf4716b132f27eae56cb307f311692444fa3
7
- data.tar.gz: 4ca6955eb037764eae4fc99861b904298c9bb519bc5ff2a19d5709f24f2f1e3de72f3827a953c90f9e006bc5122dc122ff51ece505784b5b3db49d5a0aaa8a5e
6
+ metadata.gz: 65d8e93c059aa9df5501d8db5252279ede1b85601785663ff0ff41a9e1b5555976c5b9a4304ebfe557d9e9e7802ba30635644b8b857c219e4c925db4d18d8e24
7
+ data.tar.gz: 3a76c22bc257260861751d79a79cb94f880c4d8f5c82ab7b00d249da586ef05283c031f8517ca77621848b0e0fdc6993e1c81ac9f116d2cae50073dd25177109
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.15.1 (2025-06-18)
2
+
3
+ - Fixed error with Rice 4.6
4
+
1
5
  ## 0.15.0 (2025-02-17)
2
6
 
3
7
  - Updated OR-Tools to 9.12
data/NOTICE.txt CHANGED
@@ -1,5 +1,5 @@
1
- Copyright 2010-2021 Google LLC
2
- Copyright 2020-2022 Andrew Kane
1
+ Copyright 2010-2025 Google LLC
2
+ Copyright 2020-2025 Andrew Kane
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  #include <ortools/graph/assignment.h>
2
-
3
- #include "ext.h"
2
+ #include <rice/rice.hpp>
3
+ #include <rice/stl.hpp>
4
4
 
5
5
  using operations_research::SimpleLinearSumAssignment;
6
6
 
@@ -1,6 +1,9 @@
1
- #include <ortools/algorithms/knapsack_solver.h>
1
+ #include <string>
2
+ #include <vector>
2
3
 
3
- #include "ext.h"
4
+ #include <ortools/algorithms/knapsack_solver.h>
5
+ #include <rice/rice.hpp>
6
+ #include <rice/stl.hpp>
4
7
 
5
8
  using operations_research::KnapsackSolver;
6
9
 
@@ -8,22 +11,18 @@ using Rice::Array;
8
11
  using Rice::Object;
9
12
  using Rice::Symbol;
10
13
 
11
- namespace Rice::detail
12
- {
14
+ namespace Rice::detail {
13
15
  template<>
14
- struct Type<KnapsackSolver::SolverType>
15
- {
16
+ struct Type<KnapsackSolver::SolverType> {
16
17
  static bool verify() { return true; }
17
18
  };
18
19
 
19
20
  template<>
20
- class From_Ruby<KnapsackSolver::SolverType>
21
- {
21
+ class From_Ruby<KnapsackSolver::SolverType> {
22
22
  public:
23
23
  Convertible is_convertible(VALUE value) { return Convertible::Cast; }
24
24
 
25
- KnapsackSolver::SolverType convert(VALUE x)
26
- {
25
+ KnapsackSolver::SolverType convert(VALUE x) {
27
26
  auto s = Symbol(x).str();
28
27
  if (s == "branch_and_bound") {
29
28
  return KnapsackSolver::KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER;
@@ -32,7 +31,7 @@ namespace Rice::detail
32
31
  }
33
32
  }
34
33
  };
35
- }
34
+ } // namespace Rice::detail
36
35
 
37
36
  void init_bin_packing(Rice::Module& m) {
38
37
  Rice::define_class_under<KnapsackSolver>(m, "KnapsackSolver")
@@ -1,7 +1,10 @@
1
+ #include <string>
2
+ #include <vector>
3
+
1
4
  #include <google/protobuf/text_format.h>
2
5
  #include <ortools/sat/cp_model.h>
3
-
4
- #include "ext.h"
6
+ #include <rice/rice.hpp>
7
+ #include <rice/stl.hpp>
5
8
 
6
9
  using operations_research::Domain;
7
10
  using operations_research::sat::BoolVar;
@@ -27,22 +30,18 @@ using Rice::Symbol;
27
30
  Class rb_cBoolVar;
28
31
  Class rb_cSatIntVar;
29
32
 
30
- namespace Rice::detail
31
- {
33
+ namespace Rice::detail {
32
34
  template<>
33
- struct Type<LinearExpr>
34
- {
35
+ struct Type<LinearExpr> {
35
36
  static bool verify() { return true; }
36
37
  };
37
38
 
38
39
  template<>
39
- class From_Ruby<LinearExpr>
40
- {
40
+ class From_Ruby<LinearExpr> {
41
41
  public:
42
42
  Convertible is_convertible(VALUE value) { return Convertible::Cast; }
43
43
 
44
- LinearExpr convert(VALUE v)
45
- {
44
+ LinearExpr convert(VALUE v) {
46
45
  LinearExpr expr;
47
46
 
48
47
  Rice::Object utils = Rice::define_module("ORTools").const_get("Utils");
@@ -64,7 +63,7 @@ namespace Rice::detail
64
63
  return expr;
65
64
  }
66
65
  };
67
- }
66
+ } // namespace Rice::detail
68
67
 
69
68
  void init_constraint(Rice::Module& m) {
70
69
  Rice::define_class_under<Domain>(m, "Domain")
data/ext/or-tools/ext.cpp CHANGED
@@ -1,7 +1,7 @@
1
1
  #include <ortools/base/version.h>
2
2
  #include <ortools/init/init.h>
3
-
4
- #include "ext.h"
3
+ #include <rice/rice.hpp>
4
+ #include <rice/stl.hpp>
5
5
 
6
6
  using operations_research::CppBridge;
7
7
  using operations_research::CppFlags;
@@ -15,8 +15,7 @@ void init_network_flows(Rice::Module& m);
15
15
  void init_routing(Rice::Module& m);
16
16
 
17
17
  extern "C"
18
- void Init_ext()
19
- {
18
+ void Init_ext() {
20
19
  auto m = Rice::define_module("ORTools");
21
20
 
22
21
  m.define_singleton_function("lib_version", &operations_research::OrToolsVersionString);
@@ -1,6 +1,9 @@
1
- #include <ortools/linear_solver/linear_solver.h>
1
+ #include <memory>
2
+ #include <string>
2
3
 
3
- #include "ext.h"
4
+ #include <ortools/linear_solver/linear_solver.h>
5
+ #include <rice/rice.hpp>
6
+ #include <rice/stl.hpp>
4
7
 
5
8
  using operations_research::MPConstraint;
6
9
  using operations_research::MPObjective;
@@ -15,21 +18,17 @@ using Rice::Object;
15
18
  using Rice::String;
16
19
  using Rice::Symbol;
17
20
 
18
- namespace Rice::detail
19
- {
21
+ namespace Rice::detail {
20
22
  template<>
21
- struct Type<MPSolver::OptimizationProblemType>
22
- {
23
+ struct Type<MPSolver::OptimizationProblemType> {
23
24
  static bool verify() { return true; }
24
25
  };
25
26
 
26
27
  template<>
27
- struct From_Ruby<MPSolver::OptimizationProblemType>
28
- {
28
+ struct From_Ruby<MPSolver::OptimizationProblemType> {
29
29
  Convertible is_convertible(VALUE value) { return Convertible::Cast; }
30
30
 
31
- static MPSolver::OptimizationProblemType convert(VALUE x)
32
- {
31
+ static MPSolver::OptimizationProblemType convert(VALUE x) {
33
32
  auto s = Symbol(x).str();
34
33
  if (s == "glop") {
35
34
  return MPSolver::OptimizationProblemType::GLOP_LINEAR_PROGRAMMING;
@@ -40,7 +39,7 @@ namespace Rice::detail
40
39
  }
41
40
  }
42
41
  };
43
- }
42
+ } // namespace Rice::detail
44
43
 
45
44
  void init_linear(Rice::Module& m) {
46
45
  Rice::define_class_under<MPVariable>(m, "MPVariable")
@@ -1,9 +1,11 @@
1
- #include "absl/log/check.h"
2
- #include "absl/status/statusor.h"
3
- #include "ortools/base/init_google.h"
4
- #include "ortools/math_opt/cpp/math_opt.h"
1
+ #include <string>
5
2
 
6
- #include "ext.h"
3
+ #include <absl/log/check.h>
4
+ #include <absl/status/statusor.h>
5
+ #include <ortools/base/init_google.h>
6
+ #include <ortools/math_opt/cpp/math_opt.h>
7
+ #include <rice/rice.hpp>
8
+ #include <rice/stl.hpp>
7
9
 
8
10
  using operations_research::math_opt::LinearConstraint;
9
11
  using operations_research::math_opt::Model;
@@ -15,21 +17,17 @@ using operations_research::math_opt::Termination;
15
17
  using operations_research::math_opt::TerminationReason;
16
18
  using operations_research::math_opt::Variable;
17
19
 
18
- namespace Rice::detail
19
- {
20
+ namespace Rice::detail {
20
21
  template<>
21
- struct Type<SolverType>
22
- {
22
+ struct Type<SolverType> {
23
23
  static bool verify() { return true; }
24
24
  };
25
25
 
26
26
  template<>
27
- struct From_Ruby<SolverType>
28
- {
27
+ struct From_Ruby<SolverType> {
29
28
  Convertible is_convertible(VALUE value) { return Convertible::Cast; }
30
29
 
31
- static SolverType convert(VALUE x)
32
- {
30
+ static SolverType convert(VALUE x) {
33
31
  auto s = Symbol(x).str();
34
32
  if (s == "gscip") {
35
33
  return SolverType::kGscip;
@@ -56,7 +54,7 @@ namespace Rice::detail
56
54
  }
57
55
  }
58
56
  };
59
- }
57
+ } // namespace Rice::detail
60
58
 
61
59
  void init_math_opt(Rice::Module& m) {
62
60
  auto mathopt = Rice::define_module_under(m, "MathOpt");
@@ -67,7 +65,7 @@ void init_math_opt(Rice::Module& m) {
67
65
  .define_method(
68
66
  "_eql?",
69
67
  [](Variable& self, Variable &other) {
70
- return (bool) (self == other);
68
+ return static_cast<bool>(self == other);
71
69
  });
72
70
 
73
71
  Rice::define_class_under<LinearConstraint>(mathopt, "LinearConstraint");
@@ -1,7 +1,9 @@
1
+ #include <vector>
2
+
1
3
  #include <ortools/graph/max_flow.h>
2
4
  #include <ortools/graph/min_cost_flow.h>
3
-
4
- #include "ext.h"
5
+ #include <rice/rice.hpp>
6
+ #include <rice/stl.hpp>
5
7
 
6
8
  using operations_research::NodeIndex;
7
9
  using operations_research::SimpleMaxFlow;
@@ -1,7 +1,10 @@
1
+ #include <string>
2
+ #include <vector>
3
+
1
4
  #include <ortools/constraint_solver/routing.h>
2
5
  #include <ortools/constraint_solver/routing_parameters.h>
3
-
4
- #include "ext.h"
6
+ #include <rice/rice.hpp>
7
+ #include <rice/stl.hpp>
5
8
 
6
9
  using operations_research::Assignment;
7
10
  using operations_research::ConstraintSolverParameters;
@@ -24,37 +27,31 @@ using Rice::Object;
24
27
  using Rice::String;
25
28
  using Rice::Symbol;
26
29
 
27
- namespace Rice::detail
28
- {
30
+ namespace Rice::detail {
29
31
  template<>
30
- struct Type<RoutingNodeIndex>
31
- {
32
+ struct Type<RoutingNodeIndex> {
32
33
  static bool verify() { return true; }
33
34
  };
34
35
 
35
36
  template<>
36
- class From_Ruby<RoutingNodeIndex>
37
- {
37
+ class From_Ruby<RoutingNodeIndex> {
38
38
  public:
39
39
  Convertible is_convertible(VALUE value) { return Convertible::Cast; }
40
40
 
41
- RoutingNodeIndex convert(VALUE x)
42
- {
41
+ RoutingNodeIndex convert(VALUE x) {
43
42
  const RoutingNodeIndex index{From_Ruby<int>().convert(x)};
44
43
  return index;
45
44
  }
46
45
  };
47
46
 
48
47
  template<>
49
- class To_Ruby<RoutingNodeIndex>
50
- {
48
+ class To_Ruby<RoutingNodeIndex> {
51
49
  public:
52
- VALUE convert(RoutingNodeIndex const & x)
53
- {
50
+ VALUE convert(RoutingNodeIndex const & x) {
54
51
  return To_Ruby<int>().convert(x.value());
55
52
  }
56
53
  };
57
- }
54
+ } // namespace Rice::detail
58
55
 
59
56
  void init_routing(Rice::Module& m) {
60
57
  auto rb_cRoutingSearchParameters = Rice::define_class_under<RoutingSearchParameters>(m, "RoutingSearchParameters");
@@ -253,7 +250,11 @@ void init_routing(Rice::Module& m) {
253
250
  })
254
251
  .define_method(
255
252
  "cumulative",
256
- [](operations_research::Solver& self, std::vector<operations_research::IntervalVar*> intervals, std::vector<int64_t> demands, int64_t capacity, const std::string& name) {
253
+ [](operations_research::Solver& self, Array rb_intervals, std::vector<int64_t> demands, int64_t capacity, const std::string& name) {
254
+ std::vector<operations_research::IntervalVar*> intervals;
255
+ for (const Object v : rb_intervals) {
256
+ intervals.push_back(Rice::detail::From_Ruby<operations_research::IntervalVar*>().convert(v.value()));
257
+ }
257
258
  return self.MakeCumulative(intervals, demands, capacity, name);
258
259
  });
259
260
 
@@ -332,7 +333,7 @@ void init_routing(Rice::Module& m) {
332
333
  .define_method("add_resource_group", &RoutingModel::AddResourceGroup)
333
334
  .define_method("dimension_resource_group_indices", &RoutingModel::GetDimensionResourceGroupIndices)
334
335
  .define_method("dimension_resource_group_index", &RoutingModel::GetDimensionResourceGroupIndex)
335
- .define_method("add_disjunction", &RoutingModel::AddDisjunction, Rice::Arg("_indices"), Rice::Arg("_penalty"), Rice::Arg("_max_cardinality") = (int64_t)1, Rice::Arg("_penalty_cost_behavior") = RoutingModel::PenaltyCostBehavior::PENALIZE_ONCE)
336
+ .define_method("add_disjunction", &RoutingModel::AddDisjunction, Rice::Arg("_indices"), Rice::Arg("_penalty"), Rice::Arg("_max_cardinality") = static_cast<int64_t>(1), Rice::Arg("_penalty_cost_behavior") = RoutingModel::PenaltyCostBehavior::PENALIZE_ONCE)
336
337
  .define_method("disjunction_indices", &RoutingModel::GetDisjunctionIndices)
337
338
  .define_method("disjunction_penalty", &RoutingModel::GetDisjunctionPenalty)
338
339
  .define_method("disjunction_max_cardinality", &RoutingModel::GetDisjunctionMaxCardinality)
@@ -1,9 +1,13 @@
1
1
  module ORTools
2
2
  class RoutingModel
3
- def solve(solution_limit: nil, time_limit: nil, lns_time_limit: nil,
4
- first_solution_strategy: nil, local_search_metaheuristic: nil,
5
- log_search: nil)
6
-
3
+ def solve(
4
+ solution_limit: nil,
5
+ time_limit: nil,
6
+ lns_time_limit: nil,
7
+ first_solution_strategy: nil,
8
+ local_search_metaheuristic: nil,
9
+ log_search: nil
10
+ )
7
11
  search_parameters = ORTools.default_routing_search_parameters
8
12
  search_parameters.solution_limit = solution_limit if solution_limit
9
13
  search_parameters.time_limit = time_limit if time_limit
@@ -1,3 +1,3 @@
1
1
  module ORTools
2
- VERSION = "0.15.0"
2
+ VERSION = "0.15.1"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: or-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-17 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rice
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '4.5'
18
+ version: 4.5.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '4.5'
25
+ version: 4.5.0
26
26
  email: andrew@ankane.org
27
27
  executables: []
28
28
  extensions:
@@ -37,7 +37,6 @@ files:
37
37
  - ext/or-tools/bin_packing.cpp
38
38
  - ext/or-tools/constraint.cpp
39
39
  - ext/or-tools/ext.cpp
40
- - ext/or-tools/ext.h
41
40
  - ext/or-tools/extconf.rb
42
41
  - ext/or-tools/linear.cpp
43
42
  - ext/or-tools/math_opt.cpp
@@ -86,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
85
  - !ruby/object:Gem::Version
87
86
  version: '0'
88
87
  requirements: []
89
- rubygems_version: 3.6.2
88
+ rubygems_version: 3.6.7
90
89
  specification_version: 4
91
90
  summary: Operations research tools for Ruby
92
91
  test_files: []
data/ext/or-tools/ext.h DELETED
@@ -1,4 +0,0 @@
1
- #pragma once
2
-
3
- #include <rice/rice.hpp>
4
- #include <rice/stl.hpp>