Skip to content
Snippets Groups Projects
Commit 69a9deb6 authored by Romain BERNARD's avatar Romain BERNARD
Browse files

remove const identifier in BestRequestInsertion to use those values in insertion algorithm

parent 3b34090d
No related branches found
No related tags found
1 merge request!2Route manipulation API with automatic constraint propagation
......@@ -13,8 +13,8 @@
class BestRequestInsertion {
private:
const SAEVKeyPoint* _originInsertionKP;
const SAEVKeyPoint* _destinationInsertionKP;
SAEVKeyPoint* _originInsertionKP;
SAEVKeyPoint* _destinationInsertionKP;
double _score{ std::numeric_limits<double>::max() };
public:
......@@ -28,11 +28,11 @@ public:
* @param destinationInsertionKP Index of insertion for the destination of the request in the route
* @param score
*/
BestRequestInsertion(const SAEVKeyPoint *originInsertionKP, const SAEVKeyPoint *destinationInsertionKP, double score)
BestRequestInsertion(SAEVKeyPoint *originInsertionKP, SAEVKeyPoint *destinationInsertionKP, double score)
: _originInsertionKP(originInsertionKP), _destinationInsertionKP(destinationInsertionKP),
_score(score) {};
[[nodiscard]] const SAEVKeyPoint *getOriginInsertionKp() const {
[[nodiscard]] SAEVKeyPoint *getOriginInsertionKp() {
return _originInsertionKP;
}
......@@ -40,7 +40,7 @@ public:
_originInsertionKP = originInsertionKp;
}
[[nodiscard]] const SAEVKeyPoint *getDestinationInsertionKp() const {
[[nodiscard]] SAEVKeyPoint *getDestinationInsertionKp() {
return _destinationInsertionKP;
}
......
......@@ -369,20 +369,20 @@ BestInsertionQueue SAEVRoute::getBestInsertionsQueue(size_t requestId, size_t ve
//Init variables used during iteration
double score;
SAEVKeyPoint const* originKeyPoint = &getOriginDepot(vehicleId);
SAEVKeyPoint const* destinationKeyPoint = originKeyPoint;
SAEVKeyPoint * originInsertionKeyPoint = &getOriginDepot(vehicleId);
SAEVKeyPoint * destinationInsertionKeyPoint = originInsertionKeyPoint;
//iterate over possible origin/destination pairs for the given vehicle
while(originKeyPoint->getSuccessor() != nullptr) {
while(destinationKeyPoint->getSuccessor() != nullptr) {
score = getDetourScore(requestId, *originKeyPoint, *destinationKeyPoint);
bestInsertionQueue.emplace(originKeyPoint, destinationKeyPoint, score);
destinationKeyPoint = destinationKeyPoint->getSuccessor();
while(originInsertionKeyPoint->getSuccessor() != nullptr) {
while(destinationInsertionKeyPoint->getSuccessor() != nullptr) {
score = getDetourScore(requestId, *originInsertionKeyPoint, *destinationInsertionKeyPoint);
bestInsertionQueue.emplace(originInsertionKeyPoint, destinationInsertionKeyPoint, score);
destinationInsertionKeyPoint = destinationInsertionKeyPoint->getSuccessor();
}
//Iterate over possible origins and reset destination to being the same point as the origin
originKeyPoint = originKeyPoint->getSuccessor();
destinationKeyPoint = originKeyPoint;
originInsertionKeyPoint = originInsertionKeyPoint->getSuccessor();
destinationInsertionKeyPoint = originInsertionKeyPoint;
}
return bestInsertionQueue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment