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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 405e26b51140e6605acd8904d7e90e0e7f48b7cfd83641fef6e2e737e7b8cda4
4
- data.tar.gz: e6e0506979a829c260f8bae70e7769524d59d83b7a52e1cadfb6e553d8116587
3
+ metadata.gz: e88bfc983ea525a514082c15ad21c53f9e35f8b1d291d55f6810a0c47c7a2fa8
4
+ data.tar.gz: d3101dceed98ebd35f788c1cd5df122078cd435f5bceb21cf4e7a1b13dd2ac04
5
5
  SHA512:
6
- metadata.gz: 237e13e7340682d974602743de724031c28c99add58c4cf49e670bb05f4fa0c691dcf00dd75797a9ab3efcc9b5505a96f3a2a3d542db8c8746652ec114b5a258
7
- data.tar.gz: 5c782dd281122001095663da47fce8279f5a2c29b6eed65e2288df6727c55724ef424d4c3bfda3ed3b4ce53493964b88d64f67fc843e97dafd98f3e21a4c5183
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.solve_with_solution_callback(model, solution_printer)
2142
+ solver.solve(model, solution_printer)
2143
2143
 
2144
2144
  puts "Statistics"
2145
2145
  puts " - conflicts : %i" % solver.num_conflicts
@@ -1,12 +1,9 @@
1
1
  #include <ortools/graph/assignment.h>
2
2
 
3
- #include <rice/Array.hpp>
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
- *[](SimpleLinearSumAssignment& self) {
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 <rice/Array.hpp>
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
- template<>
14
- inline
15
- KnapsackSolver::SolverType from_ruby<KnapsackSolver::SolverType>(Object x)
11
+ namespace Rice::detail
16
12
  {
17
- std::string s = Symbol(x).str();
18
- if (s == "branch_and_bound") {
19
- return KnapsackSolver::KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER;
20
- } else {
21
- throw std::runtime_error("Unknown solver type: " + s);
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
- *[](KnapsackSolver& self, Array rb_values, Array rb_weights, Array rb_capacities) {
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
  }