Пример #1
0
        public virtual void Setup(int[] agentNums, CostTreeNode costsNode, ISet <TimedMove> reserved)
        {
            this.startingPos = new AgentState[agentNums.Length];
            int index = 0;

            foreach (var agentNum in agentNums)
            {
                while (problem.agents[index].agent.agentNum != agentNum)
                {
                    ++index;
                }
                this.startingPos[index] = this.problem.agents[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, reserved: reserved);
            }
            this.expanded     = 0;
            this.generated    = 0;
            this.matchCounter = 0;
        }
Пример #2
0
 public CostTreeNodeSolverRepeatedMatching(ProblemInstance problem, CostTreeNode costNode,
                                           Run runner, CostTreeSearchSolver solver, int syncSize,
                                           ISet <TimedMove> reserved)
     : base(problem, costNode, runner, solver, reserved)
 {
     this.syncSize = syncSize;
 }
Пример #3
0
 public CostTreeNodeSolverKSimpleMatching(ProblemInstance problem, CostTreeNode costNode,
                                          Run runner, CostTreeSearchSolver solver, int maxGroupChecked,
                                          ISet <TimedMove> reserved)
     : base(problem, costNode, runner, solver, reserved)
 {
     this.maxGroupChecked = maxGroupChecked;
 }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="problem"></param>
        /// <param name="runner"></param>
        /// <param name="solver"></param>
        /// <param name="agentNums"></param>
        /// <param name="costsNode">Of all the agents, not just the ones selected</param>
        /// <param name="reserved"></param>
        public CostTreeNodeSolver(ProblemInstance problem, Run runner, CostTreeSearchSolver solver,
                                  int[] agentNums, CostTreeNode costsNode, ISet <TimedMove> reserved)
        {
            this.runner  = runner;
            this.problem = problem;
            this.solver  = solver;
            this.allMDDs = new MDD[agentNums.Length];

            this.Setup(agentNums, costsNode, reserved);
        }
Пример #5
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            CostTreeNode check = (CostTreeNode)obj;

            return(this.costs.SequenceEqual(check.costs));
        }
Пример #6
0
 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);
         }
     }
 }
Пример #7
0
        public virtual void Setup(CostTreeNode costsNode, ISet <TimedMove> reserved)
        {
            this.startingPos = problem.agents;
            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, reserved: reserved);
            }
            this.expanded     = 0;
            this.generated    = 0;
            this.matchCounter = 0;
        }
Пример #8
0
 /// <summary>
 /// Automatically calls Setup with the given costsNode
 /// </summary>
 /// <param name="problem"></param>
 /// <param name="costNode">TODO: Maybe just pass the array of costs here?</param>
 /// <param name="runner"></param>
 /// <param name="solver"></param>
 public CostTreeNodeSolver(ProblemInstance problem, CostTreeNode costNode, Run runner,
                           CostTreeSearchSolver solver, ISet <TimedMove> reserved) // Make sure agent numbers are in the correct order
     : this(problem, runner, solver)
 {
     this.Setup(costNode, reserved);
 }
Пример #9
0
 public void setup(CostTreeNode costNode, int syncSize, ISet <TimedMove> reserved)
 {
     base.Setup(costNode, reserved);
     this.syncSize = syncSize;
 }
Пример #10
0
 public void Setup(CostTreeNode costNode, int maxGroupChecked, ISet <TimedMove> reserved)
 {
     base.Setup(costNode, reserved);
     this.maxGroupChecked = maxGroupChecked;
 }
Пример #11
0
 public override void Setup(CostTreeNode costNode, ISet <TimedMove> reserved)
 {
     base.Setup(costNode, reserved);
 }
Пример #12
0
 public CostTreeNodeSolverDDBF(ProblemInstance problem, CostTreeNode costNode, Run runner, CostTreeSearchSolver solver,
                               ISet <TimedMove> reserved)
     : base(problem, costNode, runner, solver, reserved)
 {
 }