Skip to content

Commit

Permalink
Change back to determenistic selection from file
Browse files Browse the repository at this point in the history
  • Loading branch information
OmriKaduri committed Jan 7, 2020
1 parent e67bfcd commit bba40c1
Show file tree
Hide file tree
Showing 240 changed files with 6,910 additions and 2,402 deletions.
Binary file modified .vs/mapf/v15/.suo
Binary file not shown.
Binary file modified .vs/mapf/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file modified .vs/mapf/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file modified .vs/mapf/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
85 changes: 50 additions & 35 deletions IndependenceDetection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -529,19 +529,53 @@ class IndependenceDetectionAgentsGroup
private Plan plan;

ClassificationXGBoostModel selectionModel;

private SumIndividualCosts simple;
private EPEA_Star epea;
private A_Star astar;
private CBS macbs;
private CostTreeSearchSolverOldMatching icts;
private CBS cbs;
private MvcHeuristicForCbs mvc_for_cbs;
private CBS cbsh;

public IndependenceDetectionAgentsGroup(ProblemInstance instance, AgentState[] allAgentsState, ISolver singleAgentSolver, ISolver groupSolver)
{
this.allAgentsState = allAgentsState;
this.instance = instance.Subproblem(allAgentsState);
this.singleAgentSolver = singleAgentSolver;
this.groupSolver = groupSolver;

var model_path = Path.Combine(Environment.CurrentDirectory, "testing-clf.xgb");

//selectionModel = new ClassificationXGBoostLearner();
this.selectionModel = ClassificationXGBoostModel.Load(model_path);

this.simple = new SumIndividualCosts();
this.epea = new EPEA_Star(this.simple);
this.astar = new A_Star(this.simple);
this.macbs = new CBS(this.astar, this.epea, 10);
this.icts = new CostTreeSearchSolverOldMatching(3);
this.cbs = new CBS(this.astar, this.epea);
this.mvc_for_cbs = new MvcHeuristicForCbs();

//for (int i = 0; i < astar_heuristics.Count; i++)
// astar_heuristics[i].Init(instance, agentList);

this.cbsh = new CBS(astar, epea,
mergeThreshold: -1,
CBS.BypassStrategy.FIRST_FIT_LOOKAHEAD,
doMalte: false,
CBS.ConflictChoice.CARDINAL_MDD,
this.mvc_for_cbs,
disableTieBreakingByMinOpsEstimate: true,
lookaheadMaxExpansions: 1,
mergeCausesRestart: true,
replanSameCostWithMdd: false,
cacheMdds: false,
useOldCost: false,
useCAT: true);


}

/// <summary>
Expand Down Expand Up @@ -594,29 +628,11 @@ public string solverNameByIndex(double solverIndex)
}
}

public ISolver solverByIndex(double solverIndex)
public ISolver solverByIndex(double solverIndex, ProblemInstance instance)
{
var simple = new SumIndividualCosts();
var epea = new EPEA_Star(simple);
var astar = new A_Star(simple);
var macbs = new CBS(astar, epea, 10);
var icts = new CostTreeSearchSolverOldMatching(3);
var cbs = new CBS(astar, epea);
var mvc_for_cbs = new MvcHeuristicForCbs();
List<uint> agentList = Enumerable.Range(0, instance.agents.Length).Select(x => (uint)x).ToList(); // FIXME: Must the heuristics really receive a list of uints?

var cbsh = new CBS(astar, epea,
mergeThreshold: -1,
CBS.BypassStrategy.FIRST_FIT_LOOKAHEAD,
doMalte: false,
CBS.ConflictChoice.CARDINAL_MDD,
mvc_for_cbs,
disableTieBreakingByMinOpsEstimate: true,
lookaheadMaxExpansions: 1,
mergeCausesRestart: true,
replanSameCostWithMdd: false,
cacheMdds: false,
useOldCost: false,
useCAT: true);
simple.Init(instance, agentList);

switch (solverIndex)
{
Expand All @@ -635,6 +651,8 @@ public ISolver solverByIndex(double solverIndex)
default:
return null;
}


}

/// <summary>
Expand All @@ -647,17 +665,14 @@ public bool SolveWithSelection(Run runner)
ISolver relevantSolver = this.groupSolver;
if (this.allAgentsState.Length == 1)
relevantSolver = this.singleAgentSolver; // TODO: Consider using CBS's root trick to really get single agent paths fast. Though it won't respect illegal moves and such.
var watch = System.Diagnostics.Stopwatch.StartNew();
// the code that you want to measure comes here
var pred = this.selectionModel.Predict(instance.ml_features.ToArray());
watch.Stop();
var elapsedMs = watch.ElapsedMilliseconds;
Console.WriteLine("Selection time: {0}", elapsedMs);

