or-tools 0.11.1 → 0.13.0

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: db5ea336dfbb4e2a150736473ff1e51cbd125976ea287a130b95316d81b438b2
4
- data.tar.gz: 2998d8aefe52396ebabe019d5093343980c785c2735ae3f1396d884000f9cc1c
3
+ metadata.gz: 55a9b05e208ea0dd70243881bf35ce603f2d68b4899bf0595b035329c484b7b7
4
+ data.tar.gz: 201d0173f91ccc86ebb351e2ee87b72184d5fd08ce755875f930742b1a2b8632
5
5
  SHA512:
6
- metadata.gz: 25a64519e5ca3ec8e2746369e54f234961022da4bad42283e76ad323b9e39218683d0e1831a7e79bb46237966674f1729b46e50c894f435dceee438bdd1e6aee
7
- data.tar.gz: 47c5ae441d52e4e84bb2f1efcb97b1f9b0786870fb6f6ddb87b6e115a1ab337453c1550b3bed3d4a3558393f250b37367653104a31ea1fbb57fe6f290ac37f86
6
+ metadata.gz: 19a28702b80c76dbc2d9cb868a2d5b627c92036253ea5076ea5d070578064f3b0b4065c84e7ea4edd1c324d58b10655960b15c0f4a104d00adaa89e70aecaa19
7
+ data.tar.gz: f40224649c5d1335d616f4bc0937c0a26a22d84b397d11ee6e2dd6637606d37ea10070b4c267a7497781db80bfdd3b663d24a6660fc911d19dd86fb602ceb152
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 0.13.0 (2024-09-17)
2
+
3
+ - Updated OR-Tools to 9.11
4
+ - Restored binary installation for Ubuntu 20.04
5
+ - Dropped binary installation for CentOS 7
6
+ - Removed dependency on `csv` gem
7
+
8
+ ## 0.12.0 (2024-06-02)
9
+
10
+ - Updated OR-Tools to 9.10
11
+ - Added `export_to_file` method to `CpModel`
12
+ - Added `random_seed` and `random_seed=` methods to `SatParameters`
13
+ - Added binary installation for Ubuntu 24.04
14
+ - Dropped binary installation for Ubuntu 20.04 and Debian 11 ARM
15
+ - Dropped support for Ruby < 3.1
16
+
1
17
  ## 0.11.1 (2023-12-04)
2
18
 
3
19
  - Added binary installation for Arch Linux
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [OR-Tools](https://github.com/google/or-tools) - operations research tools - for Ruby
4
4
 
5
- [![Build Status](https://github.com/ankane/or-tools-ruby/workflows/build/badge.svg?branch=master)](https://github.com/ankane/or-tools-ruby/actions)
5
+ [![Build Status](https://github.com/ankane/or-tools-ruby/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/or-tools-ruby/actions)
6
6
 
7
7
  ## Installation
8
8
 
@@ -160,6 +160,14 @@ void init_constraint(Rice::Module& m) {
160
160
  .define_method("cp_model_presolve=",
161
161
  [](SatParameters& self, bool value) {
162
162
  self.set_cp_model_presolve(value);
163
+ })
164
+ .define_method("random_seed",
165
+ [](SatParameters& self) {
166
+ return self.random_seed();
167
+ })
168
+ .define_method("random_seed=",
169
+ [](SatParameters& self, int32_t value) {
170
+ self.set_random_seed(value);
163
171
  });
164
172
 
165
173
  Rice::define_class_under<CpModelBuilder>(m, "CpModel")
@@ -350,6 +358,11 @@ void init_constraint(Rice::Module& m) {
350
358
  [](CpModelBuilder& self) {
351
359
  self.ClearAssumptions();
352
360
  })
361
+ .define_method(
362
+ "export_to_file",
363
+ [](CpModelBuilder& self, const std::string& filename) {
364
+ return self.ExportToFile(filename);
365
+ })
353
366
  .define_method(
354
367
  "to_s",
355
368
  [](CpModelBuilder& self) {
@@ -432,12 +445,12 @@ void init_constraint(Rice::Module& m) {
432
445
  })
433
446
  .define_method(
434
447
  "_solution_integer_value",
435
- [](Object self, CpSolverResponse& response, IntVar& x) {
448
+ [](Object self, const CpSolverResponse& response, IntVar x) {
436
449
  return SolutionIntegerValue(response, x);
437
450
  })
438
451
  .define_method(
439
452
  "_solution_boolean_value",
440
- [](Object self, CpSolverResponse& response, BoolVar& x) {
453
+ [](Object self, const CpSolverResponse& response, BoolVar x) {
441
454
  return SolutionBooleanValue(response, x);
442
455
  });
443
456
  }
@@ -19,7 +19,7 @@ else
19
19
 
20
20
  # make rpath relative
21
21
  # use double dollar sign and single quotes to escape properly
22
- rpath_prefix = RbConfig::CONFIG["host_os"] =~ /darwin/ ? "@loader_path" : "$$ORIGIN"
22
+ rpath_prefix = RbConfig::CONFIG["host_os"].match?(/darwin/) ? "@loader_path" : "$$ORIGIN"
23
23
  rpath = "'#{rpath_prefix}/../../tmp/or-tools/lib'"
24
24
  end
25
25
 
@@ -296,6 +296,8 @@ void init_routing(Rice::Module& m) {
296
296
  return operations_research::DefaultRoutingModelParameters();
297
297
  });
298
298
 
299
+ Rice::define_class_under<RoutingModel::ResourceGroup>(m, "ResourceGroup");
300
+
299
301
  Rice::define_class_under<RoutingModel>(m, "RoutingModel")
300
302
  .define_constructor(Rice::Constructor<RoutingModel, RoutingIndexManager, RoutingModelParameters>(), Rice::Arg("index_manager"), Rice::Arg("parameters") = operations_research::DefaultRoutingModelParameters())
301
303
  .define_method("register_unary_transit_vector", &RoutingModel::RegisterUnaryTransitVector)
@@ -307,7 +309,7 @@ void init_routing(Rice::Module& m) {
307
309
  return Rice::detail::From_Ruby<int64_t>().convert(callback.call("call", from_index));
308
310
  }
309
311
  );
310
- })
312
+ }, Rice::Arg("callback").keepAlive())
311
313
  .define_method("register_transit_matrix", &RoutingModel::RegisterTransitMatrix)
312
314
  .define_method(
313
315
  "register_transit_callback",
@@ -317,7 +319,7 @@ void init_routing(Rice::Module& m) {
317
319
  return Rice::detail::From_Ruby<int64_t>().convert(callback.call("call", from_index, to_index));
318
320
  }
319
321
  );
320
- })
322
+ }, Rice::Arg("callback").keepAlive())
321
323
  .define_method("add_dimension", &RoutingModel::AddDimension)
