-
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
11 changed files
with
476 additions
and
58 deletions.
There are no files selected for viewing
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,6 @@ | ||
map_file=../instance/map/makespan-soc-pareto.map | ||
agents=2 | ||
seed=0 | ||
random_problem=0 | ||
3,1,4,1 | ||
1,3,5,1 |
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,29 @@ | ||
type octile | ||
height 25 | ||
width 31 | ||
map | ||
.....TTTTTTTTTTTTTTTTTTTTTT@@@@ | ||
.....T......T.TTTTTTTTTTTTT@@@@ | ||
.....T....TTT.TTTTTT....TTTT@@@ | ||
.....T.................TTTTTTT@ | ||
.....TTT...............TTTTTTT@ | ||
.....TTT................TTTTTT@ | ||
.....TTT.................T..TT@ | ||
....TTTT............TTT.....TTT | ||
....TT..............TTT.....TTT | ||
....TT..............TTT.....TTT | ||
....TT.......TTTTTTT.......TTT@ | ||
.............TTTTTTT......TTTT@ | ||
.............TTTTTTTTT....TTTT@ | ||
....TT.......TTTTTTT.......TTT@ | ||
....TT.......TTTTTT........TTT@ | ||
....TTTT........TTT.TTT...TTTTT | ||
.....TTT............TTT...TTTTT | ||
.....TTT............TTT...TTTTT | ||
.....TTT.................TTTTT@ | ||
.....TTT.......T.........TTTTT@ | ||
.....TTT......TT........TTTTTT@ | ||
.....T........TT........TTTTT@@ | ||
.....T.........TT.....TTTTT@@@@ | ||
.....TTT..TTTTTTTTTTTTTTTTT@@@@ | ||
@@@@@@@T..TT@@@@@@@@@@@@TT@@@@@ |
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,7 @@ | ||
height 4 | ||
width 6 | ||
map | ||
TTTT.T | ||
...... | ||
.TT.T. | ||
..T... |
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,57 @@ | ||
/* | ||
* Implementation of Conflict-based Search (CBS) | ||
* | ||
* - ref | ||
* Sharon, G., Stern, R., Felner, A., & Sturtevant, N. R. (2015). | ||
* Conflict-based search for optimal multi-agent pathfinding. | ||
* Artificial Intelligence, 219, 40–66. | ||
*/ | ||
|
||
#pragma once | ||
#include "solver.hpp" | ||
|
||
class CBS : public Solver { | ||
public: | ||
static const std::string SOLVER_NAME; | ||
|
||
enum struct OBJECTIVE | ||
{ SOC, MAKESPAN, MAKESPAN_SOC, NUM_ITEMS }; | ||
|
||
struct Constraint { | ||
int id; // agent id | ||
int t; | ||
Node* v; // at t | ||
Node* u; // used only for swap conflict, at t-1 | ||
}; | ||
using Constraints = std::vector<Constraint*>; | ||
|
||
struct HighLevelNode { | ||
Paths paths; | ||
Constraints constraints; | ||
int makespan; | ||
int soc; | ||
int f; // for tie-break | ||
bool valid; | ||
}; | ||
using CompareHighLevelNodes = std::function<bool(HighLevelNode*, | ||
HighLevelNode*)>; | ||
|
||
private: | ||
OBJECTIVE objective_type; | ||
|
||
HighLevelNode* createInitialHighLevelNode(); | ||
Constraints getFirstConflict(const HighLevelNode* n); | ||
void invoke(HighLevelNode* h_node, int id); | ||
int countConflict(const Paths& paths); | ||
Path getConstrainedPath(HighLevelNode* h_node, int id); | ||
CompareHighLevelNodes returnObjectiveFunc(); | ||
|
||
public: | ||
CBS(Problem* _P); | ||
~CBS() {}; | ||
|
||
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.