public Vehicle(int id, int capacity, Location startingPoint)
        {
            Id = id;
            Capacity = capacity;

            Locations = new List<Location> {startingPoint};
            _availableCapacity = capacity;
            Cost = 0;
        }
        public void Execute(Location[] locations, Vehicle[] vehicles)
        {
            _remainingLocations = new List<Location>(locations.Where(l => l.Id != 0));

            foreach (var vehicle in vehicles)
            {
                 if (_remainingLocations.Count > 0)
                 {
                     SendVehicle(vehicle);
                 }
                 vehicle.SendHome();

                if (_remainingLocations.Sum(r => r.Demand) > vehicles.Count(v => v.Cost == 0.0)*vehicle.Capacity)
                    Console.WriteLine("too much capacity remaning");
            }

            if (_remainingLocations.Count > 0)
            {
                foreach (var remaining in _remainingLocations)
                    Console.WriteLine("{0} {1}", remaining.Id, remaining.Demand);
            }
        }
 protected bool Equals(Location other)
 {
     return Id == other.Id;
 }
 public double DistanceFrom(Location point)
 {
     return Math.Sqrt(Math.Pow(point.X - X, 2) + Math.Pow(point.Y - Y, 2));
 }
 public bool CanAssign(Location location)
 {
     return location.Demand <= _availableCapacity;
 }
 public void Assign(Location location)
 {
     _availableCapacity -= location.Demand;
     Cost += CurrentLocation.DistanceFrom(location);
     Locations.Add(location);
 }