or-tools 0.10.1 → 0.11.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 +4 -4
- data/CHANGELOG.md +6 -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 +12 -18
- 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: 68ea17bb23e576a57ac2f4949cf79d0248445dc90fbf8148a538d02c3b853bb7
|
4
|
+
data.tar.gz: 4d066a51a1dea924f8d8edad1f70313002073233e92c86f07418f7ad19a1f29e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06fd522bf2d86fff7117637d07e62168a1cc4b10bf371d11fd5d8973027e43079c93723abe666e071ac77dd683a73cb584f0987d1ec78d842f1a0e66a75ce2f9
|
7
|
+
data.tar.gz: 558b06c83bc6e8108d6175325a7d6408b047f127c16a5f12a197d83509eeca2a9dc9ed01ea72383ed6176aae8fc4d18a378003d8ca274cff42a117a5d164a989
|
data/CHANGELOG.md
CHANGED
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,15 @@ require "fileutils"
|
|
4
4
|
require "net/http"
|
5
5
|
require "tmpdir"
|
6
6
|
|
7
|
-
version = "9.
|
7
|
+
version = "9.8.3296"
|
8
8
|
|
9
9
|
if RbConfig::CONFIG["host_os"] =~ /darwin/i
|
10
10
|
if RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i
|
11
|
-
filename = "or-tools_arm64_macOS-
|
12
|
-
checksum = "
|
11
|
+
filename = "or-tools_arm64_macOS-14.1_cpp_v#{version}.tar.gz"
|
12
|
+
checksum = "253efad127c55b78967e3e3a3b4a573f9da0a2562c4f33f14fbf462ca58448f7"
|
13
13
|
else
|
14
|
-
filename = "or-tools_x86_64_macOS-
|
15
|
-
checksum = "
|
14
|
+
filename = "or-tools_x86_64_macOS-14.1_cpp_v#{version}.tar.gz"
|
15
|
+
checksum = "fe48b022799c807baba79a2b13c29bf9d9614827ba082fc688559d0cab879a86"
|
16
16
|
end
|
17
17
|
else
|
18
18
|
# try /etc/os-release with fallback to /usr/lib/os-release
|
@@ -27,25 +27,16 @@ else
|
|
27
27
|
|
28
28
|
if os == "ubuntu" && os_version == "22.04"
|
29
29
|
filename = "or-tools_amd64_ubuntu-22.04_cpp_v#{version}.tar.gz"
|
30
|
-
checksum = "
|
30
|
+
checksum = "2a332e95897ac6fc2cfd0122bcbc07cfd286d0f579111529cc99ac3076f5421a"
|
31
31
|
elsif os == "ubuntu" && os_version == "20.04"
|
32
32
|
filename = "or-tools_amd64_ubuntu-20.04_cpp_v#{version}.tar.gz"
|
33
|
-
checksum = "
|
34
|
-
elsif os == "ubuntu" && os_version == "18.04"
|
35
|
-
filename = "or-tools_amd64_ubuntu-18.04_cpp_v#{version}.tar.gz"
|
36
|
-
checksum = "467713721be3fdc709cc7fd0c8d6ad99dda73cab1b9c5de3568336c6ebef6473"
|
33
|
+
checksum = "95789f8d93dfb298efecd1c0b888f9a148c011e1a20505b00c38452d68b01644"
|
37
34
|
elsif os == "debian" && os_version == "11"
|
38
35
|
filename = "or-tools_amd64_debian-11_cpp_v#{version}.tar.gz"
|
39
|
-
checksum = "
|
40
|
-
elsif os == "debian" && os_version == "10"
|
41
|
-
filename = "or-tools_amd64_debian-10_cpp_v#{version}.tar.gz"
|
42
|
-
checksum = "f141f16cf92877ed5819e0104126a31c9c139c070de06d7f40c957a4e6ce9284"
|
43
|
-
elsif os == "centos" && os_version == "8"
|
44
|
-
filename = "or-tools_amd64_centos-8_cpp_v#{version}.tar.gz"
|
45
|
-
checksum = "05e2dfc5c82d5122e0c26ce4548cddcae2d474b3b18c024bc189dab887357157"
|
36
|
+
checksum = "e7dd81b13c53c739447254b8836ece55f8b92a107688cc9f3511705c9962fa2d"
|
46
37
|
elsif os == "centos" && os_version == "7"
|
47
38
|
filename = "or-tools_amd64_centos-7_cpp_v#{version}.tar.gz"
|
48
|
-
checksum = "
|
39
|
+
checksum = "d9f193572d3a38b3062ae4cb89afc654e662eb734a9361b1575d649b9530cf60"
|
49
40
|
else
|
50
41
|
platform =
|
51
42
|
if Gem.win_platform?
|
@@ -147,6 +138,9 @@ Dir.mktmpdir do |extract_path|
|
|
147
138
|
ext = file.end_with?(".dylib") ? "dylib" : "so"
|
148
139
|
File.symlink(so_path, File.join(path, "lib/libortools.#{ext}"))
|
149
140
|
end
|
141
|
+
["lib/libprotobuf.a"].each do |file|
|
142
|
+
FileUtils.cp(File.join(extract_path, file), File.join(path, file))
|
143
|
+
end
|
150
144
|
end
|
151
145
|
|
152
146
|
# 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.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-
|
11
|
+
date: 2023-11-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.
|
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
|