322
324
  .define_method("add_dimension_with_vehicle_transits", &RoutingModel::AddDimensionWithVehicleTransits)
323
325
  .define_method("add_dimension_with_vehicle_capacity", &RoutingModel::AddDimensionWithVehicleCapacity)
@@ -1,21 +1,20 @@
1
- require "csv"
2
1
  require "digest"
3
2
  require "fileutils"
4
3
  require "net/http"
5
4
  require "tmpdir"
6
5
 
7
- version = "9.8.3296"
6
+ version = "9.11.4210"
8
7
 
9
8
  arch = RbConfig::CONFIG["host_cpu"]
10
- arm = arch =~ /arm|aarch64/i
9
+ arm = arch.match?(/arm|aarch64/i)
11
10
 
12
- if RbConfig::CONFIG["host_os"] =~ /darwin/i
11
+ if RbConfig::CONFIG["host_os"].match?(/darwin/i)
13
12
  if arm
14
- filename = "or-tools_arm64_macOS-14.1_cpp_v#{version}.tar.gz"
15
- checksum = "253efad127c55b78967e3e3a3b4a573f9da0a2562c4f33f14fbf462ca58448f7"
13
+ filename = "or-tools_arm64_macOS-14.6.1_cpp_v#{version}.tar.gz"
14
+ checksum = "a106668eb1975c1672874ef24b4f8e2e56669467a63349e5ea8ef5419814c31b"
16
15
  else
17
- filename = "or-tools_x86_64_macOS-14.1_cpp_v#{version}.tar.gz"
18
- checksum = "fe48b022799c807baba79a2b13c29bf9d9614827ba082fc688559d0cab879a86"
16
+ filename = "or-tools_x86_64_macOS-14.6.1_cpp_v#{version}.tar.gz"
17
+ checksum = "cc87a7f8c68ec4fed6c6de6565b0b625f2f0047185a8a4449ef4b5a305b60e55"
19
18
  end
20
19
  else
21
20
  # try /etc/os-release with fallback to /usr/lib/os-release
@@ -23,29 +22,26 @@ else
23
22
  os_filename = File.exist?("/etc/os-release") ? "/etc/os-release" : "/usr/lib/os-release"
24
23
 
25
24
  # for safety, parse rather than source
26
- os_info = CSV.read(os_filename, col_sep: "=").to_h rescue {}
25
+ os_info = File.readlines(os_filename, chomp: true).to_h { |v| v.split("=", 2) }.transform_values { |v| v.delete_prefix('"').delete_suffix('"') } rescue {}
27
26
 
