本文整理汇总了C++中DataContainer::getAllDrivers方法的典型用法代码示例。如果您正苦于以下问题:C++ DataContainer::getAllDrivers方法的具体用法?C++ DataContainer::getAllDrivers怎么用?C++ DataContainer::getAllDrivers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataContainer
的用法示例。
在下文中一共展示了DataContainer::getAllDrivers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: constructDataContainer
std::map<const ModelEnum, ModelRunner::SolnMetrics*> * ModelRunner::runModelsForCurrExperiment(double optInRate, double batchWindowLengthInSecDouble, double maxPickupDistance, double minPctSavings, const bool useAggTripSavingsForObjAndConstr) {
std::map<const ModelEnum, ModelRunner::SolnMetrics*> * pModelSolnMetricMap = new std::map<const ModelEnum, ModelRunner::SolnMetrics*>();
int batchWindowLengthInSec = (int)batchWindowLengthInSecDouble;
DataContainer * pDataContainer = constructDataContainer(optInRate, batchWindowLengthInSec);
pOutput->setDataContainer(pDataContainer);
pOutput->writeAndPrintInputs(pDataContainer, pDataOutput->_printDebugFiles);
/*
* MAN IN THE MUNI (MITM) MODEL
*/
if( _runMitmModel ) {
MitmModel * pMitmModel = new MitmModel(pDataContainer->getTimeline(), pDataContainer->getSimEndTime(), maxPickupDistance, minPctSavings, _allRequestsInSim, _initOpenTrips, pDataContainer->getAllDrivers(), _inclInitPickupDistForSavingsConstr, useAggTripSavingsForObjAndConstr);
bool modelSolved = pMitmModel->solve(pDataOutput->_printDebugFiles, pOutput, pDataInput->_populateInitOpenTrips);
if( modelSolved ) {
Solution * pMitmSolution = pMitmModel->getSolution();
pOutput->printSolution(pMitmSolution, MITM_SEQ_PICKUPS);
// populate solution for current param setting (inner map entry)
ModelRunner::SolnMetrics * pSolnMetrics = new SolnMetrics();
pSolnMetrics->numRequests = pMitmSolution->getTotalRequests();
pSolnMetrics->matchRate = pMitmSolution->getRequestMetrics()->_matchedPercentage;
pSolnMetrics->inconvenience = pMitmSolution->getInconvenienceMetrics()->_avgPctAddedDistsForAll;
pSolnMetrics->numTrips = pMitmSolution->getTotalNumTripsFromSoln();
pSolnMetrics->avgSavingsAllMatchedRiders = pMitmSolution->getSavingsMetrics()->_avgMatchedRiderSavingsPct;
pSolnMetrics->avgSavingsMasters = pMitmSolution->getSavingsMetrics()->_avgMasterSavingsPct;
pSolnMetrics->avgSavingsMinions = pMitmSolution->getSavingsMetrics()->_avgMinionSavingsPct;
pSolnMetrics->avgWaitTimeMatch_allRiders = pMitmSolution->getMatchMetrics()->_avgWaitTimeOfMatchesForAllMatchedRiders;
pSolnMetrics->avgWaitTimeMatch_masters = pMitmSolution->getMatchMetrics()->_avgWaitTimeOfMatchesForMasters;
pSolnMetrics->avgWaitTimeMatch_minions = pMitmSolution->getMatchMetrics()->_avgWaitTimeOfMatchesForMinions;
pSolnMetrics->avgSharedDist = pMitmSolution->getOverlapMetrics()->_avgOverlapDist;
pSolnMetrics->avgPctSharedDist_Trip = pMitmSolution->getOverlapMetrics()->_avgTripOverlapPct;
pSolnMetrics->avgPctSharedDist_ALL = pMitmSolution->getOverlapMetrics()->_avgPctOverlapAll;
pSolnMetrics->avgPctSharedDist_Masters = pMitmSolution->getOverlapMetrics()->_avgPctOverlapMasters;
pSolnMetrics->avgPctSharedDist_Minions = pMitmSolution->getOverlapMetrics()->_avgPctOverlapMinions;
IndivSolnMetrics * pIndivSolnMetrics = getIndivSolnMetrics(pMitmSolution);
pSolnMetrics->pIndivMetrics = pIndivSolnMetrics;
pModelSolnMetricMap->insert(make_pair(MITM_SEQ_PICKUPS, pSolnMetrics));
}
}
/*
* UP FRONT BATCHING WINDOW WITH FIXED PICKUPS
*/
if( _runUFBW_fixedPickup ) {
UFBW_fixed * pFixedBatchModel = new UFBW_fixed(pDataContainer->getTimeline(), pDataContainer->getSimEndTime(), batchWindowLengthInSec, maxPickupDistance, minPctSavings, _allRequestsInSim, _initOpenTrips, pDataContainer->getAllDrivers(), _inclInitPickupDistForSavingsConstr);
bool modelSolved = pFixedBatchModel->solve(pDataOutput->_printDebugFiles, pOutput, pDataInput->_populateInitOpenTrips, pDataOutput->_printToScreen);
if( modelSolved ) {
Solution * pFixedBatchSolution = pFixedBatchModel->getSolution();
pOutput->printSolution(pFixedBatchSolution, UFBW_FIXED_PICKUPS);
// update solution maps
SolnMetrics * pSolnMetrics = new SolnMetrics();
pSolnMetrics->numRequests = pFixedBatchSolution->getTotalRequests();
pSolnMetrics->matchRate = pFixedBatchSolution->getRequestMetrics()->_matchedPercentage;
pSolnMetrics->inconvenience = pFixedBatchSolution->getInconvenienceMetrics()->_avgPctAddedDistsForAll;
pSolnMetrics->numTrips = pFixedBatchSolution->getTotalNumTripsFromSoln();
pSolnMetrics->avgSavingsAllMatchedRiders = pFixedBatchSolution->getSavingsMetrics()->_avgMatchedRiderSavingsPct;
pSolnMetrics->avgSavingsMasters = pFixedBatchSolution->getSavingsMetrics()->_avgMasterSavingsPct;
pSolnMetrics->avgSavingsMinions = pFixedBatchSolution->getSavingsMetrics()->_avgMinionSavingsPct;
pSolnMetrics->avgWaitTimeMatch_allRiders = pFixedBatchSolution->getMatchMetrics()->_avgWaitTimeOfMatchesForAllMatchedRiders;
pSolnMetrics->avgWaitTimeMatch_masters = pFixedBatchSolution->getMatchMetrics()->_avgWaitTimeOfMatchesForMasters;
pSolnMetrics->avgWaitTimeMatch_minions = pFixedBatchSolution->getMatchMetrics()->_avgWaitTimeOfMatchesForMinions;
pSolnMetrics->avgSharedDist = pFixedBatchSolution->getOverlapMetrics()->_avgOverlapDist;
pSolnMetrics->avgPctSharedDist_ALL = pFixedBatchSolution->getOverlapMetrics()->_avgPctOverlapAll;
pSolnMetrics->avgPctSharedDist_Trip = pFixedBatchSolution->getOverlapMetrics()->_avgTripOverlapPct;
pSolnMetrics->avgPctSharedDist_Masters = pFixedBatchSolution->getOverlapMetrics()->_avgPctOverlapMasters;
pSolnMetrics->avgPctSharedDist_Minions = pFixedBatchSolution->getOverlapMetrics()->_avgPctOverlapMinions;
IndivSolnMetrics * pIndivSolnMetrics = getIndivSolnMetrics(pFixedBatchSolution);
pSolnMetrics->pIndivMetrics = pIndivSolnMetrics;
pModelSolnMetricMap->insert(make_pair(UFBW_FIXED_PICKUPS, pSolnMetrics));
}
}
/*
* UP FRONT BATCHING WINDOW WITH PERFECT INFORMATION
*/
if( _runUFBW_PI ) {
UFBW_perfectInformation * pUFBW_PI_Model = new UFBW_perfectInformation(pDataContainer->getTimeline(), pDataContainer->getSimEndTime(), batchWindowLengthInSec, maxPickupDistance, minPctSavings, _allRequestsInSim, _initOpenTrips, pDataContainer->getAllDrivers(), _inclInitPickupDistForSavingsConstr);
bool modelSolved = pUFBW_PI_Model->solve(pDataOutput->_printDebugFiles, pOutput, pDataInput->_populateInitOpenTrips, pDataOutput->_printToScreen);
if( modelSolved ) {
Solution * pBatchSolnWithPerfInfo = pUFBW_PI_Model->getSolution();
pOutput->printSolution(pBatchSolnWithPerfInfo, UFBW_PERFECT_INFO);
// update solution maps
SolnMetrics * pSolnMetrics = new SolnMetrics();
pSolnMetrics->numRequests = pBatchSolnWithPerfInfo->getTotalRequests();
pSolnMetrics->matchRate = pBatchSolnWithPerfInfo->getRequestMetrics()->_matchedPercentage;
pSolnMetrics->inconvenience = pBatchSolnWithPerfInfo->getInconvenienceMetrics()->_avgPctAddedDistsForAll;
pSolnMetrics->numTrips = pBatchSolnWithPerfInfo->getTotalNumTripsFromSoln();
pSolnMetrics->avgSavingsAllMatchedRiders = pBatchSolnWithPerfInfo->getSavingsMetrics()->_avgMatchedRiderSavingsPct;
pSolnMetrics->avgSavingsMasters = pBatchSolnWithPerfInfo->getSavingsMetrics()->_avgMasterSavingsPct;
pSolnMetrics->avgSavingsMinions = pBatchSolnWithPerfInfo->getSavingsMetrics()->_avgMinionSavingsPct;
pSolnMetrics->avgWaitTimeMatch_allRiders = pBatchSolnWithPerfInfo->getMatchMetrics()->_avgWaitTimeOfMatchesForAllMatchedRiders;
//.........这里部分代码省略.........