Console.WriteLine(solverNameByIndex(pred));
relevantSolver = solverByIndex(pred);
relevantSolver.Setup(this.instance, runner);
//this.sele
else
{
var pred = this.selectionModel.Predict(instance.ml_features.ToArray());

Console.WriteLine($"-----------------AS in ID-{solverNameByIndex(pred)}-----------------");
relevantSolver = solverByIndex(pred, this.instance);
relevantSolver.Setup(this.instance, runner); //TODO: Move setup to ctor
}
bool solved = relevantSolver.Solve();
this.solutionCost = relevantSolver.GetSolutionCost();
if (solved == false)
Expand Down Expand Up @@ -752,7 +767,7 @@ public bool ReplanUnderConstraints(Plan plan, Run runner, Boolean withSelection)
{
success = this.Solve(runner);
}
this.instance.parameters.Remove(IndependenceDetection.ILLEGAL_MOVES_KEY);
this.instance.parameters.Remove(IndependenceDetection.ILLEGAL_MOVES_KEY);
this.instance.parameters.Remove(IndependenceDetection.MAXIMUM_COST_KEY);
if (success == false)
{
Expand Down
9 changes: 8 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Diagnostics;
using System.IO;
using System.Text;

namespace mapf
{
Expand Down Expand Up @@ -467,11 +468,17 @@ public void RunNathanExperimentSet(String scenMapFileName)
{
try
{

ProblemInstance.Import(Directory.GetCurrentDirectory() + "\\" + scenMapFileName);
}
catch (Exception e)
{
StringBuilder sb = new StringBuilder();
sb.Append("ERROR! occured at: "+ DateTime.Now.ToString());
sb.Append(e);
// flush every 20 seconds as you do it
File.AppendAllText("log.txt", sb.ToString());
sb.Clear();

Console.WriteLine(String.Format("Skipping bad problem instance {0}. Error: {1}", scenMapFileName, e.Message));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Run.cs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ public Run()
var mvc_for_cbs = new MvcHeuristicForCbs();

// MA - CBS - Global - 10 / (EPEA */ SIC) choosing the first conflict in CBS nodes
solvers.Add(new CBS(astar, epea, 10));
//solvers.Add(new CBS(astar, epea, 10));

// ICTS + ID+AS
solvers.Add(new IndependenceDetection(astar, new CostTreeSearchSolverOldMatching(3),true));
Expand Down
1 change: 1 addition & 0 deletions bin/Debug/30bf6e6f-ef76-444a-a9a5-e7eb5f3eb024.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GridName,GridRows,GridColumns,NumOfAgents,NumOfObstacles,InstanceId,BranchingFactor,ObstacleDensity,AvgDistanceToGoal,MaxDistanceToGoal,MinDistanceToGoal,AvgStartDistances,AvgGoalDistances,PointsAtSPRatio,Sparsity,MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Success,MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Runtime,MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Solution Cost,MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Expanded (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Generated (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Closed List Hits (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Partial Expansions (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Adoptions (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Nodes Expanded With Goal Cost (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Bypass Look Ahead Nodes Created (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Cardinal Look Ahead Nodes Created (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Conflicts Bypassed With Adoption (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Cardinal Conflict Splits (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Semi-Cardinal Conflict Splits (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Non-Cardinal Conflict Splits (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking MDDs Built (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking MDDs Adapted (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Restarts (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Path-Max Boosts (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Reverse Path-Max Boosts (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Path-Max Plus Boosts (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Max Group Size (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Surplus Nodes Avoided (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking MDD Cache Hits (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Time Planning Paths (HL),MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Time Building MDDs (HL),EPEA*/SIC Expanded,EPEA*/SIC Generated,EPEA*/SIC Reopened,EPEA*/SIC BPMX boosts,EPEA*/SIC Closed List Hits,EPEA*/SIC Reopened With Old H,EPEA*/SIC H Updated From Other Area,EPEA*/SIC Max expansion delay,EPEA*/SIC Surplus nodes avoided,EPEA*/SIC Quick Insertions,EPEA*/SIC Quick Insertions Cancelled,EPEA*/SIC Expanded Full States,A*/SIC Expanded,A*/SIC Generated,A*/SIC Reopened,A*/SIC BPMX boosts,A*/SIC Closed List Hits,A*/SIC Reopened With Old H,A*/SIC H Updated From Other Area,A*/SIC Max expansion delay,A*/SIC Surplus nodes avoided,A*/SIC Quick Insertions,A*/SIC Quick Insertions Cancelled,MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Quick Insertions,MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Quick Insertions Cancelled,MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Max Group,MA-CBS-Local-10/(single:A*/SIC multi:EPEA*/SIC) choosing the first conflict in CBS nodes without smart tie breaking Solution Depth,ICTS 3E +ID+AS Success,ICTS 3E +ID+AS Runtime,ICTS 3E +ID+AS Solution Cost,ICTS 3E +ID+AS Expanded,ICTS 3E +ID+AS Generated,ICTS 3E +ID+AS Max Group Size,ICTS 3E +ID+AS Min Group Size,ICTS 3E +ID+AS Max Group,ICTS 3E +ID+AS Solution Depth,EPEA*+ID+AS Success,EPEA*+ID+AS Runtime,EPEA*+ID+AS Solution Cost,EPEA*+ID+AS Expanded,EPEA*+ID+AS Generated,EPEA*+ID+AS Max Group Size,EPEA*+ID+AS Min Group Size,EPEA*+ID+AS Max Group,EPEA*+ID+AS Solution Depth,ICTS 3E +ID Success,ICTS 3E +ID Runtime,ICTS 3E +ID Solution Cost,ICTS 3E +ID Expanded,ICTS 3E +ID Generated,ICTS 3E +ID Max Group Size,ICTS 3E +ID Min Group Size,ICTS 3E +ID Max Group,ICTS 3E +ID Solution Depth,EPEA*+ID Success,EPEA*+ID Runtime,EPEA*+ID Solution Cost,EPEA*+ID Expanded,EPEA*+ID Generated,EPEA*+ID Max Group Size,EPEA*+ID Min Group Size,EPEA*+ID Max Group,EPEA*+ID Solution Depth,CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Success,CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Runtime,CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Solution Cost,CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Expanded (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Generated (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Closed List Hits (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Partial Expansions (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Adoptions (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Nodes Expanded With Goal Cost (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Bypass Look Ahead Nodes Created (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Cardinal Look Ahead Nodes Created (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Conflicts Bypassed With Adoption (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Cardinal Conflict Splits (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Semi-Cardinal Conflict Splits (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Non-Cardinal Conflict Splits (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic MDDs Built (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic MDDs Adapted (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Restarts (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Path-Max Boosts (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Reverse Path-Max Boosts (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Path-Max Plus Boosts (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Max Group Size (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Surplus Nodes Avoided (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic MDD Cache Hits (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Time Planning Paths (HL),CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Time Building MDDs (HL),A*+OD/SIC Expanded,A*+OD/SIC Generated,A*+OD/SIC Reopened,A*+OD/SIC BPMX boosts,A*+OD/SIC Closed List Hits,A*+OD/SIC Reopened With Old H,A*+OD/SIC H Updated From Other Area,A*+OD/SIC Max expansion delay,A*+OD/SIC Surplus nodes avoided,A*+OD/SIC Quick Insertions,A*+OD/SIC Quick Insertions Cancelled,A*+OD/SIC Expanded Full States,A*+OD/SIC Generated Full States,A*/SIC Expanded,A*/SIC Generated,A*/SIC Reopened,A*/SIC BPMX boosts,A*/SIC Closed List Hits,A*/SIC Reopened With Old H,A*/SIC H Updated From Other Area,A*/SIC Max expansion delay,A*/SIC Surplus nodes avoided,A*/SIC Quick Insertions,A*/SIC Quick Insertions Cancelled,DynamicLazyOpenList/mapf.MvcHeuristicForCbs Nodes Pushed Back,CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Quick Insertions,CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Quick Insertions Cancelled,MVC of Cardinal Conflict Graph Heuristic Times Target Estimate Was Too High,MVC of Cardinal Conflict Graph Heuristic Times Target Estimate Was Reached,MVC of Cardinal Conflict Graph Heuristic Times Target Estimate Was Not Reached,CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Max Group,CBS/(A*/SIC) + BP + PC without smart tie breaking using Dynamic Lazy Open List with Heuristic MVC of Cardinal Conflict Graph Heuristic Solution Depth,
Loading

0 comments on commit bba40c1

Please sign in to comment.