/// <summary>
        /// Creates a new best placement min max no depot vrp router.
        /// </summary>
        /// <param name="max"></param>
        /// <param name="delivery_time"></param>
        /// <param name="k"></param>
        public CheapestInsertionSolverWithSeeds(Second max, Second delivery_time, int k)
            : base(max, delivery_time)
        {
            _seed_selector = new SimpleSeeds();

            _k = k;
        }
示例#2
0
        /// <summary>
        /// Creates a new Guided Variable Neighbourhood Search solver.
        /// </summary>
        /// <param name="router"></param>
        /// <param name="max"></param>
        /// <param name="delivery_time"></param>
        /// <param name="threshold_precentage"></param>
        /// <param name="lambda"></param>
        /// <param name="sigma"></param>
        public GuidedVNS(IRouter<RouterPoint> router, Second max, Second delivery_time, 
            float threshold_precentage, float lambda, float sigma)
            : base(max, delivery_time)
        {
            _threshold_percentage = threshold_precentage;
            _lambda = lambda;
            _sigma = sigma;

            _intra_improvements = new List<IImprovement>();
            //_intra_improvements.Add(
            //    new ArbitraryInsertionSolver());
            _intra_improvements.Add(
                new HillClimbing3OptSolver(true, true));

            _inter_improvements = new List<IInterImprovement>();
            _inter_improvements.Add(
                new RelocateImprovement());
            _inter_improvements.Add(
                new ExchangeInterImprovement());
            //_inter_improvements.Add(
            //    new TwoOptInterImprovement());
            _inter_improvements.Add(
                new RelocateExchangeInterImprovement());
            _inter_improvements.Add(
                new CrossExchangeInterImprovement());
        }
示例#3
0
        /// <summary>
        /// Creates a new genetic min max no depot vrp router.
        /// </summary>
        /// <param name="max"></param>
        /// <param name="delivery_time"></param>
        public RouterGeneticSimple(Second max, Second delivery_time)
            : base(max, delivery_time)
        {
            _population = 100;
            _stagnation = 2000;

            _elitism_percentage = 10;
            _cross_percentage = 60;
            _mutation_percentage = 30;
        }
示例#4
0
 /// <summary>
 /// Creates a new problem.
 /// </summary>
 /// <param name="cities"></param>
 /// <param name="minimum"></param>
 /// <param name="maximum"></param>
 public Problem(int cities,
     Second minimum,
     Second maximum)
 {
     this.InitialVehicles = 3;
     this.Cities = cities;
     this.TargetTime = (minimum.Value + maximum.Value) / 2.0;
     this.Tolerance = 0;
     this.MaximumTime = maximum;
     this.MinimumTime = minimum;
 }
示例#5
0
        /// <summary>
        /// Creates a new max time problem.
        /// </summary>
        /// <param name="weights"></param>
        /// <param name="max"></param>
        /// <param name="delivery_time"></param>
        /// <param name="cost_per_second"></param>
        /// <param name="cost_per_vehicle"></param>
        public MaxTimeProblem(IProblemWeights weights, Second max, Second delivery_time, 
            double cost_per_second, double cost_per_vehicle)
        {
            this.Max = max;
            this.DeliveryTime = delivery_time;
            _cost_per_second = cost_per_second;
            _cost_per_vehicle = cost_per_vehicle;

            _weights = weights;

            _calculator = new MaxTimeCalculator(this);
            _customer_positions = new List<GeoCoordinate>();
        }
 /// <summary>
 /// Creates a new best placement min max no depot vrp router.
 /// </summary>
 /// <param name="max"></param>
 /// <param name="delivery_time"></param>
 public CheapestInsertionSolver(Second max, Second delivery_time)
     : base(max, delivery_time)
 {
 }
 /// <summary>
 /// Creates a solver based on a construction heuristic.
 /// </summary>
 /// <param name="max"></param>
 /// <param name="delivery_time"></param>
 public SavingsHeuristicSolver(Second max, Second delivery_time)
     : base(max, delivery_time)
 {
 }
示例#8
0
 /// <summary>
 /// Creates a new TSP placement solver.
 /// </summary>
 /// <param name="max"></param>
 /// <param name="delivery_time"></param>
 /// <param name="tsp_solution"></param>
 public TSPPlacementSolver(Second max, Second delivery_time,
     IRoute tsp_solution)
     : base(max, delivery_time)
 {
     _tsp_solution = tsp_solution;
 }
