コード例 #1
0
        public void AddSubSetHeuristics()
        {
            MAM_HeuristicCalculator hCalculator = hCalculatorList[0][0];

            hCalculatorList = new List <List <MAM_HeuristicCalculator> >();

            foreach (MAM_AgentState agent in this.instance.m_vAgents)
            {
                agent.numOfAgentsInBestHeuristic = hCalculator.GetNumberOfAgents();

                this.hCalculatorList.Add(new List <MAM_HeuristicCalculator>());
                this.hCalculatorList[agent.agentIndex].Add(hCalculator);

                if (costFunction == CostFunction.SOC || hCalculator is ZeroHCalculator)
                {
                    continue;
                }
                foreach (MAM_AgentState agent2 in this.instance.m_vAgents)      // set all pairs of agents (for makespan heurisic)
                {
                    if (agent == agent2)
                    {
                        continue;
                    }
                    MAM_HeuristicCalculator newHeuristicCalculator = hCalculator.copyHeuristicCalculator();
                    MAM_AgentState[]        agentStartStates       = new MAM_AgentState[2];
                    agentStartStates[0] = agent;
                    agentStartStates[1] = agent2;
                    ProblemInstance subProblem = instance.CreateSubProblem(agentStartStates);
                    newHeuristicCalculator.init(subProblem);
                    this.hCalculatorList[agent.agentIndex].Add(newHeuristicCalculator);
                }
            }
        }