private void UpdateConfiguration()
        {
            var isReconfPossible = IsReconfPossible(Agents.OfType <RobotAgent>(), Tasks);

            var lines = File.ReadAllLines(ConfigurationFile);

            if (lines[0].Contains("UNSATISFIABLE"))
            {
                ReconfigurationState = ReconfStates.Failed;
                if (isReconfPossible)
                {
                    throw new Exception("Reconfiguration failed even though there is a solution.");
                }
                return;
            }

            ReconfigurationState = ReconfStates.Succedded;
            if (!isReconfPossible)
            {
                throw new Exception("Reconfiguration successful even though there is no valid configuration.");
            }

            var roleAllocations = Parse(lines[0], lines[1]).ToArray();

            ApplyConfiguration(roleAllocations);
        }
Пример #2
0
 public FastObserverController(IEnumerable <Agent> agents, List <Task> tasks)
     : base(agents, tasks)
 {
     _availableRobots = Agents.OfType <RobotAgent>().ToArray();
 }