tabu_search 0.1.0 → 0.1.1
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/.gitignore +6 -0
- data/lib/tabu_search/context.rb +5 -10
- data/lib/tabu_search/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d6097d068a299a73aa5fec89b8cd3dd67a700e5
|
4
|
+
data.tar.gz: 468375232bd946564a5a82074a309ca7d2aa4756
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a99e82b761b501f57e2229f3902c186684bac050785620e86384ab1676d6c76c32981939b9b7d3bb7ca784c2efefacfdaeccb9db275b3b82d05e124969037d8
|
7
|
+
data.tar.gz: 6c45a11233a276e371ef6ecc82a975b69359fdf25ba55fc2a6484e784b6326fc3d66a2daf7552ca70fb7847ba1a598d400d0b49b250cac67d152d99910c066fd
|
data/.gitignore
CHANGED
data/lib/tabu_search/context.rb
CHANGED
@@ -15,7 +15,7 @@ module TabuSearch
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def search(unit, times)
|
18
|
-
@best_genome = unit.genome
|
18
|
+
@best_genome = unit.genome.dup
|
19
19
|
@best_fitness = unit.fitness
|
20
20
|
|
21
21
|
times.times do
|
@@ -39,19 +39,14 @@ module TabuSearch
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
42
|
def search_best_neighbour(unit)
|
46
|
-
actions = unit.search_neighbour(self)
|
47
|
-
|
48
|
-
sorted_actions = actions.sort_by {|data| -data[-1] }
|
49
|
-
return sorted_actions[0] if sorted_actions[0][-1] > best_fitness
|
43
|
+
actions = unit.search_neighbour(self).sort_by! {|data| -data[-1] }
|
44
|
+
return actions[0] if actions[0][-1] > best_fitness
|
50
45
|
|
51
|
-
|
46
|
+
actions.each do |data|
|
52
47
|
return data unless tabu_set.include?(data[0])
|
53
48
|
end
|
54
|
-
return
|
49
|
+
return actions.first
|
55
50
|
end
|
56
51
|
end
|
57
52
|
end
|
data/lib/tabu_search/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tabu_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiangzhi.xie
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|