src/aco.cpp
/**
 * This applies local search (if enabled) to selected ants' solutions.
 */
This applies local search (if enabled) to selected ants' solutions.
This applies local search ( if enabled ) to selected ants ' solutions .
void ACO::apply_local_search() {
    if (current_iteration_ == 200) {
        pheromone_->set_all_trails(max_pheromone_);
    }
    if (use_local_search_ && current_iteration_ >= 200) {
        const auto crude_threshold = global_best_cost_no_ls_ * 1.02;
        const auto track_size = global_best_values_no_ls_.size();
        const auto in_track_index = track_size - min(track_size, 5ul);
        const auto track_threshold = global_best_values_no_ls_[in_track_index];
        for (auto &ant : ants_) {
            if (ant->cost() <= track_threshold) {
                local_search(instance_, ant->solution_, global_best_->cost());
            }
        }
    }
}
void ACO :: apply_local_search ( ) { if ( current_iteration_ == 200 ) { pheromone_ -> set_all_trails ( max_pheromone_ ) ; } if ( use_local_search_ && current_iteration_ >= 200 ) { const auto crude_threshold = global_best_cost_no_ls_ * 1.02 ; const auto track_size = global_best_values_no_ls_ . size ( ) ; const auto in_track_index = track_size - min ( track_size , 5ul ) ; const auto track_threshold = global_best_values_no_ls_ [ in_track_index ] ; for ( auto & ant : ants_ ) { if ( ant -> cost ( ) <= track_threshold ) { local_search ( instance_ , ant -> solution_ , global_best_ -> cost ( ) ) ; } } } }
This applies local search (if enabled) to selected ants' solutions.
This applies local search ( if enabled ) to selected ants ' solutions .
// Calc. local search application threshold //const auto threshold = max(crude_threshold, //static_cast<double>(track_threshold));