vns 0.2.0 → 0.3.0.pre.rc.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/Gemfile.lock +1 -1
- data/lib/vns.rb +4 -3
- data/lib/vns/session.rb +1 -2
- data/lib/vns/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 798de6e406551a8baaf7f64484331cba905582a5a31a1e3a49ebca9896fd6e72
|
|
4
|
+
data.tar.gz: 3eef161ac7c2f46a348f44c28d2caff653b6fb3328b59e453475ae64da12e11e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 386bd0e92596dcdd8f3b9814b892a59b3bd8abc7e394adc8be698ffe7fd5aa8bebf2f2a1d17aa718f5546c819c10b478ad0d6d520d49f0b491943ad7b468ee98
|
|
7
|
+
data.tar.gz: 61b62b32637009b7d8d1a18d83693b6fd31bcc358c622d331a3129246ada07f0eb144bdb6935ad9887954a5fa3c32dd040ceeea089eee7892116373d7c041e8b
|
data/Gemfile.lock
CHANGED
data/lib/vns.rb
CHANGED
|
@@ -4,15 +4,16 @@ module VNS
|
|
|
4
4
|
require 'active_support/all'
|
|
5
5
|
|
|
6
6
|
class VNS
|
|
7
|
-
attr_reader :people, :sessions, :preferences
|
|
7
|
+
attr_reader :people, :sessions, :preferences, :max_allocation
|
|
8
8
|
|
|
9
9
|
PERTURBATION_COUNT = 100
|
|
10
10
|
|
|
11
|
-
def initialize(people, sessions, preferences, &inspection)
|
|
11
|
+
def initialize(people, sessions, preferences, max_allocation, &inspection)
|
|
12
12
|
@people = people.map.with_index { |person, i| Person.new(i, person) }
|
|
13
13
|
@sessions = sessions.map.with_index { |session, i| Session.new(i, session) }
|
|
14
14
|
@preferences = preferences
|
|
15
15
|
@inspection = inspection
|
|
16
|
+
@max_allocation = max_allocation
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
def run
|
|
@@ -141,7 +142,7 @@ module VNS
|
|
|
141
142
|
end
|
|
142
143
|
|
|
143
144
|
def feasible?(solution)
|
|
144
|
-
solution.values.all? { |group| group.size <=
|
|
145
|
+
solution.values.all? { |group| group.size <= max_allocation }
|
|
145
146
|
end
|
|
146
147
|
|
|
147
148
|
def swap(solution, person1, person2)
|
data/lib/vns/session.rb
CHANGED
data/lib/vns/version.rb
CHANGED
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.3.0.pre.rc.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Manuel Bustillo
|
|
@@ -112,9 +112,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
112
112
|
version: '0'
|
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
|
-
- - "
|
|
115
|
+
- - ">"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version:
|
|
117
|
+
version: 1.3.1
|
|
118
118
|
requirements: []
|
|
119
119
|
rubygems_version: 3.0.3
|
|
120
120
|
signing_key:
|