gthc 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gthc/olson/algorithm.rb +3 -2
- data/lib/gthc/olson/weight.rb +7 -21
- data/lib/gthc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b43241f23f222376f99df65b0584ef0eb6d7490a2c2f0c41411f0abe2a347b41
|
4
|
+
data.tar.gz: 36585ccfc6a5270eacab88728d04ff8dbbbae391dc9082cb9b73ab6b46e3976f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88f1acc5a41ebd711dce9cb21dd4b971ad653b7ec33eac25b9d69b6b81c7f0a6bc29b156c861993623de418a1eaaff865fdd99ab41f4044feed0cdf9f9290293
|
7
|
+
data.tar.gz: 50402622cf5948c50ca2d25a67953a8358ee44b2dae4b690151ad5ab2398498956008109150ab78d35314ef27683f9e997546631f167fce5541ba92fc30ae803
|
data/lib/gthc/olson/algorithm.rb
CHANGED
@@ -23,13 +23,14 @@ module Algorithm
|
|
23
23
|
people, slots = Weight.weightBalance(people, slots)
|
24
24
|
|
25
25
|
# Weight Contiguous - prioritize people to stay in the tent more time at once.
|
26
|
-
slots, scheduleGrid = Weight.weightContiguous(slots, scheduleGrid
|
26
|
+
slots, scheduleGrid = Weight.weightContiguous(slots, scheduleGrid)
|
27
27
|
|
28
28
|
# Weight Tough Time - prioritize time slots with few people available.
|
29
29
|
slots = Weight.weightToughTime(slots, scheduleLength)
|
30
30
|
|
31
31
|
# Sort by Weights
|
32
|
-
slots.
|
32
|
+
slots.sort! { |a, b| b.weight <=> a.weight }
|
33
|
+
# pp slots
|
33
34
|
|
34
35
|
# Update people, spreadsheet, and remove slots.
|
35
36
|
people, slots, graveyard, scheduleGrid = Weight.weightPick(people, slots, graveyard, scheduleGrid)
|
data/lib/gthc/olson/weight.rb
CHANGED
@@ -22,20 +22,16 @@ module Weight
|
|
22
22
|
nightScheduled = people[currentPersonID].nightScheduled
|
23
23
|
night = currentSlot.isNight;
|
24
24
|
|
25
|
-
nightMulti =
|
26
|
-
dayMulti =
|
25
|
+
nightMulti = 1;
|
26
|
+
dayMulti = 1;
|
27
27
|
|
28
28
|
# Set multipliers.
|
29
29
|
if nightScheduled != 0
|
30
|
-
nightMulti = 1.0 / nightScheduled
|
31
|
-
else
|
32
|
-
nightMulti = 1.5
|
30
|
+
nightMulti = 1.0 / (nightScheduled + 1)
|
33
31
|
end
|
34
32
|
|
35
33
|
if dayScheduled != 0
|
36
|
-
dayMulti =
|
37
|
-
else
|
38
|
-
dayMulti = 1.5
|
34
|
+
dayMulti = 1.0 / (dayScheduled + 1)
|
39
35
|
end
|
40
36
|
|
41
37
|
#Adjust weights with multipliers.
|
@@ -55,7 +51,7 @@ module Weight
|
|
55
51
|
end
|
56
52
|
|
57
53
|
# Weight Contiguous - prioritize people to stay in the tent more time at once.
|
58
|
-
def self.weightContiguous(slots, scheduleGrid
|
54
|
+
def self.weightContiguous(slots, scheduleGrid)
|
59
55
|
|
60
56
|
i = 0
|
61
57
|
while i < slots.length
|
@@ -94,9 +90,7 @@ module Weight
|
|
94
90
|
|
95
91
|
# Both are not free
|
96
92
|
if !belowTent && !belowFree && !aboveSome && !belowSome && !aboveTent && !aboveFree
|
97
|
-
|
98
|
-
multi = -1
|
99
|
-
end
|
93
|
+
multi *= 0.25
|
100
94
|
end
|
101
95
|
|
102
96
|
# Above is scheduled, below is free.
|
@@ -140,18 +134,10 @@ module Weight
|
|
140
134
|
end
|
141
135
|
|
142
136
|
# Occurance of Somewhat Available
|
143
|
-
if
|
137
|
+
if slots[i].status == "Somewhat"
|
144
138
|
multi *= 0.5
|
145
139
|
end
|
146
140
|
|
147
|
-
# multi based on person
|
148
|
-
person = people[slots[i].col]
|
149
|
-
if slots[i].isNight && person.nightScheduled > 0
|
150
|
-
multi *= (1/person.nightScheduled)
|
151
|
-
elsif person.dayScheduled > 0
|
152
|
-
multi *= (1/person.dayScheduled)
|
153
|
-
end
|
154
|
-
|
155
141
|
slots[i].weight = slots[i].weight*multi
|
156
142
|
i += 1
|
157
143
|
|
data/lib/gthc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gthc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Ibrahim
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-12-
|
12
|
+
date: 2019-12-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|