示例#1
0
 public DijkstraResolve(ISet <DijkstraVertex> dijkstraVertices,
                        ICityMap cityMap, ICityPlace startPlace)
 {
     _dijkstraVertices = dijkstraVertices;
     CityMap           = cityMap;
     StartPlace        = startPlace;
 }
示例#2
0
 public Model(IReadOnlyCollection <IVehicleModel> vehicleModels, IReadOnlyCollection <IVehicle> vehicles, ICityMap cityMap, IGoods goods)
 {
     VehicleModels = vehicleModels;
     Vehicles      = vehicles;
     CityMap       = cityMap;
     Goods         = goods;
 }
示例#3
0
 public Optimizer(ICityMap cityMap)
 {
     CityMap          = cityMap;
     _dijkstraResolve = new DijkstraResolver()
                        .Resolve(cityMap,
                                 cityMap.Places.First(x => x is IWarehouse));
 }
示例#4
0
        public SimulationService(
            ICityMap cityMap,
            IEnumerable <VehicleModel> availableVehicleModels,
            IOptimizer optimizer)
        {
            _optimizer = optimizer;
            CityMap    = cityMap;
            _availableVehicleModels = availableVehicleModels.ToList();
            TimeModifier            = 60;
            CurrentDateTime         = DateTime.Now;

            var resultBinding = this.WhenAnyValue(x => x.Profit, x => x.Leasing, x => x.Penalty)
                                .Select(x => x.Item1 - x.Item2 - x.Item3)
                                .Subscribe(x => Result = x);

            _cleanUp = Disposable.Create(() =>
            {
                _currentTimer?.Dispose();
                resultBinding.Dispose();
            });
        }
示例#5
0
        public DijkstraResolve Resolve(ICityMap cityMap, ICityPlace startPoint)
        {
            _cityMap  = cityMap;
            _vertexes = InitDijkstraVertexes(cityMap.Places);

            _vertexes
            .First(x => x.CityPlace == startPoint)
            .EdgesWeightSum = 0;

            while (true)
            {
                var current = FindUnvisitedVertexWithMinSum();
                if (current == null)
                {
                    break;
                }

                SetOptimalWaysForNeighbor(current);
            }

            return(new DijkstraResolve(_vertexes, cityMap, startPoint));
        }
示例#6
0
 public TicketWindow(ICityMap cityMap)
 {
     _cityMap = cityMap;
 }