CS311 CARP Project Report

12110804 方嘉玮

I. Introduction

The CARP problem, which stands for Capacitated Arc Routing Problem, was formally described in 1981 by Golden and Wong[1] in their paper "Capacitated arc routing problems." The problem was motivated by the need to optimize the routing of vehicles in a variety of transportation and distribution systems, such as garbage collection, mail delivery, and street cleaning. In these applications, the objective is to minimize the total distance traveled by the vehicles while ensuring that each vehicle does not exceed its capacity limit.

The CARP problem is NP-hard, which means that it is unlikely to have an efficient algorithm to solve it exactly in all cases. Therefore, researchers have developed various heuristic and metaheuristic approaches to solve the problem approximately. The problem has also been extended to include more complex constraints and objectives, for example multiple depots [2].

In this project, we study the simplified version of CARP.

Purpose of the Project

The purpose of this project is to implement a CARP solver, while getting familiar with the problem and possibly various kinds of solvers proposed in the history.

 

II. Preliminary

CARP

Definitions

Given an undirected graph G=(V,E), a central vertex, or depot, sV, a cost function c:EN, a demand (quantity) function q:EN and capacity Q.

Required Edge: A required edge is defined to be an edge that has a positive demand value.

Route: A route is defined to be an ordered list of required edges, in which each edge e is represented by an arc τ, or tuple (vsrc,vdst), to identify the direction in which e is traversed.

A route defines a path of fixed cost to traverse from the central depot s to the endpoints of each arc, following the given direction and returning to s, where the consecutive arcs' head and tail are connected by the shortest path between them. This path is implicitly defined, and its cost remains constant regardless of which shortest path is taken (in case there are multiple shortest paths connecting a pair of vertices).

R={τ1,τ2,...,τm}={...,(vi1,vi2),...,(vj1,vj2),...}

Task: The formal name for an arc inside a route.

Heads and Tails: Define head(τ) to be the head of arc τ, and tail(τ) to be the tail of arc τ.

Shortest Path between Nodes: Define d(vsrc,vdst) to be the travelling cost of the shortest path between vsrc and vdst. This can be found using Dijkstra's or Floyd's (in case there are routes with negative cost).

Cost of A Route: The total route cost of a route is defined to be

RC(R)=d(s,head(τ1))+c(τ1)+i=2|R|(d(tail(τi1),head(τi))+c(τi))+d(tail(τ|R|),s)

which simply accumulates the cost of each edge traversed.

Total Demand of A Route: The total demand of a route is defined to be:

RD(R)=τRq(τ)

Solution: A solution is defined to be a set of routes {R1,R2,...,Rm}.

Cost of A Solution: The cost of a solution is defined to be:

TC(S)=RSRC(R)

Goal

The goal of CARP is to find a set of routes such that each required edge is served exactly once in a route, and the total cost of routes is minimized.

Formally, the goal is to find a solution such that:

 

Other Conventional Notations

 

III. Methodology

General Workflow

In this project, we implemented a modified version of MAENS [3].

We first generate an initial population. Then, in each iteration we:

 

Detailed Algorithm

We use the memetic algorithm to solve the problem.

Procedure MAENS

Randomly initialize the population P

Do

Duplicate the population P as P

While still need to generate new offspring:

Randomly pick two elements, S1, S2 as parents

Get the child: S=Crossover(S1,S2) [4]

Randomly determine if to do local search around S.

If to do local search:

S=LocalSearch(S)

Append S to P

Sort P by stochastic ranking

Pick the first n elements in P as the new population. PP

Until timeout

Return the best candidate in P

 

Procedure LocalSearch(S)

While there are not enough iterations or the quality of the solution hasn't change much from last iteration

S1=SingleInsertion(S)

S2=DoubleInsertion(S)

S3=Swap(S)

S=The Best of Three

While there are not enough iterations or the quality of the solution hasn't change much from last iteration

S=The best in S and Merge-Split(S)

Return S

 

Single insertion, double insertion and swap are common operations. We emphasize the Merge-Split procedure.

In the following procedures, λ=TC(Sbest)Q(1+TC(Sbest)TC(S)+TV(S)Q) [3]

Procedure Merge-Split(S)

n=C(|S|,p) // p is a parameter of the Merge-Split operator

If n<=K, a certain threshold of the Merge-Split operator

Do Merge-Split-Impl on all combinations \

by extracting the selected routes and collect the tasks into an unordered list TT \

then collect the results

Else

Pick 100 random combinations and do Merge-Split-Impl on these combinations \

by extracting the selected routes and collect the tasks into an unordered list T \

then collect the results

Sort the results by the formula f(S)=TC(S)+λTV(S)

Return the best solution S among the results

 

In the procedure Merge-Split-Impl, we build five list of routes using the Path-Scanning heuristic introduced in [3].

Procedure Merge-Split-Impl(T)

{Sp1,Sp2,Sp3,Sp4,Sp5}=do Path-Scanning using five additional rules separately

Sort the results by the formula f(S)=TC(S)+λTV(S)

Return the best solution S among the results

 

