vns 0.1.1.pre.rc.4 → 0.2.0
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/.github/workflows/gem-push.yml +42 -0
- data/.gitignore +57 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +61 -0
- data/Rakefile +2 -0
- data/lib/vns.rb +12 -8
- data/lib/vns/person.rb +13 -0
- data/lib/vns/session.rb +15 -0
- data/lib/vns/version.rb +3 -0
- data/vns.gemspec +26 -0
- metadata +12 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aabc4061fa4c01eebf965ce36dda299b11b35d49906eb5815bde21a3d4647703
|
|
4
|
+
data.tar.gz: 273f309115f63a6ccfa5bf4497bbe940a31c8d5bdf4e8046d9b23115c48f6971
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bf5aec1de3b5c24b83c48acdfa4c895f7d01391be41d6cc5689b1ddf5a1b946105d022b286c7ea408f538c081c73e1da5dac3714f405e27054c2bce89c6840c5
|
|
7
|
+
data.tar.gz: 0b3370fa91a444e225ed7462acc19dacba4b0cb1428111c93801822f673a8581142a2d920c509157bd146cfc13ebd775994eada3ae9d822f6417668acd118e8f
|
|
@@ -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}}"
|
data/.gitignore
ADDED
|
@@ -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
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
vns (0.2.0)
|
|
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
|
data/Rakefile
ADDED
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
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
solution.each do |_, people|
|
|
123
|
+
extracted << people.delete_at(rand(people.length))
|
|
124
|
+
end
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
data/lib/vns/person.rb
ADDED
data/lib/vns/session.rb
ADDED
data/lib/vns/version.rb
ADDED
data/vns.gemspec
ADDED
|
@@ -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.
|
|
4
|
+
version: 0.2.0
|
|
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
|
|
@@ -103,9 +112,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
103
112
|
version: '0'
|
|
104
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
114
|
requirements:
|
|
106
|
-
- - "
|
|
115
|
+
- - ">="
|
|
107
116
|
- !ruby/object:Gem::Version
|
|
108
|
-
version:
|
|
117
|
+
version: '0'
|
|
109
118
|
requirements: []
|
|
110
119
|
rubygems_version: 3.0.3
|
|
111
120
|
signing_key:
|