Skip to content

Commit 1efbdfb

Browse files
Merge pull request #21 from guidantas21/testes
feat: bool free_space
2 parents c9a885e + 310ec99 commit 1efbdfb

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

include/ASP.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ASP {
4949
// Perturbations
5050

5151
void random_inter_block_swap(Solution &solution);
52-
void best_improvement_free_space(Solution &solution);
52+
bool best_improvement_free_space(Solution &solution);
5353

5454

5555
ASP(Instance &instance);

src/GILS.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Solution ASP::GILS_RVND(const size_t max_iterations, const size_t max_ils_iterat
121121
// if (perturbation_iteration < max_pertubation_iters / 2 ) random_inter_block_swap(solution);
122122
// else best_improvement_free_space(solution);
123123

124-
best_improvement_free_space(solution);
124+
if (false == best_improvement_free_space(solution)) break;
125125
}
126126
RVND(solution);
127127

src/perturbation.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void ASP::random_inter_block_swap(Solution &solution) {
116116
assert(solution.test_feasibility(m_instance));
117117
}
118118

119-
void ASP::best_improvement_free_space(Solution &solution) {
119+
bool ASP::best_improvement_free_space(Solution &solution) {
120120
size_t best_flight_i = 0;
121121
size_t best_runway_i = 0;
122122
size_t best_runway_j = 0;
@@ -199,6 +199,8 @@ void ASP::best_improvement_free_space(Solution &solution) {
199199
if (penalty > original_penalty) solution.objective += penalty - original_penalty;
200200
else solution.objective -= original_penalty - penalty;
201201
assert(solution.test_feasibility(m_instance));
202+
203+
return true;
202204
} else if (best_free_space) {
203205
size_t best_flight_j = solution.runways[best_runway_j].sequence.size();
204206
uint32_t original_penalty_i = solution.runways[best_runway_i].penalty;
@@ -282,6 +284,8 @@ void ASP::best_improvement_free_space(Solution &solution) {
282284
if (solution.runways[best_runway_j].penalty > original_penalty_j) solution.objective += solution.runways[best_runway_j].penalty - original_penalty_j;
283285
else solution.objective -= original_penalty_j - solution.runways[best_runway_j].penalty;
284286
assert(solution.test_feasibility(m_instance));
287+
288+
return true;
285289
}
286-
290+
return false;
287291
}

0 commit comments

Comments
 (0)