-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroute.hpp
56 lines (44 loc) · 1.77 KB
/
route.hpp
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef route_hpp
#define route_hpp
#include "depot.hpp"
#include "customer.hpp"
#include <vector>
#include <tuple>
#include <map>
class Route
{
Depot* depot;
std::shared_ptr<std::vector<Customer*>> customerList;
float length;
int load;
int serviceDuration;
float euclidDistance(int x1, int y1, int x2, int y2);
std::tuple<bool, int, float> checkConstraints(std::shared_ptr<std::vector<Customer*>>& custList);
std::tuple<bool, int, float> checkConstraints();
float calculateInsertionCost(int index, Customer* cust);
public:
Route(Depot* depot, float length, int load, int serviceDuration, std::shared_ptr<std::vector<Customer*>> customerList);
void removeCustomers(std::vector<Customer*>& deleteList);
void replaceCustomer(Customer* cust, int index);
std::tuple<Customer*, int> getRandomCustomer();
size_t noRouteCustomers();
float routeLength();
int getRouteLoad();
std::vector<Customer*> getCustomerList();
std::vector<std::tuple<bool, int, float, int>> testInsertions(Customer* cust, int* chromoIndex);
void clearCustomerList();
void popCustomer(std::tuple<float,int> costs);
std::tuple<float,int> removeLastGain();
std::tuple<bool, int, float> checkConstraints(int index, Customer* cust);
void insertCustomerAtBeginning(Customer* cust, std::tuple<float,int> costs);
Customer* peekLast();
Customer* popRandomCustomer();
void insertCustomer(Customer* cust, int index);
void insertCustomerBestFeasable(Customer* cust);
std::string getCustomerString();
float calculateTotalLength();
};
using routeVec = std::vector<std::unique_ptr<Route>>;
using routeMap = std::map<int, routeVec>;
using upRouteMap = std::unique_ptr<routeMap>;
#endif /* route_hpp */