@[2017.11.24]
[TOC]
Use python2.7
as the coding language.
Use dijkstra algorithm
to find the shortest distance of the VERTICES.
Use Path Scanning
to generate the initial solution pool.
Use Memetic search
as the algorithm to find the best solution.
Use module re
to split the input data and formalize the structure of the data.
for x in given_file:
arr.append(re.split(" *:*", x.strip()))
Also save some useful information like CAPACITY
DEPOT
etc.
Use dijkstra algorithm
to calculate the path of each two vertices in the problems and store the data into a array.
Use a well-known Path Scanning algorithm
1 heuristic to generate the initial solution pool.
Previous Research shows that it has five methods to generate a path efficiently:
for a given
(1)
$d(i,j)$ , per unit remaining demand is minimized; (2)$d(i,j)$ , per unit remaining demand is maximized; (3)$d(i,d)$ is minimized; (4)$d(j,d)$ is minimized; (5) if the vehicle is less than half-full,$max(d(i,d))$ , otherwise$min(d(i,d))$ .
In the programming the weighs for those five are:
0.4, 0.1, 0.1, 0.1, 0.1
Also give the rest 0.2
weigh to the other strategy: randomly choose the near task and add it into the path.
In this part we use a crossover method called Route-based crossover (RBX)
2 to create the offspring solution.
Given two parent solutions :
$S^1 = {R^1_1,R^2_2,\cdots R^1_{m1}} $ with $ m_1 $ routes
$S^2 = {R^1_2,R^2_2,\cdots R^2_{m2}} $ with $ m_2 $ routes
The steps shows below:
- Step1: Copy
$S^1$ to an offspring solution$S^0$ and randomly choose a route from$S^2$ to replace a random route in$S^0$ . Collect the unserved tasks into a set.
- Step2: Remove duplicate tasks. In this part it will take the cost of the two duplicate tasks into consideration. It will choose a task that will reduce the total cost or choose the task that lead to smaller cost increased.
- Step3:
Insert the unserved task into
$S^0$ . At first, shuffle the unserved task. For every route that can accommdate the task, it will choose a palce that will reduce the total cost or lead to smaller cost increased. This process is repeated until the set becomes empty.
The steps it is clear that the RBX
method could lead to an offspring solution which is structurally different from its parent solutions since that the deletion and insertion is randomly choose and it can also lead the overall cost minimaized.
In this part we will use four operator3 Inversion
(IV), Single insertion
(SI), Double insertion
(DI), Swap
(SW) to start mutation and local search.
The introduction of the move operators shows below:
Let
Inversion (IV): replace the current arc of task
$u$ with its reverse arc in$S$
Single insertion (SI): displace task
Double insertion (DI): displace a sequence
Swap (SW): exchange task
For all of the move operators, both directions are considered and the best result of the cost will be chosen.
st=>start: Input data
op=>operation: Dijkstra algorithm
op2=>operation: Path Scanning algorithm
op3=>operation: Route-based Crossover(RBX)
op4=>operation: Move Operators
op5=>end: Output Data
st->op->op2->op3->op4->op5
Footnotes
-
B. L. Golden†. Computational Experiments with Algorithms for a class of routing problems[J]. Computers & Operations Research, 1983, 10(1):47-59. ↩
-
Chen Y, Hao J K, Glover F. A hybrid metaheuristic approach for the capacitated arc routing problem[J]. European Journal of Operational Research, 2016, 253(1):25-39. ↩
-
梅一. 基于元启发式方法对限量弧路由问题的求解[D]. 中国科学技术大学, 2010. ↩