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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b995d10c83ee458580e2c3c7c05642c635d818c1
4
- data.tar.gz: acc5fdb3cd382d56d8e465ecddffede0b6c9f3d1
3
+ metadata.gz: 0d6097d068a299a73aa5fec89b8cd3dd67a700e5
4
+ data.tar.gz: 468375232bd946564a5a82074a309ca7d2aa4756
5
5
  SHA512:
6
- metadata.gz: 67ae26f25d00358037fcb5e6adb1c337892f1b3a3d1d84fa1f4361949c6a53fd826672483c0f76f38b2f7fcd636a80b3d80f3606a0974067f31e7b2b26c26f2f
7
- data.tar.gz: 0d07e17d3b131371c4bf118bd294dbbe6e47cb4a10851ed174529163c8ce9dec58d3375eb33c11ddf7f0f7718535daf444afd0f75240b5206fa7180bf1903583
6
+ metadata.gz: 7a99e82b761b501f57e2229f3902c186684bac050785620e86384ab1676d6c76c32981939b9b7d3bb7ca784c2efefacfdaeccb9db275b3b82d05e124969037d8
7
+ data.tar.gz: 6c45a11233a276e371ef6ecc82a975b69359fdf25ba55fc2a6484e784b6326fc3d66a2daf7552ca70fb7847ba1a598d400d0b49b250cac67d152d99910c066fd
data/.gitignore CHANGED
@@ -10,3 +10,9 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+
14
+ /spec/examples.txt
15
+
16
+ *.gem
17
+
18
+ *.swp
@@ -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
- sorted_actions.each do |data|
46
+ actions.each do |data|
52
47
  return data unless tabu_set.include?(data[0])
53
48
  end
54
- return sorted_actions.first
49
+ return actions.first
55
50
  end
56
51
  end
57
52
  end
@@ -1,3 +1,3 @@
1
1
  module TabuSearch
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-03-30 00:00:00.000000000 Z
11
+ date: 2017-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler