vns 0.1.1.pre.rc.3 → 0.2.0.pre.rc.2

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: 9a434182a43c72e2ec69eb29cab15bdd147ce4f3c90998c0f92c32ba5a5732d5
4
- data.tar.gz: 01050ec37832c0162167facf87dc8f92dad7fd8707a1201ca5f3c341b12e4e4d
3
+ metadata.gz: 0c56f91de10ef30babc78a4767c83d7fd6b3b40753d257cfd7d05e3d69ae5307
4
+ data.tar.gz: 9cf40c45a088d35cd002f3db0cfeac0be5d7a6678a5f2b64f037279254a70fef
5
5
  SHA512:
6
- metadata.gz: 847f80fa81e855423670b37d1b5b0177b2d749fe55b9813e68565ea362882b027d9215d8fa6001c396a586110fdcd5f84d696ac6f31a0b17f462e5001c48fc79
7
- data.tar.gz: f82d763e8965acd652840452883f044fdb8b0c9bde7a1d82ea9a1f6aa30cbecb7244cee3ca122a69c347475546b18747ddbed8ada870705e27c3d8857ce6bb82
6
+ metadata.gz: d002aeb4045d278914880fb1672a98bec542ad09d1aa9e455044af30053efdbd4696cdfa1ed7abf62c1a037a113d64d93091d7177bee82e3901870c38e354599
7
+ data.tar.gz: 342529f673fac35e88073e8a1bf51249b1ab531014c1c8783410cd5073cbe8f2ad28f15e671c175610bedc57f11b7ed1d027a95ce295de267a70732f286906c3
@@ -0,0 +1,42 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ build:
11
+ name: Build + Publish
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Set up Ruby 2.6
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: 2.6.x
20
+
21
+ - name: Publish to GPR
22
+ run: |
23
+ mkdir -p $HOME/.gem
24
+ touch $HOME/.gem/credentials
25
+ chmod 0600 $HOME/.gem/credentials
26
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
27
+ gem build *.gemspec
28
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
29
+ env:
30
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
31
+ OWNER: ${{ github.repository_owner }}
32
+
33
+ - name: Publish to RubyGems
34
+ run: |
35
+ mkdir -p $HOME/.gem
36
+ touch $HOME/.gem/credentials
37
+ chmod 0600 $HOME/.gem/credentials
38
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
39
+ gem build *.gemspec
40
+ gem push *.gem
41
+ env:
42
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,57 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
54
+
55
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
+ # .rubocop-https?--*
57
+
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
@@ -0,0 +1,61 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ vns (0.2.0.pre.rc.2)
5
+ activesupport
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (6.1.1)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ zeitwerk (~> 2.3)
16
+ ast (2.4.1)
17
+ coderay (1.1.3)
18
+ concurrent-ruby (1.1.8)
19
+ i18n (1.8.7)
20
+ concurrent-ruby (~> 1.0)
21
+ method_source (0.9.2)
22
+ minitest (5.14.3)
23
+ parallel (1.20.1)
24
+ parser (2.7.2.0)
25
+ ast (~> 2.4.1)
26
+ pry (0.12.2)
27
+ coderay (~> 1.1.0)
28
+ method_source (~> 0.9.0)
29
+ rainbow (3.0.0)
30
+ rake (13.0.3)
31
+ regexp_parser (2.0.1)
32
+ rexml (3.2.4)
33
+ rubocop (1.6.1)
34
+ parallel (~> 1.10)
35
+ parser (>= 2.7.1.5)
36
+ rainbow (>= 2.2.2, < 4.0)
37
+ regexp_parser (>= 1.8, < 3.0)
38
+ rexml
39
+ rubocop-ast (>= 1.2.0, < 2.0)
40
+ ruby-progressbar (~> 1.7)
41
+ unicode-display_width (>= 1.4.0, < 2.0)
42
+ rubocop-ast (1.3.0)
43
+ parser (>= 2.7.1.5)
44
+ ruby-progressbar (1.10.1)
45
+ tzinfo (2.0.4)
46
+ concurrent-ruby (~> 1.0)
47
+ unicode-display_width (1.7.0)
48
+ zeitwerk (2.4.2)
49
+
50
+ PLATFORMS
51
+ ruby
52
+
53
+ DEPENDENCIES
54
+ bundler
55
+ pry
56
+ rake
57
+ rubocop
58
+ vns!
59
+
60
+ BUNDLED WITH
61
+ 2.1.4
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+ task default: :spec
data/lib/vns.rb CHANGED
@@ -71,7 +71,7 @@ module VNS
71
71
  end
72
72
 
73
73
  progress = (counter + 1) * 1.0 / PERTURBATION_COUNT
74
- @inspection.call(progress, target_function(best_solution)) if @inspection
74
+ @inspection&.call(progress, target_function(best_solution), public_format(best_solution))
75
75
  end
76
76
 
77
77
  best_solution
@@ -119,13 +119,13 @@ module VNS
119
119
  def perturbate(solution)
120
120
  2.times do
121
121
  extracted = []
122
- solution.each do |_, people|
123
- extracted << people.delete_at(rand(people.length))
124
- end
122
+ solution.each do |_, people|
123
+ extracted << people.delete_at(rand(people.length))
124
+ end
125
125
 
126
- extracted.shuffle.each_with_index do |person, i|
127
- solution.values[i] << person
128
- end
126
+ extracted.shuffle.each_with_index do |person, i|
127
+ solution.values[i] << person
128
+ end
129
129
  end
130
130
  end
131
131
 
@@ -161,5 +161,9 @@ module VNS
161
161
  def find_session(solution, person)
162
162
  sessions.detect { |s| solution[s].include?(person) }
163
163
  end
164
+
165
+ def public_format(solution)
166
+ solution.map { |k, v| [k.name, v.map(&:name)] }.to_h
167
+ end
164
168
  end
165
- end
169
+ end
@@ -0,0 +1,13 @@
1
+ module VNS
2
+ class Person
3
+ attr_reader :id, :name
4
+ def initialize(id, name)
5
+ @id = id
6
+ @name = name
7
+ end
8
+
9
+ def to_s
10
+ "#{id}\t#{name}"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module VNS
2
+ class Session
3
+ MAX_ALLOCATION = 25
4
+ attr_reader :id, :name
5
+
6
+ def initialize(id, name)
7
+ @id = id
8
+ @name = name
9
+ end
10
+
11
+ def to_s
12
+ "#{id}\t#{name}"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module VNS
2
+ VERSION = '0.2.0-rc.2'
3
+ end
@@ -0,0 +1,26 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'vns/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'vns'
7
+ s.version = VNS::VERSION
8
+ s.date = '2021-01-23'
9
+ s.summary = 'VNS'
10
+ s.description = 'A gem to execute Variable Neighborhood Search algorithm in optimization problems'
11
+ s.authors = ['Manuel Bustillo']
12
+ s.email = 'mayn13@gmail.com'
13
+ s.homepage = 'https://rubygems.org/exploradoresdemadrid/vns'
14
+ s.license = 'MIT'
15
+
16
+ s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
17
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ end
19
+ s.require_paths = ['lib']
20
+
21
+ s.add_runtime_dependency 'activesupport'
22
+ s.add_development_dependency 'pry'
23
+ s.add_development_dependency 'rubocop'
24
+ s.add_development_dependency 'rake'
25
+ s.add_development_dependency 'bundler'
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.pre.rc.3
4
+ version: 0.2.0.pre.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Bustillo
@@ -87,7 +87,16 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - ".github/workflows/gem-push.yml"
91
+ - ".gitignore"
92
+ - Gemfile
93
+ - Gemfile.lock
94
+ - Rakefile
90
95
  - lib/vns.rb
96
+ - lib/vns/person.rb
97
+ - lib/vns/session.rb
98
+ - lib/vns/version.rb
99
+ - vns.gemspec
91
100
  homepage: https://rubygems.org/exploradoresdemadrid/vns
92
101
  licenses:
93
102
  - MIT