示例#9
0
 /// <summary>
 /// Creates a new TSP placement solver.
 /// </summary>
 /// <param name="max"></param>
 /// <param name="delivery_time"></param>
 /// <param name="tsp_solver"></param>
 public TSPPlacementSolver(Second max, Second delivery_time,
     OsmSharp.Tools.Math.TSP.ISolver tsp_solver)
     : base(max, delivery_time)
 {
     _tsp_solver = tsp_solver;
 }
        /// <summary>
        /// Creates a new best placement min max no depot vrp router.
        /// </summary>
        /// <param name="max"></param>
        /// <param name="delivery_time"></param>
        /// <param name="k"></param>
        /// <param name="delta_percentage"></param>
        /// <param name="use_seed_cost"></param>
        /// <param name="threshold_precentage"></param>
        /// <param name="use_seed"></param>
        /// <param name="lambda"></param>
        /// <param name="intra_improvements"></param>
        /// <param name="inter_improvements"></param>
        public CheapestInsertionSolverWithImprovements(
            Second max, Second delivery_time, int k, float delta_percentage, bool use_seed_cost, 
            float threshold_precentage, bool use_seed, float lambda, 
            List<IImprovement> intra_improvements, List<IInterImprovement> inter_improvements)
            : base(max, delivery_time)
        {
            _k = k;
            _delta_percentage = delta_percentage;
            _use_seed_cost = use_seed_cost;
            _threshold_percentage = threshold_precentage;
            _use_seed = use_seed;
            _lambda = lambda;

            _intra_improvements = new List<IImprovement>();
            if(intra_improvements != null)
            {
                _intra_improvements.AddRange(intra_improvements);
            }

            _inter_improvements = new List<IInterImprovement>();
            if (inter_improvements != null)
            {
                _inter_improvements.AddRange(inter_improvements);
            }
        }
        /// <summary>
        /// Creates a new best placement min max no depot vrp router.
        /// </summary>
        /// <param name="max"></param>
        /// <param name="delivery_time"></param>
        /// <param name="k"></param>
        /// <param name="delta_percentage"></param>
        /// <param name="use_seed_cost"></param>
        /// <param name="threshold_precentage"></param>
        /// <param name="use_seed"></param>
        /// <param name="lambda"></param>
        /// <param name="use_improvements"></param>
        public CheapestInsertionSolverWithImprovements(
            Second max, Second delivery_time, int k, float delta_percentage, bool use_seed_cost, 
            float threshold_precentage, bool use_seed, float lambda, bool use_improvements)
            : base(max, delivery_time)
        {
            _k = k;
            _delta_percentage = delta_percentage;
            _use_seed_cost = use_seed_cost;
            _threshold_percentage = threshold_precentage;
            _use_seed = use_seed;
            _lambda = lambda;

            _intra_improvements = new List<IImprovement>();
            if (use_improvements)
            {
                //_intra_improvements.Add(
                //    new OsmSharp.Tools.Math.TSP.ArbitraryInsertion.ArbitraryInsertionSolver());
                _intra_improvements.Add(
                    new HillClimbing3OptSolver(true, true));
            }

            _inter_improvements = new List<IInterImprovement>();
            if (use_improvements)
            {
                _inter_improvements.Add(
                    new ExchangeInterImprovement());
                _inter_improvements.Add(
                    new RelocateImprovement());
                //_inter_improvements.Add(
                //    new TwoOptInterImprovement());
                _inter_improvements.Add(
                    new RelocateExchangeInterImprovement());
                _inter_improvements.Add(
                    new CrossExchangeInterImprovement());
            }
        }
 /// <summary>
 /// Creates a new best placement min max no depot vrp router.
 /// </summary>
 /// <param name="max"></param>
 /// <param name="delivery_time"></param>
 /// <param name="k"></param>
 /// <param name="delta_percentage"></param>
 /// <param name="use_seed_cost"></param>
 /// <param name="threshold_precentage"></param>
 /// <param name="use_seed"></param>
 /// <param name="lambda"></param>
 public CheapestInsertionSolverWithImprovements(
     Second max, Second delivery_time, int k, float delta_percentage, bool use_seed_cost,
     float threshold_precentage, bool use_seed, float lambda)
     : this(max, delivery_time, k, delta_percentage, use_seed_cost, threshold_precentage,
     use_seed, lambda, true)
 {
 }
示例#13
0
 /// <summary>
 /// Creates a new min max VRP router.
 /// </summary>
 public RouterMaxTime(Second max, Second delivery_time)
 {
     this.Max = max;
     this.DeliveryTime = delivery_time;
 }
示例#14
0
        /// <summary>
        /// Implements the actual logic.
        /// </summary>
        /// <param name="problem"></param>
        /// <param name="customers"></param>
        /// <param name="max"></param>
        /// <returns></returns>
        public MaxTimeSolution DoCalculation(MaxTimeProblem problem,
            ICollection<int> customers, Second max)
        {
            MaxTimeSolution routes = this.Solve(problem);

            return routes;
        }
示例#15
0
        /// <summary>
        /// Creates a new genetic min max no depot vrp router.
        /// </summary>
        /// <param name="max"></param>
        /// <param name="delivery_time"></param>
        /// <param name="population"></param>
        /// <param name="stagnation"></param>
        /// <param name="elitism_percentage"></param>
        /// <param name="cross_percentage"></param>
        /// <param name="mutation_percentage"></param>
        public RouterGeneticSimple(Second max, Second delivery_time, int population, int stagnation,
            double elitism_percentage, double cross_percentage, double mutation_percentage)
            : base(max, delivery_time)
        {
            _population = population;
            _stagnation = stagnation;

            _elitism_percentage = elitism_percentage;
            _cross_percentage = cross_percentage;
            _mutation_percentage = mutation_percentage;
        }