예제 #1
0
 public CFMCbsNode(int numberOfAgents, CFM_CBS cbs, ushort[] agentsGroupAssignment = null)
 {
     this.cbs            = cbs;
     mamPlan             = null;
     mamCost             = -1;
     allSingleAgentCosts = new int[numberOfAgents];
     countsOfInternalAgentsThatConflict = new int[numberOfAgents];
     this.nodeConflicts = null;
     if (agentsGroupAssignment == null)
     {
         this.agentsGroupAssignment = new ushort[numberOfAgents];
         for (ushort i = 0; i < numberOfAgents; i++)
         {
             this.agentsGroupAssignment[i] = i;
         }
     }
     else
     {
         this.agentsGroupAssignment = agentsGroupAssignment.ToArray <ushort>();
     }
     agentNumToIndex = new Dictionary <int, int>();
     for (int i = 0; i < numberOfAgents; i++)
     {
         agentNumToIndex[this.cbs.GetProblemInstance().m_vAgents[i].agentIndex] = i;
     }
     depth                  = 0;
     replanSize             = 1;
     agentAExpansion        = ExpansionState.NOT_EXPANDED;
     agentBExpansion        = ExpansionState.NOT_EXPANDED;
     this.prev              = null;
     this.constraint        = null;
     this.solver            = solver;
     this.singleAgentSolver = singleAgentSolver;
 }
예제 #2
0
파일: CbsNode.cs 프로젝트: kylevedder/mapf
 /// <summary>
 /// Child from branch action constructor
 /// </summary>
 /// <param name="father"></param>
 /// <param name="newConstraint"></param>
 /// <param name="agentToReplan"></param>
 public CbsNode(CbsNode father, CbsConstraint newConstraint, int agentToReplan)
 {
     this.allSingleAgentPlans   = father.allSingleAgentPlans.ToArray <SinglePlan>();
     this.allSingleAgentCosts   = father.allSingleAgentCosts.ToArray <int>();
     this.agentsGroupAssignment = father.agentsGroupAssignment.ToArray <ushort>();
     this.prev              = father;
     this.constraint        = newConstraint;
     this.depth             = (ushort)(this.prev.depth + 1);
     agentAExpansion        = ExpansionState.NOT_EXPANDED;
     agentBExpansion        = ExpansionState.NOT_EXPANDED;
     replanSize             = 1;
     this.problem           = father.problem;
     this.solver            = father.solver;
     this.singleAgentSolver = father.singleAgentSolver;
     this.runner            = father.runner;
 }
예제 #3
0
            private ExpansionState GetExpansionState(string packageUniqueId, bool createNewIfNotFound = false)
            {
                if (string.IsNullOrEmpty(packageUniqueId))
                {
                    return(null);
                }
                var state = m_ExpansionStates.FirstOrDefault(s => s.packageUniqueId == packageUniqueId);

                if (state == null && createNewIfNotFound)
                {
                    state = new ExpansionState {
                        packageUniqueId = packageUniqueId, expanded = false, seeAllVersion = false
                    };
                    m_ExpansionStates.Add(state);
                }
                return(state);
            }
예제 #4
0
파일: CbsNode.cs 프로젝트: kylevedder/mapf
 public CbsNode(int numberOfAgents, ProblemInstance problem, ICbsSolver solver, ICbsSolver singleAgentSolver, Run runner)
 {
     allSingleAgentPlans = new SinglePlan[numberOfAgents];
     allSingleAgentCosts = new int[numberOfAgents];
     depth                 = 0;
     replanSize            = 1;
     agentAExpansion       = ExpansionState.NOT_EXPANDED;
     agentBExpansion       = ExpansionState.NOT_EXPANDED;
     agentsGroupAssignment = new ushort[numberOfAgents];
     for (ushort i = 0; i < numberOfAgents; i++)
     {
         agentsGroupAssignment[i] = i;
     }
     this.prev              = null;
     this.constraint        = null;
     this.problem           = problem;
     this.solver            = solver;
     this.singleAgentSolver = singleAgentSolver;
     this.runner            = runner;
 }
예제 #5
0
        /// <summary>
        /// Child from merge action constructor. FIXME: Code dup with previous constructor.
        /// </summary>
        /// <param name="father"></param>
        /// <param name="mergeGroupA"></param>
        /// <param name="mergeGroupB"></param>
        public CFMCbsNode(CFMCbsNode father, int mergeGroupA, int mergeGroupB)
        {
            mamPlan = null;
            mamCost = -1;
            this.allSingleAgentCosts = father.allSingleAgentCosts.ToArray <int>();
            this.countsOfInternalAgentsThatConflict = father.countsOfInternalAgentsThatConflict.ToArray <int>();
            this.nodeConflicts = null;

            this.agentsGroupAssignment = father.agentsGroupAssignment.ToArray <ushort>();
            this.agentNumToIndex       = father.agentNumToIndex;
            this.prev              = father;
            this.constraint        = null;
            this.depth             = (ushort)(this.prev.depth + 1);
            this.agentAExpansion   = ExpansionState.NOT_EXPANDED;
            this.agentBExpansion   = ExpansionState.NOT_EXPANDED;
            this.replanSize        = 1;
            this.solver            = father.solver;
            this.singleAgentSolver = father.singleAgentSolver;
            this.cbs = father.cbs;
        }