or-tools 0.10.1 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +2 -0
- data/ext/or-tools/constraint.cpp +15 -4
- data/ext/or-tools/extconf.rb +4 -1
- data/ext/or-tools/routing.cpp +18 -2
- data/ext/or-tools/vendor.rb +27 -24
- data/lib/or-tools.rb +27 -27
- data/lib/or_tools/routing_model.rb +4 -0
- data/lib/or_tools/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db5ea336dfbb4e2a150736473ff1e51cbd125976ea287a130b95316d81b438b2
|
4
|
+
data.tar.gz: 2998d8aefe52396ebabe019d5093343980c785c2735ae3f1396d884000f9cc1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25a64519e5ca3ec8e2746369e54f234961022da4bad42283e76ad323b9e39218683d0e1831a7e79bb46237966674f1729b46e50c894f435dceee438bdd1e6aee
|
7
|
+
data.tar.gz: 47c5ae441d52e4e84bb2f1efcb97b1f9b0786870fb6f6ddb87b6e115a1ab337453c1550b3bed3d4a3558393f250b37367653104a31ea1fbb57fe6f290ac37f86
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 0.11.1 (2023-12-04)
|
2
|
+
|
3
|
+
- Added binary installation for Arch Linux
|
4
|
+
- Added binary installation for Debian 11 ARM
|
5
|
+
|
6
|
+
## 0.11.0 (2023-11-16)
|
7
|
+
|
8
|
+
- Updated OR-Tools to 9.8
|
9
|
+
- Dropped support for Ubuntu 18.04, Debian 10, and CentOS 8
|
10
|
+
- Dropped support for Ruby < 3
|
11
|
+
|
1
12
|
## 0.10.1 (2023-03-20)
|
2
13
|
|
3
14
|
- Added `domain` method to `SatIntVar`
|
data/README.md
CHANGED
data/ext/or-tools/constraint.cpp
CHANGED
@@ -152,6 +152,14 @@ void init_constraint(Rice::Module& m) {
|
|
152
152
|
"enumerate_all_solutions",
|
153
153
|
[](SatParameters& self) {
|
154
154
|
return self.enumerate_all_solutions();
|
155
|
+
})
|
156
|
+
.define_method("num_workers=",
|
157
|
+
[](SatParameters& self, int32_t value){
|
158
|
+
self.set_num_workers(value);
|
159
|
+
})
|
160
|
+
.define_method("cp_model_presolve=",
|
161
|
+
[](SatParameters& self, bool value) {
|
162
|
+
self.set_cp_model_presolve(value);
|
155
163
|
});
|
156
164
|
|
157
165
|
Rice::define_class_under<CpModelBuilder>(m, "CpModel")
|
@@ -408,10 +416,13 @@ void init_constraint(Rice::Module& m) {
|
|
408
416
|
parameters.set_num_search_workers(1);
|
409
417
|
|
410
418
|
m.Add(NewFeasibleSolutionObserver(
|
411
|
-
[callback](const CpSolverResponse& r) {
|
412
|
-
//
|
413
|
-
|
414
|
-
|
419
|
+
[&callback](const CpSolverResponse& r) {
|
420
|
+
// ensure Ruby thread
|
421
|
+
if (ruby_native_thread_p()) {
|
422
|
+
// TODO find a better way to do this
|
423
|
+
callback.call("response=", r);
|
424
|
+
callback.call("on_solution_callback");
|
425
|
+
}
|
415
426
|
})
|
416
427
|
);
|
417
428
|
}
|
data/ext/or-tools/extconf.rb
CHANGED
@@ -26,7 +26,10 @@ end
|
|
26
26
|
# find_header and find_library first check without adding path
|
27
27
|
# which can cause them to find system library
|
28
28
|
$INCFLAGS << " -I#{inc}"
|
29
|
-
|
29
|
+
# could support shared libraries for protobuf and abseil
|
30
|
+
# but keep simple for now
|
31
|
+
raise "libprotobuf.a not found" unless File.exist?("#{lib}/libprotobuf.a")
|
32
|
+
$LDFLAGS.prepend("-Wl,-rpath,#{rpath} -L#{lib} #{lib}/libprotobuf.a ")
|
30
33
|
raise "OR-Tools not found" unless have_library("ortools")
|
31
34
|
|
32
35
|
create_makefile("or_tools/ext")
|
data/ext/or-tools/routing.cpp
CHANGED
@@ -353,8 +353,24 @@ void init_routing(Rice::Module& m) {
|
|
353
353
|
.define_method("vehicle_allowed_for_index?", &RoutingModel::IsVehicleAllowedForIndex)
|
354
354
|
.define_method("add_pickup_and_delivery", &RoutingModel::AddPickupAndDelivery)
|
355
355
|
.define_method("add_pickup_and_delivery_sets", &RoutingModel::AddPickupAndDeliverySets)
|
356
|
-
.define_method(
|
357
|
-
|
356
|
+
.define_method(
|
357
|
+
"pickup_positions",
|
358
|
+
[](RoutingModel& self, int64_t node_index) {
|
359
|
+
std::vector<std::pair<int, int>> positions;
|
360
|
+
for (const auto& v : self.GetPickupPositions(node_index)) {
|
361
|
+
positions.emplace_back(v.pd_pair_index, v.alternative_index);
|
362
|
+
}
|
363
|
+
return positions;
|
364
|
+
})
|
365
|
+
.define_method(
|
366
|
+
"delivery_positions",
|
367
|
+
[](RoutingModel& self, int64_t node_index) {
|
368
|
+
std::vector<std::pair<int, int>> positions;
|
369
|
+
for (const auto& v : self.GetDeliveryPositions(node_index)) {
|
370
|
+
positions.emplace_back(v.pd_pair_index, v.alternative_index);
|
371
|
+
}
|
372
|
+
return positions;
|
373
|
+
})
|
358
374
|
// TODO SetPickupAndDeliveryPolicyOfAllVehicles
|
359
375
|
// TODO SetPickupAndDeliveryPolicyOfVehicle
|
360
376
|
// TODO GetPickupAndDeliveryPolicyOfVehicle
|
data/ext/or-tools/vendor.rb
CHANGED
@@ -4,15 +4,18 @@ require "fileutils"
|
|
4
4
|
require "net/http"
|
5
5
|
require "tmpdir"
|
6
6
|
|
7
|
-
version = "9.
|
7
|
+
version = "9.8.3296"
|
8
|
+
|
9
|
+
arch = RbConfig::CONFIG["host_cpu"]
|
10
|
+
arm = arch =~ /arm|aarch64/i
|
8
11
|
|
9
12
|
if RbConfig::CONFIG["host_os"] =~ /darwin/i
|
10
|
-
if
|
11
|
-
filename = "or-tools_arm64_macOS-
|
12
|
-
checksum = "
|
13
|
+
if arm
|
14
|
+
filename = "or-tools_arm64_macOS-14.1_cpp_v#{version}.tar.gz"
|
15
|
+
checksum = "253efad127c55b78967e3e3a3b4a573f9da0a2562c4f33f14fbf462ca58448f7"
|
13
16
|
else
|
14
|
-
filename = "or-tools_x86_64_macOS-
|
15
|
-
checksum = "
|
17
|
+
filename = "or-tools_x86_64_macOS-14.1_cpp_v#{version}.tar.gz"
|
18
|
+
checksum = "fe48b022799c807baba79a2b13c29bf9d9614827ba082fc688559d0cab879a86"
|
16
19
|
end
|
17
20
|
else
|
18
21
|
# try /etc/os-release with fallback to /usr/lib/os-release
|
@@ -25,33 +28,30 @@ else
|
|
25
28
|
os = os_info["ID"]
|
26
29
|
os_version = os_info["VERSION_ID"]
|
27
30
|
|
28
|
-
if os == "ubuntu" && os_version == "22.04"
|
31
|
+
if os == "ubuntu" && os_version == "22.04" && !arm
|
29
32
|
filename = "or-tools_amd64_ubuntu-22.04_cpp_v#{version}.tar.gz"
|
30
|
-
checksum = "
|
31
|
-
elsif os == "ubuntu" && os_version == "20.04"
|
33
|
+
checksum = "2a332e95897ac6fc2cfd0122bcbc07cfd286d0f579111529cc99ac3076f5421a"
|
34
|
+
elsif os == "ubuntu" && os_version == "20.04" && !arm
|
32
35
|
filename = "or-tools_amd64_ubuntu-20.04_cpp_v#{version}.tar.gz"
|
33
|
-
checksum = "
|
34
|
-
elsif os == "
|
35
|
-
filename = "or-tools_amd64_ubuntu-18.04_cpp_v#{version}.tar.gz"
|
36
|
-
checksum = "467713721be3fdc709cc7fd0c8d6ad99dda73cab1b9c5de3568336c6ebef6473"
|
37
|
-
elsif os == "debian" && os_version == "11"
|
36
|
+
checksum = "95789f8d93dfb298efecd1c0b888f9a148c011e1a20505b00c38452d68b01644"
|
37
|
+
elsif os == "debian" && os_version == "11" && !arm
|
38
38
|
filename = "or-tools_amd64_debian-11_cpp_v#{version}.tar.gz"
|
39
|
-
checksum = "
|
40
|
-
elsif os == "debian" && os_version == "
|
41
|
-
filename = "or-
|
42
|
-
checksum = "
|
43
|
-
elsif os == "centos" && os_version == "
|
44
|
-
filename = "or-tools_amd64_centos-8_cpp_v#{version}.tar.gz"
|
45
|
-
checksum = "05e2dfc5c82d5122e0c26ce4548cddcae2d474b3b18c024bc189dab887357157"
|
46
|
-
elsif os == "centos" && os_version == "7"
|
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
|
47
44
|
filename = "or-tools_amd64_centos-7_cpp_v#{version}.tar.gz"
|
48
|
-
checksum = "
|
45
|
+
checksum = "d9f193572d3a38b3062ae4cb89afc654e662eb734a9361b1575d649b9530cf60"
|
46
|
+
elsif os == "arch" && !arm
|
47
|
+
filename = "or-tools_amd64_archlinux_cpp_v#{version}.tar.gz"
|
48
|
+
checksum = "803e4b78e7d05b8027a2a391183c8c7855bb758f74d9ced872cfa68e0b9d7d64"
|
49
49
|
else
|
50
50
|
platform =
|
51
51
|
if Gem.win_platform?
|
52
52
|
"Windows"
|
53
53
|
elsif os || os_version
|
54
|
-
"#{os} #{os_version}"
|
54
|
+
"#{os} #{os_version} #{arch}"
|
55
55
|
else
|
56
56
|
"Unknown"
|
57
57
|
end
|
@@ -147,6 +147,9 @@ Dir.mktmpdir do |extract_path|
|
|
147
147
|
ext = file.end_with?(".dylib") ? "dylib" : "so"
|
148
148
|
File.symlink(so_path, File.join(path, "lib/libortools.#{ext}"))
|
149
149
|
end
|
150
|
+
["lib/libprotobuf.a"].each do |file|
|
151
|
+
FileUtils.cp(File.join(extract_path, file), File.join(path, file))
|
152
|
+
end
|
150
153
|
end
|
151
154
|
|
152
155
|
# export
|
data/lib/or-tools.rb
CHANGED
@@ -2,37 +2,37 @@
|
|
2
2
|
require "or_tools/ext"
|
3
3
|
|
4
4
|
# modules
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
5
|
+
require_relative "or_tools/comparison"
|
6
|
+
require_relative "or_tools/comparison_operators"
|
7
|
+
require_relative "or_tools/bool_var"
|
8
|
+
require_relative "or_tools/constant"
|
9
|
+
require_relative "or_tools/cp_model"
|
10
|
+
require_relative "or_tools/cp_solver"
|
11
|
+
require_relative "or_tools/cp_solver_solution_callback"
|
12
|
+
require_relative "or_tools/int_var"
|
13
|
+
require_relative "or_tools/knapsack_solver"
|
14
|
+
require_relative "or_tools/linear_constraint"
|
15
|
+
require_relative "or_tools/linear_expr"
|
16
|
+
require_relative "or_tools/mp_variable"
|
17
|
+
require_relative "or_tools/product_cst"
|
18
|
+
require_relative "or_tools/routing_index_manager"
|
19
|
+
require_relative "or_tools/routing_model"
|
20
|
+
require_relative "or_tools/sat_linear_expr"
|
21
|
+
require_relative "or_tools/sat_int_var"
|
22
|
+
require_relative "or_tools/solver"
|
23
|
+
require_relative "or_tools/sum_array"
|
24
|
+
require_relative "or_tools/version"
|
25
25
|
|
26
26
|
# solution printers
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
require_relative "or_tools/objective_solution_printer"
|
28
|
+
require_relative "or_tools/var_array_solution_printer"
|
29
|
+
require_relative "or_tools/var_array_and_objective_solution_printer"
|
30
30
|
|
31
31
|
# higher level interfaces
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
require_relative "or_tools/basic_scheduler"
|
33
|
+
require_relative "or_tools/seating"
|
34
|
+
require_relative "or_tools/sudoku"
|
35
|
+
require_relative "or_tools/tsp"
|
36
36
|
|
37
37
|
module ORTools
|
38
38
|
class Error < StandardError; end
|
@@ -13,5 +13,9 @@ module ORTools
|
|
13
13
|
search_parameters.log_search = log_search unless log_search.nil?
|
14
14
|
solve_with_parameters(search_parameters)
|
15
15
|
end
|
16
|
+
|
17
|
+
# previous names
|
18
|
+
alias_method :pickup_index_pairs, :pickup_positions
|
19
|
+
alias_method :delivery_index_pairs, :delivery_positions
|
16
20
|
end
|
17
21
|
end
|
data/lib/or_tools/version.rb
CHANGED
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.
|
4
|
+
version: 0.11.1
|
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-
|
11
|
+
date: 2023-12-04 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.
|
19
|
+
version: '4.1'
|
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.
|
26
|
+
version: '4.1'
|
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: '
|
88
|
+
version: '3'
|
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.
|
95
|
+
rubygems_version: 3.4.10
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Operations research tools for Ruby
|