or-tools 0.5.0 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +1 -1
- data/ext/or-tools/assignment.cpp +2 -5
- data/ext/or-tools/bin_packing.cpp +26 -33
- data/ext/or-tools/constraint.cpp +149 -201
- data/ext/or-tools/ext.cpp +3 -3
- data/ext/or-tools/ext.h +4 -0
- data/ext/or-tools/extconf.rb +1 -3
- data/ext/or-tools/linear.cpp +74 -67
- data/ext/or-tools/network_flows.cpp +7 -9
- data/ext/or-tools/routing.cpp +121 -145
- data/ext/or-tools/vendor.rb +16 -13
- data/lib/or_tools/cp_solver.rb +12 -6
- data/lib/or_tools/seating.rb +1 -1
- data/lib/or_tools/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e88bfc983ea525a514082c15ad21c53f9e35f8b1d291d55f6810a0c47c7a2fa8
|
4
|
+
data.tar.gz: d3101dceed98ebd35f788c1cd5df122078cd435f5bceb21cf4e7a1b13dd2ac04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a12e68f45b7829f76d77e107c14cb072158bc956348b07dc93bc0bcb4a91f6fff8a22389d88bd8102a3c7d6eec86e25e4aeca4043cd4b2b560575f8d5dde8578
|
7
|
+
data.tar.gz: 1448aa409c1664ce15e859a5ad115b4ba975f4b976ad522cc95db4699c65c9356a5b78f05507db166a46fd60cc80e0907a85b625fc2150bdaa591fe3aa7b13db
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
## 0.5.4 (2021-10-01)
|
2
|
+
|
3
|
+
- Updated OR-Tools to 9.1
|
4
|
+
- Added binary installation for Debian 11
|
5
|
+
- Deprecated `solve_with_solution_callback` and `search_for_all_solutions`
|
6
|
+
|
7
|
+
## 0.5.3 (2021-08-02)
|
8
|
+
|
9
|
+
- Added more methods to `IntVar`, `IntervalVar`, and `Constraint`
|
10
|
+
- Added `RoutingModelParameters`
|
11
|
+
|
12
|
+
## 0.5.2 (2021-07-07)
|
13
|
+
|
14
|
+
- Added `export_model_as_lp_format` and `export_model_as_mps_format` to `Solver`
|
15
|
+
|
16
|
+
## 0.5.1 (2021-05-23)
|
17
|
+
|
18
|
+
- Updated to Rice 4
|
19
|
+
|
1
20
|
## 0.5.0 (2021-04-30)
|
2
21
|
|
3
22
|
- Updated OR-Tools to 9.0
|
data/README.md
CHANGED
@@ -2139,7 +2139,7 @@ model.add(seats[[0, 0]] == 1)
|
|
2139
2139
|
# Solve model
|
2140
2140
|
solver = ORTools::CpSolver.new
|
2141
2141
|
solution_printer = WeddingChartPrinter.new(seats, names, num_tables, num_guests)
|
2142
|
-
solver.
|
2142
|
+
solver.solve(model, solution_printer)
|
2143
2143
|
|
2144
2144
|
puts "Statistics"
|
2145
2145
|
puts " - conflicts : %i" % solver.num_conflicts
|
data/ext/or-tools/assignment.cpp
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
#include <ortools/graph/assignment.h>
|
2
2
|
|
3
|
-
#include
|
4
|
-
#include <rice/Constructor.hpp>
|
5
|
-
#include <rice/Module.hpp>
|
3
|
+
#include "ext.h"
|
6
4
|
|
7
5
|
using operations_research::SimpleLinearSumAssignment;
|
8
6
|
|
9
|
-
using Rice::Array;
|
10
7
|
using Rice::Symbol;
|
11
8
|
|
12
9
|
void init_assignment(Rice::Module& m) {
|
@@ -23,7 +20,7 @@ void init_assignment(Rice::Module& m) {
|
|
23
20
|
.define_method("assignment_cost", &SimpleLinearSumAssignment::AssignmentCost)
|
24
21
|
.define_method(
|
25
22
|
"solve",
|
26
|
-
|
23
|
+
[](SimpleLinearSumAssignment& self) {
|
27
24
|
auto status = self.Solve();
|
28
25
|
|
29
26
|
if (status == SimpleLinearSumAssignment::Status::OPTIMAL) {
|
@@ -1,8 +1,6 @@
|
|
1
1
|
#include <ortools/algorithms/knapsack_solver.h>
|
2
2
|
|
3
|
-
#include
|
4
|
-
#include <rice/Constructor.hpp>
|
5
|
-
#include <rice/Module.hpp>
|
3
|
+
#include "ext.h"
|
6
4
|
|
7
5
|
using operations_research::KnapsackSolver;
|
8
6
|
|
@@ -10,16 +8,31 @@ using Rice::Array;
|
|
10
8
|
using Rice::Object;
|
11
9
|
using Rice::Symbol;
|
12
10
|
|
13
|
-
|
14
|
-
inline
|
15
|
-
KnapsackSolver::SolverType from_ruby<KnapsackSolver::SolverType>(Object x)
|
11
|
+
namespace Rice::detail
|
16
12
|
{
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
template<>
|
14
|
+
struct Type<KnapsackSolver::SolverType>
|
15
|
+
{
|
16
|
+
static bool verify()
|
17
|
+
{
|
18
|
+
return true;
|
19
|
+
}
|
20
|
+
};
|
21
|
+
|
22
|
+
template<>
|
23
|
+
class From_Ruby<KnapsackSolver::SolverType>
|
24
|
+
{
|
25
|
+
public:
|
26
|
+
KnapsackSolver::SolverType convert(VALUE x)
|
27
|
+
{
|
28
|
+
auto s = Symbol(x).str();
|
29
|
+
if (s == "branch_and_bound") {
|
30
|
+
return KnapsackSolver::KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER;
|
31
|
+
} else {
|
32
|
+
throw std::runtime_error("Unknown solver type: " + s);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
};
|
23
36
|
}
|
24
37
|
|
25
38
|
void init_bin_packing(Rice::Module& m) {
|
@@ -29,27 +42,7 @@ void init_bin_packing(Rice::Module& m) {
|
|
29
42
|
.define_method("best_solution_contains?", &KnapsackSolver::BestSolutionContains)
|
30
43
|
.define_method(
|
31
44
|
"init",
|
32
|
-
|
33
|
-
std::vector<int64_t> values;
|
34
|
-
for (std::size_t i = 0; i < rb_values.size(); ++i) {
|
35
|
-
values.push_back(from_ruby<int64_t>(rb_values[i]));
|
36
|
-
}
|
37
|
-
|
38
|
-
std::vector<std::vector<int64_t>> weights;
|
39
|
-
for (std::size_t i = 0; i < rb_weights.size(); ++i) {
|
40
|
-
Array rb_w = Array(rb_weights[i]);
|
41
|
-
std::vector<int64_t> w;
|
42
|
-
for (std::size_t j = 0; j < rb_w.size(); ++j) {
|
43
|
-
w.push_back(from_ruby<int64_t>(rb_w[j]));
|
44
|
-
}
|
45
|
-
weights.push_back(w);
|
46
|
-
}
|
47
|
-
|
48
|
-
std::vector<int64_t> capacities;
|
49
|
-
for (std::size_t i = 0; i < rb_capacities.size(); ++i) {
|
50
|
-
capacities.push_back(from_ruby<int64_t>(rb_capacities[i]));
|
51
|
-
}
|
52
|
-
|
45
|
+
[](KnapsackSolver& self, std::vector<int64_t> values, std::vector<std::vector<int64_t>> weights, std::vector<int64_t> capacities) {
|
53
46
|
self.Init(values, weights, capacities);
|
54
47
|
});
|
55
48
|
}
|