All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CVRPSolver Class Reference

#include "VRP_Solver.h"

Public Member Functions

 CVRPSolver ()
 ~CVRPSolver ()
bool addDepot (CDepotInfo depotInfo)
bool addDepotToOrderCost (int depotId, int orderId, CostPack cost)
bool addOrder (COrderInfo orderInfo)
bool addOrderAtTour (CSolutionInfo &solutionInfo, int tourIndex, int insertIndex, int orderIndex)
bool addOrderToDepotCost (int depotId, int orderId, CostPack cost)
bool addOrderToOrderCost (int firstOrder, int secondOrder, CostPack cost)
bool addVehicle (CVehicleInfo vehicleInfo)
void applyBestMoveInCurrentSolution (CSolutionInfo &solutionInfo, CMoveInfo &bestMove)
void attemptVehicleExchange (CSolutionInfo &solutionInfo)
CSolutionInfo generateInitialSolution ()
CostPack getCostForInsert (CTourInfo &curTour, COrderInfo &curOrder, int pos)
CostPack getDepotToOrderCost (int depotId, int orderId)
CostPack getOrderToDepotCost (int depotId, int orderId)
CostPack getOrderToOrderCost (int firstOrder, int secondOrder)
std::pair< int, double > getPotentialInsert (CTourInfo &curTour, COrderInfo &curOrder)
int getServiceTime (int order_id)
bool getSolution (CSolutionInfo &solution, std::string &strError)
bool init ()
bool insertOrder (CTourInfo &tourInfo, int orderId, int pos)
void insertUnservedOrders (CSolutionInfo &solutionInfo)
bool isTabuMove (CMoveInfo &curMove)
void removeOrder (int orderIndex)
void removeVehicle (int vehicleIndex)
bool solveVRP (std::string &strError)
bool tabuSearch (CSolutionInfo &solutionInfo)
bool updateFinalSolution (CSolutionInfo &solutionInfo)
void updateTabuCount (CMoveInfo &bestMove)
bool updateTourCosts (CTourInfo &tourInfo)

Private Attributes

bool m_bFoundOptimal
bool m_bIsReadyToSolve
bool m_bIsSolutionReady
int m_iGeneratedSolutionCount
int m_iStepsSinceLastSolution
std::map< int, int > m_mapDepotIdToIndex
std::map< std::pair< int, int >
, CostPack
std::map< int, int > m_mapOrderIdToIndex
std::map< std::pair< int, int >
, CostPack
std::map< std::pair< int, int >
, CostPack
std::map< int, int > m_mapVehicleIdToIndex
CSolutionInfo m_solutionFinal
std::vector< CDepotInfom_vDepotInfos
std::vector< CMoveInfom_veMoves
std::vector< int > m_viUnservedOrderIndex
std::vector< int > m_viUnusedVehicleIndex
std::vector< COrderInfom_vOrderInfos
std::vector< CVehicleInfom_vVehicleInfos

Detailed Description

Definition at line 333 of file VRP_Solver.h.

Constructor & Destructor Documentation

CVRPSolver::CVRPSolver ( )

Definition at line 215 of file VRP_Solver.cpp.

CVRPSolver::~CVRPSolver ( )

Definition at line 221 of file VRP_Solver.cpp.

Member Function Documentation

bool CVRPSolver::addDepot ( CDepotInfo  depotInfo)

Definition at line 490 of file VRP_Solver.cpp.

References CDepotInfo::getDepotId(), m_mapDepotIdToIndex, and m_vDepotInfos.

Referenced by loadOrders().

