PGROUTING  2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VRP_Solver.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 Copyright (c) 2013 Khondoker Md. Razequl Islam
4 ziboncsedu@gmail.com
5 
6 ------
7 
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 
22 ********************************************************************PGR-GNU*/
23 
24 #ifndef SRC_VRP_BASIC_SRC_VRP_SOLVER_H_
25 #define SRC_VRP_BASIC_SRC_VRP_SOLVER_H_
26 
27 #pragma once
28 
29 #include <cstdlib>
30 #include <vector>
31 #include <map>
32 #include <utility>
33 #include <string>
34 #include <math.h>
35 
36 #define MAXIMUM_TRY 15
37 #define TOTAL_NUMBER_OF_SEARCH 15
38 #define MAXIMUM_MOVE_FREQUENCY 15
39 
40 #define INF (1e15)
41 
42 typedef std::pair<int, int> PII;
43 
44 // Structure for Point, Geo coordinates can be represented with it
45 typedef struct {
46  double X, Y;
47 }Point;
48 
49 // Structure to keep cost, distance and traveltime. If distance/ traveltime is missing, there may be a negative flag
50 typedef struct {
51  double cost, distance, traveltime;
52 }CostPack;
53 
54 
55 // Class for holding vehicle information which consist of capacity, and cost_per_km
56 // For first version we will use homogeneous cost
57 class CVehicleInfo {
58  public:
59  CVehicleInfo();
60  ~CVehicleInfo();
61 
62  bool init();
63 
64  bool loadUnit(int lUnit);
65  bool unloadUnit(int lUnit);
67 
69 
70  int getCapacity() {return m_iCapacity;}
71  void setCapacity(int capacity) {m_iCapacity = capacity;}
72 
73  int getId() {return (this->m_iVehicleId);}
74  void setId(int id) {m_iVehicleId = id;}
75 
76  double getCostPerKM() {return m_dCostPerKM;}
77  void setCostPerKM(double cost) {m_dCostPerKM = cost;}
78 
79  friend bool operator != (const CVehicleInfo& cur, const CVehicleInfo& that);
80 
81 
82  // CVehicleInfo( CVehicleInfo const& );
83  // CVehicleInfo& operator = (const CVehicleInfo& vehicleInfo);
84 
85  private:
89  double m_dCostPerKM;
90 };
91 
92 
93 
94 // Class to represent Orders. Each order is consist of open_time, close_time and sevice_time, its location and number of units ordered.
95 class COrderInfo {
96  public:
97  COrderInfo();
98  ~COrderInfo();
99 
101  void setOpenTime(int openTime) {m_iOrderOpenTime = openTime;}
102 
104  void setCloseTime(int closeTime) {m_iOrderCloseTime = closeTime;}
105 
107  void setServiceTime(int serviceTime) {m_iOrderServiceTime = serviceTime;}
108 
110  void setOrderUnit(int orderUnit) {m_iOrderUnitCount = orderUnit;}
111 
113  void setOrderLocation(Point location) {m_ptOrderLocation = location;}
114 
115  int getOrderId() {return m_iOrderId; }
116  void setOrderId(int orderId) {m_iOrderId = orderId;}
117 
118 
119  // COrderInfo( COrderInfo const& );
120  // COrderInfo& operator = (const COrderInfo& solution);
121 
122  private:
128 
130 };
131 
132 
133 // Class to represent Depot information. Each depot will have it's Open_Time and Close_Time. The Depot that will open earliest will have open time 0
134 // and all other time will be normalized with respect to it. For the first version there will be only one depot
135 class CDepotInfo {
136  public:
137  CDepotInfo();
138  ~CDepotInfo();
139 
141  void setOpenTime(int openTime) {m_iDepotOpenTime = openTime;}
142 
144  void setCloseTime(int closeTime) {m_iDepotCloseTime = closeTime;}
145 
146  int getDepotId() {return m_iDepotId;}
147  void setDepotId(int id) {m_iDepotId = id;}
148 
150  void setDepotLocation(Point location) {m_ptDepotLocation = location;}
151 
152  // CDepotInfo( CDepotInfo const& );
153  // CDepotInfo& operator = (const CDepotInfo& solution);
154 
155  private:
158 
160 
162 };
163 
164 // Class to represent information of a Tour. A Tour starts from a depot and ends in a depot. On the way it serves several orders.
165 // Each Tour has a vehicle ID and the list of Orders it serves in appropriate order. It also has the total Distance, Cost and Time assciated.
166 class CTourInfo {
167  public:
168  CTourInfo();
169  ~CTourInfo();
170 
171  void init();
172 
173  int getRemainingCapacity();
174 
175  int getVehicleId() {return m_vehicleInfo.getId();}
176 
178  void setVehicleInfo(CVehicleInfo vehicleInfo) {m_vehicleInfo = vehicleInfo;}
179 
181  void setStartDepot(int depotId) {m_iStartDepotId = depotId;}
182 
183  int getEndDepot() {return m_iEndDepotId;}
184  void setEndDepot(int depotId) {m_iEndDepotId = depotId;}
185 
186  size_t getServedOrderCount() {return m_viOrderIds.size();}
187 
188  void updateCost(double cost, double distance, double travelTime);
189 
190  void setStartTime(std::vector<int> vStartTime) {m_viStartTime = vStartTime;}
191 
192 
193  bool insertOrder(int orderId, int pos);
194  bool removeOrder(int pos);
195 
196 
197  double getDistance() {return m_dTotalDistance;}
198 
199  double getCost() {return m_dTotalCost;}
200 
202 
203  std::vector<int> getOrderVector() {return m_viOrderIds;}
204 
205  int getStartTime(int pos) {
206  if ((unsigned int) pos >= m_viStartTime.size())
207  return 0;
208  else
209  return m_viStartTime[pos];
210  }
211 
212  friend bool operator == (const CTourInfo& cur, const CTourInfo& that);
213 
214 
215  // bool operator != (const CTourInfo& that)
216  // {
217  // return(!(*this == that));
218  // }
219 
220  // CTourInfo( CTourInfo const& );
221  // CTourInfo& operator = (const CTourInfo& solution);
222 
223 
224  private:
229  std::vector<int> m_viOrderIds;
230  std::vector<int> m_viStartTime;
231  double m_dTotalCost;
234 };
235 
236 
237 
238 // This class will represent a solution of a VRP problem. A solution will be consist of multiple tour.
239 // It also contains the number of vehicle used, number of orders served and total cost, distance and traveltime.
241  public:
242  CSolutionInfo();
243  ~CSolutionInfo();
244 
247  // int getVehicleUsed() {return m_iVehicleUsed;}
248 
249  bool addTour(CTourInfo& tour);
250  CTourInfo& getTour(int pos) {return m_vtourAll[pos];}
251 
252  size_t getTourCount() {return (m_vtourAll.size());}
253 
254  size_t getUnservedOrderCount() {return m_vUnservedOrderId.size();}
255  size_t getUnusedVehicleCount() {return m_vUnusedVehicles.size();}
256 
257  int getUnusedVehicleAt(int pos) {return m_vUnusedVehicles[pos];}
258 
259  void removeVehicle(int pos) {m_vUnusedVehicles.erase(m_vUnusedVehicles.begin() + pos);}
260  void removeOrder(int pos) {m_vUnservedOrderId.erase(m_vUnservedOrderId.begin() + pos);}
261 
262  double getTotalCost() {return m_dTotalCost;}
265  int getUnservedOrderAt(int pos) {return m_vUnservedOrderId[pos];}
266  // void addOrderAtTour(int tourIndex, int insertIndex, int orderIndex);
267 
268  void replaceTourAt(int index, CTourInfo curTour);
269  void replaceTour(CTourInfo curTour);
270 
271  bool init(std::vector<int> vecOrder, int iTotalOrder, std::vector<int> vecVehicle);
272 
273  std::vector<CTourInfo> getTourInfoVector() {return m_vtourAll;}
274 
275  // CTourInfo( CTourInfo const& );
276  // CTourInfo& operator = (const CTourInfo& solution);
277 
278  private:
279  std::vector<CTourInfo> m_vtourAll;
280  std::vector<int> m_vUnservedOrderId;
281  std::vector<int> m_vUnusedVehicles;
285  double m_dTotalCost;
288 };
289 
290 class CMoveInfo {
291  public:
292  CMoveInfo();
293  ~CMoveInfo();
294 
295  bool isBetter(CMoveInfo *pVRPMove);
296 
297  void reverseMove();
298  void setInitialTour(CTourInfo pTourData);
299  void setInitialTour(CTourInfo pTourData1, CTourInfo pTourData2);
300  void setModifiedTour(CTourInfo pTourData);
301  void setModifiedTour(CTourInfo pTourData1, CTourInfo pTourData2);
302 
303  bool getModifiedTourAt(int index, CTourInfo& tourInfo);
304  size_t getModifiedTourCount() const { return m_vModifiedTour.size();}
305  double getModifiedTourCost() const;
306  void getInitialTour(CTourInfo &TourData);
307  void getInitialTour(CTourInfo &TourData1, CTourInfo &TourData2);
308 
309  friend bool operator == (const CMoveInfo& cur, const CMoveInfo& that);
310 
311 
312  // bool operator != (const CMoveInfo& that)
313  // {
314  // return(!(*this == that));
315  // }
316 
317  // CMoveInfo( CMoveInfo const& );
318  // CMoveInfo& operator = (const CMoveInfo& solution);
319 
320  private:
321  void clearInitialTour();
322  void clearModifiedTour();
323 
324  std::vector<CTourInfo> m_vInitialTour;
325  std::vector<CTourInfo> m_vModifiedTour;
326 };
327 
328 
329 
330 
331 // This is the main class that will solve the VRP problem. It will use the previous classes to represent the problem and the solution.
332 // It will also have pre generated point to point distance/ cost/ traveltime information in maps.
333 class CVRPSolver {
334  public:
335  CVRPSolver();
336  ~CVRPSolver();
337 
338  bool init();
339 
340  bool addDepot(CDepotInfo depotInfo);
341  bool addOrder(COrderInfo orderInfo);
342  bool addVehicle(CVehicleInfo vehicleInfo);
343 
344  CostPack getOrderToOrderCost(int firstOrder, int secondOrder);
345  CostPack getDepotToOrderCost(int depotId, int orderId);
346  CostPack getOrderToDepotCost(int depotId, int orderId);
347 
348  bool addOrderToOrderCost(int firstOrder, int secondOrder, CostPack cost);
349  bool addDepotToOrderCost(int depotId, int orderId, CostPack cost);
350  bool addOrderToDepotCost(int depotId, int orderId, CostPack cost);
351 
352  void removeVehicle(int vehicleIndex)
353  {m_viUnusedVehicleIndex.erase(m_viUnusedVehicleIndex.begin() + vehicleIndex, m_viUnusedVehicleIndex.begin() + vehicleIndex+1);}
354 
355  void removeOrder(int orderIndex)
356  {m_viUnservedOrderIndex.erase(m_viUnservedOrderIndex.begin() + orderIndex, m_viUnservedOrderIndex.begin() + orderIndex + 1);}
357 
358  bool solveVRP(std::string& strError);
359 
360  bool getSolution(CSolutionInfo& solution, std::string& strError);
362  bool updateFinalSolution(CSolutionInfo& solutionInfo);
363  std::pair<int, double> getPotentialInsert(CTourInfo& curTour, COrderInfo& curOrder);
364  CostPack getCostForInsert(CTourInfo& curTour, COrderInfo& curOrder, int pos);
365  bool tabuSearch(CSolutionInfo& solutionInfo);
366  int getServiceTime(int order_id) {return (m_vOrderInfos[m_mapOrderIdToIndex[order_id]].getServiceTime());}
367 
368  bool insertOrder(CTourInfo& tourInfo, int orderId, int pos);
369  void applyBestMoveInCurrentSolution(CSolutionInfo& solutionInfo, CMoveInfo& bestMove);
370  void insertUnservedOrders(CSolutionInfo& solutionInfo);
371  // void attemptFeasibleNodeExchange(CSolutionInfo& solutionInfo);
372  void attemptVehicleExchange(CSolutionInfo& solutionInfo);
373  // CMoveInfo identifyPotentialMove();
374  void updateTabuCount(CMoveInfo& bestMove);
375 
376  bool isTabuMove(CMoveInfo& curMove);
377  bool updateTourCosts(CTourInfo& tourInfo);
378  bool addOrderAtTour(CSolutionInfo& solutionInfo, int tourIndex, int insertIndex, int orderIndex);
379 
380 
381  private:
383  std::vector<CVehicleInfo> m_vVehicleInfos;
384  std::vector<COrderInfo> m_vOrderInfos;
385  std::vector<CDepotInfo> m_vDepotInfos;
386 
387  std::map<int, int> m_mapOrderIdToIndex;
388  std::map<int, int> m_mapVehicleIdToIndex;
389  std::map<int, int> m_mapDepotIdToIndex;
390 
391  std::map<std::pair<int, int>, CostPack> m_mapOrderToOrderCost;
392  std::map<std::pair<int, int>, CostPack> m_mapDepotToOrderrCost;
393  std::map<std::pair<int, int>, CostPack> m_mapOrderToDepotCost;
394 
395  /*
396  std::map<CMoveInfo, int> m_mapMoveFrequency;
397  std::map<CMoveInfo, std::pair<int, int> > m_mapTabuCount;
398  std::set<CMoveInfo> m_sTabuList;
399  */
400 
401  std::vector<CMoveInfo> m_veMoves;
402 
405 
406  private:
407  std::vector<int> m_viUnservedOrderIndex;
408  std::vector<int> m_viUnusedVehicleIndex;
412 };
413 
414 #endif // SRC_VRP_BASIC_SRC_VRP_SOLVER_H_
std::pair< int, double > getPotentialInsert(CTourInfo &curTour, COrderInfo &curOrder)
Definition: VRP_Solver.cpp:357
std::vector< int > m_vUnusedVehicles
Definition: VRP_Solver.h:281
bool isBetter(CMoveInfo *pVRPMove)
int getId()
Definition: VRP_Solver.h:73
int getStartTime(int pos)
Definition: VRP_Solver.h:205
bool insertOrder(CTourInfo &tourInfo, int orderId, int pos)
Definition: VRP_Solver.cpp:599
std::vector< CTourInfo > getTourInfoVector()
Definition: VRP_Solver.h:273
int m_iGeneratedSolutionCount
Definition: VRP_Solver.h:409
int m_iOrdersServed
Definition: VRP_Solver.h:283
std::vector< int > m_viStartTime
Definition: VRP_Solver.h:230
K::Point_2 Point
void setOpenTime(int openTime)
Definition: VRP_Solver.h:141
int m_iVehicleId
Definition: VRP_Solver.h:88
CTourInfo & getTour(int pos)
Definition: VRP_Solver.h:250
int m_iVehicleUsed
Definition: VRP_Solver.h:282
size_t getUnservedOrderCount()
Definition: VRP_Solver.h:254
CostPack getOrderToDepotCost(int depotId, int orderId)
Definition: VRP_Solver.cpp:588
std::vector< CTourInfo > m_vInitialTour
Definition: VRP_Solver.h:324
bool getSolution(CSolutionInfo &solution, std::string &strError)
Definition: VRP_Solver.cpp:551
void setServiceTime(int serviceTime)
Definition: VRP_Solver.h:107
std::pair< int, int > PII
Definition: VRP_Solver.h:42
double m_dTotalDistance
Definition: VRP_Solver.h:232
int m_iTotalOrders
Definition: VRP_Solver.h:284
int getOrderId()
Definition: VRP_Solver.h:115
int m_iOrderId
Definition: VRP_Solver.h:127
void setCloseTime(int closeTime)
Definition: VRP_Solver.h:104
int m_iDepotCloseTime
Definition: VRP_Solver.h:157
friend bool operator!=(const CVehicleInfo &cur, const CVehicleInfo &that)
Definition: VRP_Solver.cpp:41
int m_iDepotId
Definition: VRP_Solver.h:159
std::vector< int > m_viOrderIds
Definition: VRP_Solver.h:229
int getOpenTime()
Definition: VRP_Solver.h:140
CVehicleInfo & getVehicleInfo()
Definition: VRP_Solver.h:177
Point getDepotLocation()
Definition: VRP_Solver.h:149
bool m_bIsReadyToSolve
Definition: VRP_Solver.h:382
double m_dTotalDistance
Definition: VRP_Solver.h:286
void applyBestMoveInCurrentSolution(CSolutionInfo &solutionInfo, CMoveInfo &bestMove)
Definition: VRP_Solver.cpp:418
double m_dTotalCost
Definition: VRP_Solver.h:285
std::vector< int > m_vUnservedOrderId
Definition: VRP_Solver.h:280
void setOrderUnit(int orderUnit)
Definition: VRP_Solver.h:110
int getRemainingCapacity()
Definition: VRP_Solver.h:66
double getModifiedTourCost() const
void updateTabuCount(CMoveInfo &bestMove)
Definition: VRP_Solver.cpp:846
bool loadUnit(int lUnit)
Definition: VRP_Solver.cpp:69
int m_iOrdersServed
Definition: VRP_Solver.h:228
bool insertOrder(int orderId, int pos)
Definition: VRP_Solver.cpp:89
void setDepotId(int id)
Definition: VRP_Solver.h:147
bool tabuSearch(CSolutionInfo &solutionInfo)
Definition: VRP_Solver.cpp:400
void setOpenTime(int openTime)
Definition: VRP_Solver.h:101
int m_iCurrentLoad
Definition: VRP_Solver.h:87
int m_iOrderUnitCount
Definition: VRP_Solver.h:126
double m_dCostPerKM
Definition: VRP_Solver.h:89
void getInitialTour(CTourInfo &TourData)
Definition: VRP_Solver.cpp:197
std::vector< CTourInfo > m_vtourAll
Definition: VRP_Solver.h:279
void updateCost(double cost, double distance, double travelTime)
Definition: VRP_Solver.cpp:103
int getOrderServed()
Definition: VRP_Solver.h:246
std::map< std::pair< int, int >, CostPack > m_mapDepotToOrderrCost
Definition: VRP_Solver.h:392
bool solveVRP(std::string &strError)
Definition: VRP_Solver.cpp:223
bool m_bFoundOptimal
Definition: VRP_Solver.h:411
int getDepotId()
Definition: VRP_Solver.h:146
bool addOrder(COrderInfo orderInfo)
Definition: VRP_Solver.cpp:500
double getCost()
Definition: VRP_Solver.h:199
double getTotalDistance()
Definition: VRP_Solver.h:263
void setModifiedTour(CTourInfo pTourData)
Definition: VRP_Solver.cpp:186
void clearInitialTour()
CVehicleInfo m_vehicleInfo
Definition: VRP_Solver.h:225
double getTravelTime()
Definition: VRP_Solver.h:201
int m_iDepotOpenTime
Definition: VRP_Solver.h:156
void removeVehicle(int vehicleIndex)
Definition: VRP_Solver.h:352
int getUnusedVehicleAt(int pos)
Definition: VRP_Solver.h:257
int getEndDepot()
Definition: VRP_Solver.h:183
void setCloseTime(int closeTime)
Definition: VRP_Solver.h:144
friend bool operator==(const CMoveInfo &cur, const CMoveInfo &that)
Definition: VRP_Solver.cpp:53
int getCurrentLoad()
Definition: VRP_Solver.h:68
int m_iEndDepotId
Definition: VRP_Solver.h:227
Point getOrderLocation()
Definition: VRP_Solver.h:112
void setStartTime(std::vector< int > vStartTime)
Definition: VRP_Solver.h:190
void setInitialTour(CTourInfo pTourData)
Definition: VRP_Solver.cpp:175
size_t getServedOrderCount()
Definition: VRP_Solver.h:186
std::map< int, int > m_mapDepotIdToIndex
Definition: VRP_Solver.h:389
bool addVehicle(CVehicleInfo vehicleInfo)
Definition: VRP_Solver.cpp:512
double getTotalTravelTime()
Definition: VRP_Solver.h:264
Point m_ptDepotLocation
Definition: VRP_Solver.h:161
double Y
Definition: VRP_Solver.h:46
int getCapacity()
Definition: VRP_Solver.h:70
void replaceTourAt(int index, CTourInfo curTour)
Definition: VRP_Solver.cpp:123
void clearModifiedTour()
CSolutionInfo m_solutionFinal
Definition: VRP_Solver.h:404
std::map< std::pair< int, int >, CostPack > m_mapOrderToDepotCost
Definition: VRP_Solver.h:393
double m_dTotalTravelTime
Definition: VRP_Solver.h:287
void setDepotLocation(Point location)
Definition: VRP_Solver.h:150
std::map< int, int > m_mapVehicleIdToIndex
Definition: VRP_Solver.h:388
bool addDepot(CDepotInfo depotInfo)
Definition: VRP_Solver.cpp:490
std::vector< CMoveInfo > m_veMoves
Definition: VRP_Solver.h:401
std::vector< int > getOrderVector()
Definition: VRP_Solver.h:203
bool init()
double getTotalCost()
Definition: VRP_Solver.h:262
bool addOrderToOrderCost(int firstOrder, int secondOrder, CostPack cost)
Definition: VRP_Solver.cpp:542
bool unloadUnit(int lUnit)
int m_iOrderOpenTime
Definition: VRP_Solver.h:123
friend bool operator==(const CTourInfo &cur, const CTourInfo &that)
Definition: VRP_Solver.cpp:45
std::vector< CVehicleInfo > m_vVehicleInfos
Definition: VRP_Solver.h:383
double m_dTotalTraveltime
Definition: VRP_Solver.h:233
bool addOrderToDepotCost(int depotId, int orderId, CostPack cost)
Definition: VRP_Solver.cpp:533
int getRemainingCapacity()
Definition: VRP_Solver.cpp:94
void removeOrder(int orderIndex)
Definition: VRP_Solver.h:355
void setOrderId(int orderId)
Definition: VRP_Solver.h:116
void insertUnservedOrders(CSolutionInfo &solutionInfo)
Definition: VRP_Solver.cpp:435
bool updateFinalSolution(CSolutionInfo &solutionInfo)
Definition: VRP_Solver.cpp:324
int m_iStartDepotId
Definition: VRP_Solver.h:226
int getServiceTime()
Definition: VRP_Solver.h:106
void setId(int id)
Definition: VRP_Solver.h:74
bool m_bIsSolutionReady
Definition: VRP_Solver.h:403
size_t getModifiedTourCount() const
Definition: VRP_Solver.h:304
int m_iCapacity
Definition: VRP_Solver.h:86
void reverseMove()
void setCapacity(int capacity)
Definition: VRP_Solver.h:71
std::map< std::pair< int, int >, CostPack > m_mapOrderToOrderCost
Definition: VRP_Solver.h:391
std::vector< int > m_viUnservedOrderIndex
Definition: VRP_Solver.h:407
CostPack getDepotToOrderCost(int depotId, int orderId)
Definition: VRP_Solver.cpp:565
int m_iOrderCloseTime
Definition: VRP_Solver.h:124
bool removeOrder(int pos)
Definition: VRP_Solver.cpp:98
size_t getTourCount()
Definition: VRP_Solver.h:252
void removeOrder(int pos)
Definition: VRP_Solver.h:260
void setStartDepot(int depotId)
Definition: VRP_Solver.h:181
bool getModifiedTourAt(int index, CTourInfo &tourInfo)
Definition: VRP_Solver.cpp:206
void setVehicleInfo(CVehicleInfo vehicleInfo)
Definition: VRP_Solver.h:178
double traveltime
Definition: VRP_Solver.h:51
void setEndDepot(int depotId)
Definition: VRP_Solver.h:184
int getServiceTime(int order_id)
Definition: VRP_Solver.h:366
size_t getUnusedVehicleCount()
Definition: VRP_Solver.h:255
void setOrderLocation(Point location)
Definition: VRP_Solver.h:113
bool updateTourCosts(CTourInfo &tourInfo)
Definition: VRP_Solver.cpp:616
void init()
bool addDepotToOrderCost(int depotId, int orderId, CostPack cost)
Definition: VRP_Solver.cpp:524
void attemptVehicleExchange(CSolutionInfo &solutionInfo)
Definition: VRP_Solver.cpp:734
std::vector< int > m_viUnusedVehicleIndex
Definition: VRP_Solver.h:408
int getStartDepot()
Definition: VRP_Solver.h:180
bool init(std::vector< int > vecOrder, int iTotalOrder, std::vector< int > vecVehicle)
Definition: VRP_Solver.cpp:129
double getCostPerKM()
Definition: VRP_Solver.h:76
int getCloseTime()
Definition: VRP_Solver.h:103
int m_iOrderServiceTime
Definition: VRP_Solver.h:125
bool addTour(CTourInfo &tour)
Definition: VRP_Solver.cpp:144
void setCostPerKM(double cost)
Definition: VRP_Solver.h:77
void replaceTour(CTourInfo curTour)
Definition: VRP_Solver.cpp:112
void removeVehicle(int pos)
Definition: VRP_Solver.h:259
CostPack getCostForInsert(CTourInfo &curTour, COrderInfo &curOrder, int pos)
Definition: VRP_Solver.cpp:677
double getDistance()
Definition: VRP_Solver.h:197
int getVehicleId()
Definition: VRP_Solver.h:175
int getOrderUnit()
Definition: VRP_Solver.h:109
Point m_ptOrderLocation
Definition: VRP_Solver.h:129
double m_dTotalCost
Definition: VRP_Solver.h:231
int getUnservedOrderAt(int pos)
Definition: VRP_Solver.h:265
std::vector< COrderInfo > m_vOrderInfos
Definition: VRP_Solver.h:384
int m_iStepsSinceLastSolution
Definition: VRP_Solver.h:410
std::vector< CTourInfo > m_vModifiedTour
Definition: VRP_Solver.h:325
std::map< int, int > m_mapOrderIdToIndex
Definition: VRP_Solver.h:387
std::vector< CDepotInfo > m_vDepotInfos
Definition: VRP_Solver.h:385
bool addOrderAtTour(CSolutionInfo &solutionInfo, int tourIndex, int insertIndex, int orderIndex)
Definition: VRP_Solver.cpp:673
CostPack getOrderToOrderCost(int firstOrder, int secondOrder)
Definition: VRP_Solver.cpp:576
int getOpenTime()
Definition: VRP_Solver.h:100
bool isTabuMove(CMoveInfo &curMove)
Definition: VRP_Solver.cpp:880
CSolutionInfo generateInitialSolution()
Definition: VRP_Solver.cpp:262
int getCloseTime()
Definition: VRP_Solver.h:143
int getVehicleUsed()
Definition: VRP_Solver.h:245