public virtual void Setup(int[] agentNums, CostTreeNode costsNode) { this.startingPos = new AgentState[agentNums.Length]; int index = 0; foreach (var agentNum in agentNums) { while (problem.m_vAgents[index].agent.agentNum != agentNum) { ++index; } this.startingPos[index] = this.problem.m_vAgents[index]; } this.totalCost = costsNode.costs.Sum(); this.maxCost = costsNode.costs.Max(); for (int i = 0; i < this.allMDDs.Length; i++) { this.allMDDs[i] = new MDD(agentNums[i], startingPos[i].agent.agentNum, startingPos[i].lastMove, costsNode.costs[i], maxCost, startingPos.Length, problem); } this.generated = 0; // TODO: Not clearing the expanded count? CostTreeNodeSolver.matchCounter = 0; }
public override bool Equals(object obj) { CostTreeNode check = (CostTreeNode)obj; for (int i = 0; i < costs.Length; i++) { if (costs[i] != check.costs[i]) { return(false); } } return(true); }
public void Expand(Queue <CostTreeNode> openList, HashSet <CostTreeNode> closedList) { for (int j = 0; j < costs.Length; j++) { int[] newCosts = this.costs.ToArray <int>(); newCosts[j]++; var child = new CostTreeNode(newCosts); if (!closedList.Contains(child)) { closedList.Add(child); openList.Enqueue(child); } } }
public virtual void Setup(CostTreeNode costsNode) { this.startingPos = problem.m_vAgents; this.totalCost = costsNode.costs.Sum(); this.maxCost = costsNode.costs.Max(); for (int i = 0; i < this.allMDDs.Length; i++) { this.allMDDs[i] = new MDD(i, startingPos[i].agent.agentNum, startingPos[i].lastMove, costsNode.costs[i], maxCost, startingPos.Length, problem); } this.generated = 0; // TODO: Not clearing the expanded count? CostTreeNodeSolver.matchCounter = 0; }
public virtual void setup(CostTreeNode costNode) { AgentState agent; maxCost = 0; this.startingPos = problem.m_vAgents; this.costs = costNode.costs; maxCost = costNode.costs.Max(); for (int i = 0; i < startingPos.Length; i++) { agent = startingPos[i]; allMDDs[i] = new MDD(i, agent.agent.agentNum, agent.lastMove, costNode.costs[i], maxCost, startingPos.Length, problem); } generated = 0; matchCounter = 0; }
public void expandNode(LinkedList <CostTreeNode> openList, HashSet <CostTreeNode> closedList) { CostTreeNode temp; for (int j = 0; j < costs.Length; j++) { int[] newCosts = new int[costs.Length]; for (int i = 0; i < costs.Length; i++) { newCosts[i] = costs[i]; } newCosts[j]++; temp = new CostTreeNode(newCosts); if (!closedList.Contains(temp)) { closedList.Add(temp); openList.AddLast(temp); } } }
public CostTreeNodeSolver(ProblemInstance problem, CostTreeNode costNode, Run runner) //make sure agent numbers are in the correct order { this.runner = runner; AgentState agent; maxCost = 0; allMDDs = new MDD[problem.GetNumOfAgents()]; this.startingPos = problem.m_vAgents; this.costs = costNode.costs; this.problem = problem; maxCost = costNode.costs.Max(); for (int i = 0; i < startingPos.Length; i++) { agent = startingPos[i]; allMDDs[i] = new MDD(i, agent.agent.agentNum, agent.lastMove, costNode.costs[i], maxCost, startingPos.Length, problem); } matchCounter = 0; }
public void setup(CostTreeNode costNode, int syncSize) { base.setup(costNode); this.syncSize = syncSize; }
public CostTreeNodeSolverRepatedMatching(ProblemInstance problem, CostTreeNode costNode, Run runner, int syncSize) : base(problem, costNode, runner) { this.syncSize = syncSize; }
public void setup(CostTreeNode costNode, int maxGroupChecked) { base.setup(costNode); this.maxGroupChecked = maxGroupChecked; }
public CostTreeNodeSolverKSimpaleMatching(ProblemInstance problem, CostTreeNode costNode, Run runner, int maxGroupChecked) : base(problem, costNode, runner) { this.maxGroupChecked = maxGroupChecked; }
public override void setup(CostTreeNode costNode) { base.setup(costNode); }
public CostTreeNodeSolverDDBF(ProblemInstance problem, CostTreeNode costNode, Run runner) : base(problem, costNode, runner) { }
/// <summary> /// Automatically calls Setup with the given costsNode /// </summary> /// <param name="problem"></param> /// <param name="costsNode">TODO: Maybe just pass the array of costs here?</param> /// <param name="runner"></param> public CostTreeNodeSolver(ProblemInstance problem, CostTreeNode costNode, Run runner) // Make sure agent numbers are in the correct order : this(problem, runner) { this.Setup(costNode); }
/// <summary> /// /// </summary> /// <param name="problem"></param> /// <param name="runner"></param> /// <param name="agentNums"></param> /// <param name="costsNode">Of all the agents, not just the ones selected</param> public CostTreeNodeSolver(ProblemInstance problem, Run runner, int[] agentNums, CostTreeNode costsNode) { this.runner = runner; this.problem = problem; this.allMDDs = new MDD[agentNums.Length]; this.Setup(agentNums, costsNode); }
public override bool Equals(object obj) { CostTreeNode check = (CostTreeNode)obj; return(this.costs.SequenceEqual <int>(check.costs)); }