Beispiel #1
0
 /// <summary>
 /// Creates a new task.
 /// </summary>
 /// <param name="instance">The instance this task belongs to.</param>
 /// <param name="bot">The bot that shall execute the task.</param>
 /// <param name="order">DummyOrder which will be transformed to task</param>
 public MultiPointGatherTask(Instance instance, Bot bot, DummyOrder order)
     : base(instance, bot)
 {
     Locations = new List <Waypoint>();
     foreach (int idx in order.Locations)
     {
         Locations.Add(instance.Waypoints[idx]);
     }
     _order = order;
 }
Beispiel #2
0
        /// <summary>
        /// Enqueues an MultiPointGather task.
        /// </summary>
        /// <param name="movableStation">The bot that shall execute the task.</param>
        /// <param name="order">The station at which the task will be executed.</param>
        protected void EnqueueMultiPointGather(MovableStation station, DummyOrder order)
        {
            MultiPointGatherTask task = new MultiPointGatherTask(Instance, station, order);

            task.Prepare();
            if (_taskQueues[station] != null)
            {
                _taskQueues[station].Cancel();
            }
            _taskQueues[station]       = task;
            _lastTaskEnqueued[station] = task;
        }
Beispiel #3
0
 /// <summary>
 /// Reads an order list from a csv file.
 /// </summary>
 /// <param name="orderFile">Path to CSV file .</param>
 /// <param name="instance">The instance to submit to.</param>
 /// <returns>The order list.</returns>
 public static void ReadOrdersFromFile(string orderFile, Instance instance)
 {
     // Read the list
     instance.CreateOrderList(ItemType.LocationsList);
     using (StreamReader sr = new StreamReader(orderFile))
     {
         while (!sr.EndOfStream)
         {
             //read string line as a list of int
             List <int> locations = sr.ReadLine().Split(',').Select(Int32.Parse).ToList();
             DummyOrder order     = new DummyOrder(locations);
             instance.OrderList.Orders.Add(order);
         }
     }
 }
Beispiel #4
0
        /// <summary>
        /// Gets the next task for the specified bot.
        /// </summary>
        /// <param name="bot">The bot to get a task for.</param>
        protected override void GetNextTask(Bot bot)
        {
            MovableStation station = null;

            if (bot is MovableStation)
            {
                station = bot as MovableStation;
                DummyOrder order = station.AssignedOrders.FirstOrDefault() as DummyOrder;
                if (order != null)
                {
                    EnqueueMultiPointGather(station, order);
                }
            }
            else
            {
                return;
            }
        }