-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,128 additions
and
86 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Implementation of Enhanced Conflict-based Search (ECBS) | ||
* | ||
* - ref | ||
* Barer, M., Sharon, G., Stern, R., & Felner, A. (2014). | ||
* Suboptimal Variants of the Conflict-Based Search Algorithm for the Multi-Agent Pathfinding Problem. | ||
* In Seventh Annual Symposium on Combinatorial Search. | ||
*/ | ||
|
||
#pragma once | ||
#include "cbs.hpp" | ||
#include <tuple> | ||
|
||
|
||
class ECBS : public CBS { | ||
public: | ||
static const std::string SOLVER_NAME; | ||
|
||
private: | ||
struct HighLevelNodeECBS { | ||
Paths paths; | ||
Constraints constraints; | ||
int makespan; | ||
int soc; | ||
int f; | ||
int LB; // lower bound | ||
std::vector<int> f_mins; | ||
bool valid; | ||
}; | ||
|
||
struct FocalNode { | ||
Node* v; | ||
int g; // in getTimedPath, g represents t | ||
int f1; | ||
int f2; | ||
FocalNode* p; // parent | ||
}; | ||
using CompareFocalNode = std::function<bool(FocalNode*, FocalNode*)>; | ||
using CheckFocalFin = std::function<bool(FocalNode*)>; | ||
using CheckInvalidFocalNode = std::function<bool(FocalNode*)>; | ||
using FocalHeuristics = std::function<int(FocalNode*)>; | ||
|
||
float sub_optimality; | ||
static const float DEFAULT_SUB_OPTIMALITY; | ||
|
||
void invoke(HighLevelNodeECBS* h_node, int id); | ||
void setInitialHighLevelNode(HighLevelNodeECBS* n); | ||
|
||
std::tuple<Path, int> getFocalPath(HighLevelNodeECBS* h_node, int id); | ||
std::tuple<Path, int> getTimedPathByFocalSearch | ||
(Node* const s, Node* const g, float w, // sub-optimality | ||
FocalHeuristics& f1Value, | ||
FocalHeuristics& f2Value, | ||
CompareFocalNode& compareOPEN, | ||
CompareFocalNode& compareFOCAL, | ||
CheckFocalFin& checkFocalFin, | ||
CheckInvalidFocalNode& checkInvalidFocalNode); | ||
|
||
Path getPathFromFocalNode(FocalNode* _n); | ||
|
||
|
||
public: | ||
ECBS(Problem* _P); | ||
~ECBS() {}; | ||
|
||
void solve(); | ||
|
||
void setParams(int argc, char *argv[]); | ||
static void printHelp(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.