Skip to content

Commit 448c804

Browse files
committed
commit 3
1 parent 5c08b92 commit 448c804

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
cmake_minimum_required(VERSION 3.10)
2-
project(hybrid_algorithm)
1+
cmake_minimum_required(VERSION 3.0)
2+
project(hybrid_algorithm CXX)
33

44
set(CMAKE_CXX_STANDARD 11)
55

Population.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Population::Population(int size, int MaxDur, double prob_cross) {
2020
void Population::new_generation() {
2121
std::vector<Chromosome> new_generation{static_cast<size_t>(population_size)};
2222

23-
int n_percent = population_size * 0.1;
23+
int n_percent = static_cast<int>(population_size * 0.1);
2424
std::sort(population_array.begin(), population_array.end(),
2525
[](Chromosome x, Chromosome y) { return Chromosome::cost_function(x) > Chromosome::cost_function(y); });
2626

@@ -44,17 +44,15 @@ void Population::new_generation() {
4444
while (parent_one_index == parent_two_index) {
4545
parent_two_index = dist(rng);
4646
}
47-
new_generation[i] = Chromosome::cross(this->population_array[parent_one_index],
48-
this->population_array[parent_two_index]);
47+
new_generation[i] = Chromosome::cross(this->population_array[parent_one_index], this->population_array[parent_two_index]);
4948
}
5049
std::cout << "Crossover process completed.\n";
5150

5251
std::cout << "The rest of new population is randomly generated to prevent early convergence.\n";
5352
// one or more new members of the population are randomly generated
5453
// from the same distribution as the original population
5554
for (; i < population_size; ++i) {
56-
new_generation.emplace_back(
57-
Chromosome(population_size, new_generation[0].get_max_dur(), new_generation[0].get_prob_cross()));
55+
new_generation.emplace_back(Chromosome(population_size, new_generation[0].get_max_dur(), new_generation[0].get_prob_cross()));
5856
}
5957
this->population_array.clear();
6058
this->population_array = new_generation;

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# hybrid_genetic_algorithm_JSP
22
<p>
3-
This project implements the genetic algorithm described by Jose Fernando Goncalves,<br>
4-
Jorge Jose de Magalhaes Mendes, Maurıcio G.C. Resende in 2004,
3+
This project implements the hybrid genetic algorithm for the job scheduling problem described<br>
4+
by Jose Fernando Goncalves, Jorge Jose de Magalhaes Mendes, Maurıcio G.C. Resende in 2004,
55
<a href="https://www.sciencedirect.com/science/article/abs/pii/S0377221704002656?via%3Dihub">link to paper</a>.
66
<p>
77
<h5> Requirements </h5>
88
<ul>
9-
<li>cmake 3.10 or higher</li>
9+
<li>cmake</li>
1010
<li>make</li>
11-
<li>C++ compiler supporting C++14 standard</li>
11+
<li>C++ compiler supporting C++11 standard</li>
1212
<li>JSON for Modern C++ 3.2 or newer</li>
1313
</ul>
1414
</p>

0 commit comments

Comments
 (0)