tasks_generator 2.0 → 2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a506cf0002cd930cf5180dcabbff7bef77f729ac
4
- data.tar.gz: ab91148fd235307b40fedbedc5673fdfc936ecb1
3
+ metadata.gz: c08164423ef585060d6bc5070ddf9bac8dd508b9
4
+ data.tar.gz: 34d7a9995983b89002de5473da70439c13a65b7d
5
5
  SHA512:
6
- metadata.gz: 50d326baa8fca58103b4210fb4a6f985cf05dc61c72d808ba753f9770f4ba316f7e3995fd86392438a7e1739fa9d1fe4978892f5259ae44ded6cd17406466fbf
7
- data.tar.gz: f529a4d9de561caba1ff7e036c0c2ba802223aa4376dd224177e918ca370cf295aa72ed55e71d6a2f15aeaf8bad0752ae06fc6618de3daf0d2749d919d32998a
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].get_second_level_topic_id();
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 += double(count) / questions[i].size();
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].get_question_id();
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 == questions[i].size();
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 = 1;
131
+ size_t count = 0;
132
132
  for (size_t j = 1; j < questions[i].size(); ++j)
133
- count += buffer[j] != buffer[j - 1];
134
- fitness += double(count) * 100.0 / questions[i].size();
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
  {
@@ -1,3 +1,3 @@
1
1
  module TasksGenerator
2
- VERSION = "2.0"
2
+ VERSION = "2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tasks_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: '2.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arslan Urtashev