bool CVRPSolver::addDepotToOrderCost ( int  depotId,
int  orderId,
CostPack  cost 

Definition at line 524 of file VRP_Solver.cpp.

References m_mapDepotToOrderrCost.

Referenced by loadDistanceMatrix().

bool CVRPSolver::addOrder ( COrderInfo  orderInfo)
bool CVRPSolver::addOrderAtTour ( CSolutionInfo solutionInfo,
int  tourIndex,
int  insertIndex,
int  orderIndex 

Definition at line 673 of file VRP_Solver.cpp.

References CSolutionInfo::getTour(), insertOrder(), and m_vOrderInfos.

Referenced by insertUnservedOrders().

bool CVRPSolver::addOrderToDepotCost ( int  depotId,
int  orderId,
CostPack  cost 

Definition at line 533 of file VRP_Solver.cpp.

References m_mapOrderToDepotCost.

Referenced by loadDistanceMatrix().

bool CVRPSolver::addOrderToOrderCost ( int  firstOrder,
int  secondOrder,
CostPack  cost 

Definition at line 542 of file VRP_Solver.cpp.

References m_mapOrderToOrderCost.

Referenced by loadDistanceMatrix().

bool CVRPSolver::addVehicle ( CVehicleInfo  vehicleInfo)
void CVRPSolver::applyBestMoveInCurrentSolution ( CSolutionInfo solutionInfo,
CMoveInfo bestMove 
CostPack CVRPSolver::getDepotToOrderCost ( int  depotId,
int  orderId 
CostPack CVRPSolver::getOrderToDepotCost ( int  depotId,
int  orderId 
CostPack CVRPSolver::getOrderToOrderCost ( int  firstOrder,
int  secondOrder 
int CVRPSolver::getServiceTime ( int  order_id)

Definition at line 366 of file VRP_Solver.h.

References getServiceTime(), m_mapOrderIdToIndex, and m_vOrderInfos.

Referenced by find_vrp_solution(), and getServiceTime().

bool CVRPSolver::getSolution ( CSolutionInfo solution,
std::string &  strError 

Definition at line 551 of file VRP_Solver.cpp.

References m_bIsSolutionReady, m_solutionFinal, and solveVRP().

Referenced by find_vrp_solution(), and print_solution().

bool CVRPSolver::init ( )
bool CVRPSolver::isTabuMove ( CMoveInfo curMove)

Definition at line 880 of file VRP_Solver.cpp.

References m_veMoves.

Referenced by attemptVehicleExchange(), and insertUnservedOrders().

void CVRPSolver::removeOrder ( int  orderIndex)

Definition at line 355 of file VRP_Solver.h.

References m_viUnservedOrderIndex.

void CVRPSolver::removeVehicle ( int  vehicleIndex)

Definition at line 352 of file VRP_Solver.h.

References m_viUnusedVehicleIndex.

bool CVRPSolver::solveVRP ( std::string &  strError)

Member Data Documentation

bool CVRPSolver::m_bFoundOptimal

Definition at line 411 of file VRP_Solver.h.

Referenced by tabuSearch().

bool CVRPSolver::m_bIsReadyToSolve

Definition at line 382 of file VRP_Solver.h.

bool CVRPSolver::m_bIsSolutionReady

Definition at line 403 of file VRP_Solver.h.

Referenced by getSolution(), and solveVRP().

int CVRPSolver::m_iGeneratedSolutionCount
int CVRPSolver::m_iStepsSinceLastSolution
std::map<int, int> CVRPSolver::m_mapDepotIdToIndex

Definition at line 389 of file VRP_Solver.h.

Referenced by addDepot(), getCostForInsert(), and updateTourCosts().

std::map<std::pair<int, int>, CostPack> CVRPSolver::m_mapDepotToOrderrCost

Definition at line 392 of file VRP_Solver.h.

Referenced by addDepotToOrderCost(), and getDepotToOrderCost().

std::map<int, int> CVRPSolver::m_mapOrderIdToIndex
std::map<std::pair<int, int>, CostPack> CVRPSolver::m_mapOrderToDepotCost

Definition at line 393 of file VRP_Solver.h.

Referenced by addOrderToDepotCost(), and getOrderToDepotCost().

std::map<std::pair<int, int>, CostPack> CVRPSolver::m_mapOrderToOrderCost

Definition at line 391 of file VRP_Solver.h.

Referenced by addOrderToOrderCost(), and getOrderToOrderCost().

std::map<int, int> CVRPSolver::m_mapVehicleIdToIndex

Definition at line 388 of file VRP_Solver.h.

Referenced by addVehicle(), and generateInitialSolution().

CSolutionInfo CVRPSolver::m_solutionFinal

Definition at line 404 of file VRP_Solver.h.

Referenced by getSolution(), solveVRP(), and updateFinalSolution().

std::vector<CDepotInfo> CVRPSolver::m_vDepotInfos

Definition at line 385 of file VRP_Solver.h.

Referenced by addDepot(), generateInitialSolution(), getCostForInsert(), and updateTourCosts().

std::vector<CMoveInfo> CVRPSolver::m_veMoves

Definition at line 401 of file VRP_Solver.h.

Referenced by isTabuMove(), and updateTabuCount().

std::vector<int> CVRPSolver::m_viUnservedOrderIndex

Definition at line 407 of file VRP_Solver.h.

Referenced by addOrder(), and removeOrder().

std::vector<int> CVRPSolver::m_viUnusedVehicleIndex

Definition at line 408 of file VRP_Solver.h.

Referenced by addVehicle(), and removeVehicle().

std::vector<CVehicleInfo> CVRPSolver::m_vVehicleInfos

The documentation for this class was generated from the following files: