-
Notifications
You must be signed in to change notification settings - Fork 0
/
TabuSearch.h
32 lines (25 loc) · 952 Bytes
/
TabuSearch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
#include "VehicleRouteProblem.h"
#include <string>
#include <vector>
#include <list>
#include <conio.h>
class TabuSearch
{
std::list<std::pair<int, int> > tabu_list;
double countCost(std::vector<int> path);
double TabuSearch::countCostWithRandom(std::vector<int> path);
VehicleRouteProblem& vrp;
public:
TabuSearch(VehicleRouteProblem& vrp);
~TabuSearch();
std::vector<std::vector<int>> pathStruc;
double TabuSearch::countCostOneRandom(std::vector<int> path);
double TabuSearch::countBestCost(std::vector<int> path);
std::pair<int, int> swapTwoRandomCities(std::vector<int>& path);
std::vector <int> generateRandomSolution();
void startAlgorithm(int tabu_list_size = 10, int neighbours_count = 400, int steps_without_change = 100, int steps_with_random_neighbourhood = 20);
bool checkTabu(std::pair<int, int>&, std::vector<int>& path, double neighbour_cost);
std::vector< int > the_best_solution;
double min_cost;
};