or-tools 0.3.2 → 0.3.3

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: ae2a270bed20b9d1236296f7368506b7ddb2172470ab2d57c655340f2c3a7a13
4
- data.tar.gz: ef2e7101057762004b6bbb4f72b3dd5da50bc3cbfa236673f87b4b55d8aff901
3
+ metadata.gz: a0af0b1dc8198bf30ff09350e3c4da587735d5ece10204bf19c6dfc8916e2135
4
+ data.tar.gz: 6b685437c9d8cefcb91d52b24d090179a0884ad9a8edf966131493f3c8bc1dbf
5
5
  SHA512:
6
- metadata.gz: 534ac8c95ae51699667d0300f2d61664a28c8f992392a6621e70b47bae500fab41a9c30321a8a57f90a58abc5a740cb31c796e7f0447fa3d191161dd764f7467
7
- data.tar.gz: 2418aec568f5ae54883dd2882ea961e79ace65d889dd1442cadfd11a2782fae965f8e18298e851794ac4e0a0e3b2f8c82ff3febc38e112016a2cb2236febf656
6
+ metadata.gz: 80ed4a17f6079d997ef42b8659cea3879f4b0935e8bbfa7e566a76937b2ea0f86f906b3bb236bd43f17cecb6364c3025916074438f768c7853e60a87a025d150
7
+ data.tar.gz: 9b9e085b2cf01a3dc7d1f77363c903dfb7d6e41280626c37408da9889534ac7c5c85d49c73714022461ae55df36abb10932b4ae9272d10d910e95a6681cddad6
@@ -1,3 +1,7 @@
1
+ ## 0.3.3 (2020-10-12)
2
+
3
+ - Added support for start and end points for routing
4
+
1
5
  ## 0.3.2 (2020-08-04)
2
6
 
3
7
  - Updated OR-Tools to 7.8
data/NOTICE.txt CHANGED
@@ -1,3 +1,4 @@
1
+ Copyright 2010-2018 Google LLC
1
2
  Copyright 2020 Andrew Kane
2
3
 
3
4
  Licensed under the Apache License, Version 2.0 (the "License");
@@ -101,6 +101,14 @@ Object to_ruby<RoutingNodeIndex>(RoutingNodeIndex const &x)
101
101
  return to_ruby<int>(x.value());
102
102
  }
103
103
 
104
+ std::vector<RoutingNodeIndex> nodeIndexVector(Array x) {
105
+ std::vector<RoutingNodeIndex> res;
106
+ for (auto const& v : x) {
107
+ res.push_back(from_ruby<RoutingNodeIndex>(v));
108
+ }
109
+ return res;
110
+ }
111
+
104
112
  template<>
105
113
  inline
106
114
  operations_research::sat::LinearExpr from_ruby<operations_research::sat::LinearExpr>(Object x)
@@ -699,7 +707,16 @@ void Init_ext()
699
707
  });
700
708
 
701
709
  define_class_under<RoutingIndexManager>(rb_mORTools, "RoutingIndexManager")
702
- .define_constructor(Constructor<RoutingIndexManager, int, int, RoutingNodeIndex>())
710
+ .define_singleton_method(
711
+ "_new_depot",
712
+ *[](int num_nodes, int num_vehicles, RoutingNodeIndex depot) {
713
+ return RoutingIndexManager(num_nodes, num_vehicles, depot);
714
+ })
715
+ .define_singleton_method(
716
+ "_new_starts_ends",
717
+ *[](int num_nodes, int num_vehicles, Array starts, Array ends) {
718
+ return RoutingIndexManager(num_nodes, num_vehicles, nodeIndexVector(starts), nodeIndexVector(ends));
719
+ })
703
720
  .define_method("index_to_node", &RoutingIndexManager::IndexToNode)
704
721
  .define_method("node_to_index", &RoutingIndexManager::NodeToIndex);
705
722
 
@@ -11,6 +11,7 @@ require "or_tools/cp_solver_solution_callback"
11
11
  require "or_tools/int_var"
12
12
  require "or_tools/knapsack_solver"
13
13
  require "or_tools/linear_expr"
14
+ require "or_tools/routing_index_manager"
14
15
  require "or_tools/routing_model"
15
16
  require "or_tools/sat_linear_expr"
16
17
  require "or_tools/sat_int_var"
@@ -0,0 +1,11 @@
1
+ module ORTools
2
+ class RoutingIndexManager
3
+ def self.new(num_nodes, num_vehicles, starts, ends = nil)
4
+ if ends
5
+ _new_starts_ends(num_nodes, num_vehicles, starts, ends)
6
+ else
7
+ _new_depot(num_nodes, num_vehicles, starts)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module ORTools
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
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.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-04 00:00:00.000000000 Z
11
+ date: 2020-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice
@@ -105,6 +105,7 @@ files:
105
105
  - lib/or_tools/int_var.rb
106
106
  - lib/or_tools/knapsack_solver.rb
107
107
  - lib/or_tools/linear_expr.rb
108
+ - lib/or_tools/routing_index_manager.rb
108
109
  - lib/or_tools/routing_model.rb
109
110
  - lib/or_tools/sat_int_var.rb
110
111
  - lib/or_tools/sat_linear_expr.rb