28
27
  os = os_info["ID"]
29
28
  os_version = os_info["VERSION_ID"]
30
29
 
31
- if os == "ubuntu" && os_version == "22.04" && !arm
30
+ if os == "ubuntu" && os_version == "24.04" && !arm
31
+ filename = "or-tools_amd64_ubuntu-24.04_cpp_v#{version}.tar.gz"
32
+ checksum = "71761d93171b111fca736647a6cd00cb9e606474df597a8b48f3f5f2c73d4c0f"
33
+ elsif os == "ubuntu" && os_version == "22.04" && !arm
32
34
  filename = "or-tools_amd64_ubuntu-22.04_cpp_v#{version}.tar.gz"
33
- checksum = "2a332e95897ac6fc2cfd0122bcbc07cfd286d0f579111529cc99ac3076f5421a"
35
+ checksum = "f613574d4eae01afd966c8bde199990cbd9fad46035e675d71f17f5c7477eed4"
34
36
  elsif os == "ubuntu" && os_version == "20.04" && !arm
35
37
  filename = "or-tools_amd64_ubuntu-20.04_cpp_v#{version}.tar.gz"
36
- checksum = "95789f8d93dfb298efecd1c0b888f9a148c011e1a20505b00c38452d68b01644"
38
+ checksum = "190b85f4510cab55fcb50b9850a0e2f94b2bdf5e266580650efbc5aaab760683"
37
39
  elsif os == "debian" && os_version == "11" && !arm
38
40
  filename = "or-tools_amd64_debian-11_cpp_v#{version}.tar.gz"
39
- checksum = "e7dd81b13c53c739447254b8836ece55f8b92a107688cc9f3511705c9962fa2d"
40
- elsif os == "debian" && os_version == "11" && arm
41
- filename = "or-tools_arm64_debian-11_cpp_v#{version}.tar.gz"
42
- checksum = "77a88d01eb612ffac0f6e030e30e58a3d171fe75d93a527ec55a06f9070332ab"
43
- elsif os == "centos" && os_version == "7" && !arm
44
- filename = "or-tools_amd64_centos-7_cpp_v#{version}.tar.gz"
45
- checksum = "d9f193572d3a38b3062ae4cb89afc654e662eb734a9361b1575d649b9530cf60"
41
+ checksum = "a8354696f365aa13a2375da5f8f6cfd8785430681addcd887bfd194851dd4710"
46
42
  elsif os == "arch" && !arm
47
43
  filename = "or-tools_amd64_archlinux_cpp_v#{version}.tar.gz"
48
- checksum = "803e4b78e7d05b8027a2a391183c8c7855bb758f74d9ced872cfa68e0b9d7d64"
44
+ checksum = "ac892a949d871294b7e26b0730440ab8629b4021bf3c1641bc7c8fb09b45081f"
49
45
  else
50
46
  platform =
51
47
  if Gem.win_platform?
@@ -4,7 +4,7 @@ module ORTools
4
4
 
5
5
  def initialize(initial_grid, x: false, magic_square: false, anti_knight: false, anti_king: false, non_consecutive: false)
6
6
  raise ArgumentError, "Grid must be 9x9" unless initial_grid.size == 9 && initial_grid.all? { |r| r.size == 9 }
7
- raise ArgumentError, "Grid must contain values between 0 and 9" unless initial_grid.flatten(1).all? { |v| (0..9).include?(v) }
7
+ raise ArgumentError, "Grid must contain values between 0 and 9" unless initial_grid.flatten(1).all? { |v| (0..9).cover?(v) }
8
8
 
9
9
  model = ORTools::CpModel.new
10
10
 
@@ -7,7 +7,7 @@ module ORTools
7
7
  end
8
8
 
9
9
  def add_self_to_coeff_map_or_stack(coeffs, multiplier, stack)
10
- @array.reverse.each do |arg|
10
+ @array.reverse_each do |arg|
11
11
  stack << [multiplier, arg]
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module ORTools
2
- VERSION = "0.11.1"
2
+ VERSION = "0.13.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: or-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-04 00:00:00.000000000 Z
11
+ date: 2024-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.1'
19
+ version: '4.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.1'
26
+ version: '4.3'
27
27
  description:
28
28
  email: andrew@ankane.org
29
29
  executables: []
@@ -85,14 +85,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
- version: '3'
88
+ version: '3.1'
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
91
  - - ">="
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
- rubygems_version: 3.4.10
95
+ rubygems_version: 3.5.16
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Operations research tools for Ruby