Since Path-Scanning (PS) is well-known, we only state the primary rule and the additional five rules when multiple candidate tasks exist. These rules are used to pick the next candidate when forming a partial solution given an unordered list of tasks. Details can be found in [3].

Code can be found at CS311_CARP_Solver/CARP_solver.py at main · IskXCr/CS311_CARP_Solver (github.com). The version submitted on SUSTech Spaces is the wrong one.

 

Analysis

The optimality of the algorithm is guaranteed by the characteristic of the evaluation function f(S)=TC(S)+λTV(S) if the algorithm has enough time. When selecting the best solution from a population, only those feasible solutions will be considered.

Deciding Factor of the Performance: The performance of the algorithm relies on certain internal parameters.

ParameterMeaning
psizeThe size of the population
ubtrialUpper bound for initial trials
opsizeNumber of offspring produced in each generation
prob_lsProbability to conduct a local search
pNumber of routes involved in the Merge-Split operator
gen_cntNumber of generations involved. In this project there is only time constraint.
λPenalty coefficient for evaluating the violation of constraints of a given solution (compared to the current best).

External parameters of the given input will also determine the performance.

ParameterMeaning
nNumber of vertices
task_cntCount of tasks
non_task_cntCount of non-task edges
QCapacity
t_costTotal cost of all tasks

Besides parameters, the implementation of the Merge-Split operator determines the ability of the algorithm to step out of the local optima and reach the global optima. In this modified MAENS implementation Ullusoy's split is not used, leading to a worsened performance.

 

IV. Experiments

Setup

NameSpecification
CPUi7-1165G7 4C8T @2.80 GHz
RAM8 Channel LPDDR4 4266MHz
Python Version3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)]
numpy Version1.24.2
Maximum #thread used8

 

Dataset [5] and Project CARP_samples

image-20230515191623873

image-20230515191905698

Datasets of different sizes and shapes are gathered for experiment. The shape of a dataset, in this context, is defined to be the relative relations between sizes of non_task_cnt, task_cnt and #vertices of that dataset. The diversity of the dataset contributes to the completeness of the experiment.

 

Result

seed=2333

The second and the third column contains our result.

Dataset10s Result300s ResultReference MAENS [3]TSAbest [3]
egl-e1-A4151371335483548
egl-g1-A15136111349376964014 (MAENS*-IIa) [6]\
egl-s1-A6501548150185018
gdb1321316316316
gdb10311283275275
gdb23259238233233
val1A183178173173
val4A466420400400
val7A342298279279

 

Different population size and the result of convergence:

Dataset60s, psize=3060s, psize=6060s, psize=120
egl-e1-A372738543959
egl-g1-A141949413851911366565
egl-s1-A572759306167
gdb10283277290
val1A178178178
val4A436436455
val7A307321321

 

Analysis

The results of our implementation is acceptable when the size of input is small. As the input enlarges the performance starts to deteriorate. This is expected, as the implementation of the Merge-Split operator isn't well designed and it is possible that the operator couldn't jump out of the local optima.

Enlarging the size of population doesn't necessarily incur a faster convergence in the experiment (given a time limit). Our assumption is that increasing the size of population also decreases the number of iterations in the MAENS algorithm, which in some cases leads to a slower evolution, resulting in generally bad performance. In the other cases with larger input, such modification incurs a larger variance that results in a better local optima being enqueued.

The implementation doesn't use a stochastic ranking but instead rank according to f(S)=TC(S)+λTV(S), leading to a potential trap in the local optima.

The implementation is also not well optimized in terms of overall performance, leading to a very slow convergence.

 

V. Conclusions

Advantages of the algorithm:

Disadvantages:

 

Does the experimental result match our expectation?

 

Lessons learned from this project:

 

Further thoughts on how it can be improved:

 

References

[1] Golden, B.L. and Wong, R.T. (1981), Capacitated arc routing problems. Networks, 11: 305-315. https://doi.org/10.1002/net.3230110308

[2] A. Kansou and A. Yassine, "A two ant colony approaches for the multi-depot capacitated arc routing problem," 2009 International Conference on Computers & Industrial Engineering, Troyes, France, 2009, pp. 1040-1045, doi: 10.1109/ICCIE.2009.5223923.

[3] K. Tang, Y. Mei and X. Yao, "Memetic Algorithm With Extended Neighborhood Search for Capacitated Arc Routing Problems," in IEEE Transactions on Evolutionary Computation, vol. 13, no. 5, pp. 1151-1166, Oct. 2009, doi: 10.1109/TEVC.2009.2023449.

[4] Yuning Chen, Jin-Kao Hao, Fred Glover, A hybrid metaheuristic approach for the capacitated arc routing problem, European Journal of Operational Research, Volume 253, Issue 1, 2016, Pages 25-39, ISSN 0377-2217, https://doi.org/10.1016/j.ejor.2016.02.015.

[5] Capacitated Arc Routing Problem (uv.es)

[6] Consoli, Pietro & Minku, Leandro. (2014). Dynamic Selection of Evolutionary Algorithm Operators Based on Online Learning and Fitness Landscape Metrics. Soft Computing. 20. 359-370. 10.1007/978-3-319-13563-2_31.