-
Notifications
You must be signed in to change notification settings - Fork 16
/
IndependenceDetectionConflict.cs
42 lines (38 loc) · 1.24 KB
/
IndependenceDetectionConflict.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
namespace mapf;
/// <summary>
/// This class represents a conflict between two groups of agents in Trevor Standley's
/// Indepedence Detection algorithm.
/// </summary>
class IndependenceDetectionConflict
{
public IndependenceDetectionAgentsGroup group1;
public IndependenceDetectionAgentsGroup group2;
public int time;
public override string ToString()
{
return $"conflict in time {time} between {group1} and {group2}";
}
public IndependenceDetectionConflict(IndependenceDetectionAgentsGroup group1, IndependenceDetectionAgentsGroup group2, int time)
{
this.group1 = group1;
this.group2 = group2;
this.time = time;
}
public override bool Equals(object obj)
{
if (obj == null)
return false;
IndependenceDetectionConflict other = (IndependenceDetectionConflict)obj;
if (this.group1.Equals(other.group1) && this.group2.Equals(other.group2))
return true; // Ignoring time, not ignoring order of groups.
return false;
}
public override int GetHashCode()
{
unchecked
{
return this.group1.GetHashCode() + 3 * this.group2.GetHashCode();
}
}
}