tasks_generator 2.0 → 2.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/ext/tasks_generator/variants.h +13 -7
- data/lib/tasks_generator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c08164423ef585060d6bc5070ddf9bac8dd508b9
|
4
|
+
data.tar.gz: 34d7a9995983b89002de5473da70439c13a65b7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90e73e35e189bf932acd9322607a101ee05ee537f4acd0f801451b7a16550e361ee437b279e728794f3eadfd14b904f18c1d5a9b052c8126795c79e0db7d630b
|
7
|
+
data.tar.gz: 0dc220d5fea54faa04abd690e81334c748ad5880a374c7a5fb81f3e12b9154974b327a05b98ec2832af88405be5f125d55fe25bd808c28dd9b5ca17286857d0a
|
@@ -102,24 +102,24 @@ class variants_t {
|
|
102
102
|
for (size_t i = 0; i < questions.size(); ++i) {
|
103
103
|
size_t buffer[questions[i].size()];
|
104
104
|
for (size_t j = 0; j < questions[i].size(); ++j)
|
105
|
-
buffer[j] = questions[i][j].
|
105
|
+
buffer[j] = questions[i][j].get_question_id();
|
106
106
|
std::sort(buffer, buffer + questions[i].size());
|
107
107
|
size_t count = 1;
|
108
108
|
for (size_t j = 1; j < questions[i].size(); ++j)
|
109
109
|
count += buffer[j] != buffer[j - 1];
|
110
|
-
fitness +=
|
110
|
+
fitness += count == questions[i].size();
|
111
111
|
}
|
112
112
|
}
|
113
113
|
{
|
114
114
|
for (size_t i = 0; i < questions.size(); ++i) {
|
115
115
|
size_t buffer[questions[i].size()];
|
116
116
|
for (size_t j = 0; j < questions[i].size(); ++j)
|
117
|
-
buffer[j] = questions[i][j].
|
117
|
+
buffer[j] = questions[i][j].get_topic_id();
|
118
118
|
std::sort(buffer, buffer + questions[i].size());
|
119
119
|
size_t count = 1;
|
120
120
|
for (size_t j = 1; j < questions[i].size(); ++j)
|
121
121
|
count += buffer[j] != buffer[j - 1];
|
122
|
-
fitness += count
|
122
|
+
fitness += double(count) * 100.0 / questions[i].size();
|
123
123
|
}
|
124
124
|
}
|
125
125
|
{
|
@@ -128,10 +128,16 @@ class variants_t {
|
|
128
128
|
for (size_t j = 0; j < questions[i].size(); ++j)
|
129
129
|
buffer[j] = questions[i][j].get_topic_id();
|
130
130
|
std::sort(buffer, buffer + questions[i].size());
|
131
|
-
size_t count =
|
131
|
+
size_t count = 0;
|
132
132
|
for (size_t j = 1; j < questions[i].size(); ++j)
|
133
|
-
|
134
|
-
|
133
|
+
if (buffer[j] == buffer[j - 1]) {
|
134
|
+
++count;
|
135
|
+
} else if (count > 0) {
|
136
|
+
fitness += 10.0 / count;
|
137
|
+
count = 0;
|
138
|
+
}
|
139
|
+
if (count > 0)
|
140
|
+
fitness += 10.0 / count;
|
135
141
|
}
|
136
142
|
}
|
137
143
|
{
|