Declarative Representation and Solution of Vehicle Routing with Pickup and Delivery Problem

Declarative Representation and Solution of Vehicle Routing with Pickup and Delivery Problem

Available online at www.sciencedirect.com ScienceDirect This space is reserved for the Procedia header, do not use it Procedia 108C (2017) 958–967 T...

512KB Sizes 10 Downloads 116 Views

Available online at www.sciencedirect.com

ScienceDirect

This space is reserved for the Procedia header, do not use it Procedia 108C (2017) 958–967 This space is Computer reservedScience for the Procedia header, do not use it This space is reserved for the Procedia header, do not use it

International Conference on Computational Science, ICCS 2017, 12-14 June 2017, Zurich, Switzerland

Declarative Representation and Solution of Vehicle Routing Declarative Representation and Solution of Vehicle Routing with Pickup and Delivery Problem Declarative Representation and Solution of Vehicle Routing with Pickup and Delivery Problem Amelia B˘adic˘ a1 , Costin B˘adic˘ a1 , Florin Leon2 ,Problem and Lucian Luncean3 with Pickup and Delivery 1 1 2 3 Amelia B˘adic˘a , Costin B˘adic˘a , Florin Leon , and Lucian Luncean 1 University of Craiova, Craiova, Romania 1 Amelia B˘adic˘a , Costin B˘adic˘ a1 , Florin Leon2 , and Lucian Luncean3 1 [email protected] University of Craiova, Craiova, Romania 2 2 2

University “Gheorghe Asachi” of Ia¸si, Ia¸si, Romania [email protected] 1 University of Craiova, Craiova, Romania [email protected] University “Gheorghe Asachi” of Ia¸si, Ia¸si, Romania [email protected] 3 Romanian-German University of Sibiu, Romania [email protected] Asachi” of Ia¸si, Ia¸si, Romania 3University “Gheorghe [email protected] Romanian-German University of Sibiu, Romania [email protected] [email protected] 3 Romanian-German University of Sibiu, Romania [email protected]

Abstract Abstract Recently we have proposed a multi-agent system that provides an intelligent logistics brokerage service focusing the transport activity system for the that efficient allocation of transport resources (veRecently we haveonproposed a multi-agent provides an intelligent logistics brokerage Abstract hicles or trucks) to the transport applications. The freight broker agent has a major role to coservice focusing on activity for the efficient allocation of transport resources (veRecently we have proposed a multi-agent system that provides an intelligent logistics brokerage ordinate transportation arrangements of transport customers (usually shippers and consignees) hicles or trucks) to the transport applications. The freight broker agent has a major role to coservice focusing on the transport activity for the efficient allocation of transport resources (vewith transport resource providers or carriers, following the freight broker business model. We ordinate transportation arrangements of transport customers (usually shippers and consignees) hicles or trucks) to the transport applications. The freight broker agent has a major role to cofocus on transportation the fundamental functionorofcarriers, business thatthe aims to find available trucks andWe to with transport resource arrangements providers following freight broker business model. ordinate ofthis transport customers (usually shippers and consignees) define their feasible routes for transporting requested customer loads. The main contribution focus on the fundamental function of this business that aims to find available trucks and to with transport resource providers or carriers, following the freight broker business model. We of this paper is on formulating our scheduling problem as a special type of vehicle routing with define their feasible routes for transporting requested customer loads. The main contribution focus on the fundamental function of this business that aims to find available trucks and to pickup and delivery problem. propose a new set partitioning model specific problem. of this their paper is on formulating our scheduling problem as a special typeof ofour vehicle routing with define feasible routes forWe transporting requested customer loads. The main contribution Vehicle routes are defined on the graph of cities, rather than on the graph of customer orders, as pickup and delivery problem. We propose a new set partitioning model of our specific problem. of this paper is on formulating our scheduling problem as a special type of vehicle routing with typically proposed by set partitioning formulations. This approach is particularly useful when Vehicle routes are defined on the graph of cities, rather than on the graph of customer orders, as pickup and delivery problem. We propose a new set partitioning model of our specific problem. a large number of customer orders sharing a significantly lower number of pickup and delivery typically proposed by set partitioning formulations. This approach is particularly useful when Vehicle routes are defined on the graph of cities, rather than on the graph of customer orders, as points be of scheduled. Our achievement is the declarative representation andand solution of a large must number customer orders sharing a significantly number of pickup delivery typically proposed by set partitioning formulations. This lower approach is particularly useful when the model using ECLiPSe state-of-the-art constraint logic programming system. points must be scheduled. Our achievement is the declarative representation and solution of a large number of customer orders sharing a significantly lower number of pickup and delivery the model using ECLiPSe state-of-the-art constraint logic programming system. points must be scheduled. Our achievement is the declarative representation and solution of

Keywords: constraint logic programming, vehicle routing, pickup and delivery problem © 2017 The Authors. Published by Elsevier B.V. Peer-review of the scientific vehicle committee of the logic International on Computational Science the model under usingresponsibility ECLiPSe state-of-the-art constraint programming Keywords: constraint logic programming, routing, pickup andConference delivery system. problem Keywords: constraint logic programming, vehicle routing, pickup and delivery problem

1 Introduction 1 Introduction The research reported in this paper is motivated by a project involving the application of intel1 Introduction ligentresearch agent-based computational technologies to by freight brokering. Recently we have proposed The reported in this paper is motivated a project involving the application of intelan based architecture a technologies freight brokering [8]. WeRecently have ligent agent-based computational to by freight brokering. we havethe proposed Theagent research reported in this of paper is motivated asystem project involving theidentified application ofmajor intelrole of the freight broker agent in matchmaking of provided transport resources with requested an agent based architecture of a freight brokering system [8]. We have identified the major ligent agent-based computational technologies to freight brokering. Recently we have proposed transportation orders such that constraints met.identified We with proposed a sorole of thebased freight broker agent matchmaking of provided transport resources requested an agent architecture of inavarious freighttransportation brokering system [8]. Weare have the major lution for the broker agent that integrates agent and service technologies [7]. The broker agent transportation orders such various transportation constraints are met. We proposed a sorole of the freight broker agent in matchmaking of provided transport resources with requested lution for the broker agent that integrates agent and service technologies [7]. The broker agent transportation orders such that various transportation constraints are met. We proposed a so1 lution for the broker agent that integrates agent and service technologies [7]. The broker agent 1 1877-0509 © 2017 The Authors. Published by Elsevier B.V. Peer-review under responsibility of the scientific committee of the International Conference on Computational Science 10.1016/j.procs.2017.05.261

1



Declarative Solution of Vehicle Amelia Routing Problem B˘ adic˘ a, B˘ adic˘ a, Leon, and Luncean Bădică et al. / Procedia Computer Science 108C (2017) 958–967

uses a mathematical optimization service to compute an optimal transportation schedule that fulfils the customer requirements. Our main contribution is to formulate the freight broker function as a special vehicle routing with pickup and delivery problem [10]. There are many types, models, solution methods, and applications of vehicle routing. Our specific case involves many customer orders representing a set of requested freight deliveries. Each order specifies the source or pickup point, the destination or delivery point, as well as the transported capacity (for example the freight weight). Sources and destinations represent towns or cities of a geographical region. Pickup and delivery points (also known as transportation hops) can be arbitrarily shared by the orders, so the total number of hops specified by the orders can be different, actually lower, than the total number of orders. Note that hops can represent towns, cities, or even different regions or areas in a certain, usually large, city, depending on the modeling decision taken by the model engineer. Mathematical models of vehicle routing typically fall into one of two categories: vehicle flow and respectively set partitioning [10]. Our new proposed model can be described as belonging to the class of set partitioning. Nevertheless, vehicle routes are defined on the graph of hops, rather than on the graph of customer orders, as typically proposed by set partitioning formulations. This approach is particularly useful when a large number of orders sharing a significantly lower number of pickup and delivery points must be scheduled. Our main achievement is the formulation of the declarative model of the problem. We also propose the model representation and solution using ECLiPSe state-of-the-art constraint logic programming [3] system. There are three major directions of developing declarative languages for the specification and solution of constraint satisfaction problems: constraint logic programming (or CLP hereafter) [4], answer set programming (ASP hereafter) [5] and satisfiability checking (SAT hereafter) [6]. An experimental comparison of CLP with finite domains and ASP for solving combinatorial NP-complete problems is presented in [2]. Our proposal belongs to the CLP approach. There are also approaches of combining constraint satisfaction with evolutionary algorithms. An optimization method by hybridizing genetic algorithms with CLP is proposed in [1]. The method uses constraint satisfaction to search feasible solutions on a subspace of the search space, and genetic algorithms to efficiently explore the space of subspaces for optimal solutions.

2 2.1

Mathematical Model Background

Recently we proposed a multi-agent system that provides an intelligent logistics brokerage service focusing on the transport activity for the efficient allocation of transport resources (vehicles or trucks) to the transport applications. The goal is to create optimal transport routes or policies such that a vehicle does not move without cargo or at least, that the movement without cargo is kept at a minimum, on the road segments between two loading and/or unloading points. In our system a freight broker agent coordinates arrangements between transport customers (shippers and consignees) and transport resource providers or carriers, following the freight broker business model. We focus on the fundamental function of this business that aims to find available trucks and to define their feasible routes for transporting requested customer loads. In what follows we assume that customer orders are accumulated over a period of time, before shipping. Available trucks are also recorded into the system, as soon as they become ready for serving new transport requests. The freight broker agent maintains this information and applies mathematical optimization methods for the freight brokerage industry [13]. 2

959

960

Declarative Solution of Vehicle Amelia Routing Problem B˘ adic˘ a, B˘ adic˘ a, Leon, and Luncean Bădică et al. / Procedia Computer Science 108C (2017) 958–967

The goal of the freight broker agent is to determine feasible matchings of trucks with loads. In our approach, the freight broker agent is using a declarative model that captures the constraints that must be satisfied by the matching operation. We assume that the following information is available for defining this model: • The set of customer orders. Each order defines the pickup point, the delivery point and the capacity to be transported. The capacity can represent various load attributes such as weight, volume, etc. We use a “generic” capacity attribute, rather than a more specific attribute, to keep our model as general as possible. • The available trucks. Each truck has a maximum “capacity” that it can transport, as well as a home point that represents its departure / final return point. • The distances between the points of interest. Here we include the set of pickup and delivery points, as well as the home points of the trucks.

2.2

Problem Definition

Let us assume that there are n ≥ 1 orders (osi , odi , ci ) such that osi = odi are the pickup, respectively the delivery points (representing locations of a certain geographical region) and ci > 0 is the requested capacity of order i, for all 1 ≤ i ≤ n. We also assume that there are k locations, i.e. ∪ni=1 {osi , odi } = {o1 , o2 , . . . , ok }. Here oi is the name of location i, but often locations oi are identified using their index i. It follows that 2 ≤ k ≤ 2n. Let us assume that there are available t ≥ 1 trucks for serving the requested orders. For each truck j it is given its home or origin point hj . The home point can be equal or not with one of the pickup and delivery points. Let us assume that there are h ≥ 0 home points of the trucks not included in the set of pickup and delivery points (trucks can share their home point). It follows that in total there are k + h locations of interest for our problem. For each truck j we know its maximum provided transportation capacity γj . For any two locations 1 ≤ i = j ≤ k + h representing pickup, delivery or home points we are given the distance δij > 0 between i and j. Let m be the total number of pickup and delivery points (or hops) required by a subset of trucks to serve all the transportation orders. Each of the k locations must be visited, so m ≥ k. Moreover, each order requires two hops, one for pickup, the other for delivery, so maximum 2n hops are needed. It follows that k ≤ m ≤ 2n. Let us assume that the solution is represented as a vector x of size m such that xi ∈ {1, 2, . . . , k} for all 1 ≤ i ≤ m, Vector x captures all sequences of hops that define the required truck routes to serve the orders. Each truck l performs ml ≥ 0 hops. If ml = 0 then truck l is not part of the solution. So, setting ml ≥ 0 allows solutions using “at most” t trucks, while setting ml ≥ 1 constraints solutions to use “exactly” t trucks. We conclude that: t

l=1 ml = m m ∈ {k, k + 1, . . . , 2n} mi ≥ 0 (or mi ≥ 1) for all 1 ≤ l ≤ t

(1)

The first m1 components of x define the hops of truck 1, the next m2 components of x define the hops of truck 2, ..., while the last mt components of x define the hops of truck t. l−1 We partition interval [1, m] in t intervals Il = [al , bl ] defined by al = 1 + α=1 mα and l bl = α=1 mα , 1 ≤ l ≤ t. If ml = 0 then Il = ∅. Each interval Il = ∅ defines the hops of 3



Declarative Solution of Vehicle Amelia Routing Problem B˘ adic˘ a, B˘ adic˘ a, Leon, and Luncean Bădică et al. / Procedia Computer Science 108C (2017) 958–967

truck l. The route of truck l (including its home and the departure/return segments from/to the home) is hl → xal → xal +1 → · · · → xbl → hl . The number of hops of truck l is bl − al + 1. The vector x of hops is not enough for defining our problem solution. We must also know the load / unload actions for each hop. So for each i = 1, . . . , m we introduce the sets Si , Di ⊆ {1, 2, ..., n} to capture the load and unload points of each hop i. These sets are defined below: Si = {1 ≤ j ≤ n | xi is the pickup point of order j} Di = {1 ≤ j ≤ n | xi is the delivery point of order j}

(2)

Consider for example a problem with n = 3 orders, k = 3 cities and t = 3 trucks. All the trucks share the same home with index 4, so h = 1. The orders are: (os1 , od1 , c1 ) = (1, 2, 5), (os2 , od2 , c2 ) = (1, 3, 2), and (os3 , od3 , c3 ) = (2, 3, 6). The maximum capacities of the trucks are (γ1 , γ2 , γ3 ) = (7, 4, 5). A feasible solution involving only trucks 1 and 3 is defined by the following truck routes (home segments are omitted for brevity): • Truck 1 of maximum capacity 7: move to location 1 carrying capacity 0, load for order 1, move to location 2 carrying capacity 5, unload for order 1, load for order 3, move to location 3 carrying capacity 6, unload for order 3. • Truck 3 of maximum capacity 5: move to location 1 carrying capacity 0, load for order 2, move to location 3 carrying capacity 2, unload for order 2. This solution is represented by: m = 5, m1 = 3, m2 = 0, m3 = 2, x = [1, 2, 3, 1, 3], S1 = {1}, D1 = ∅, S2 = {3}, D2 = {1}, S3 = ∅, D3 = {3}, S4 = {2}, D4 = ∅, S5 = ∅, and D5 = {2}.

2.3

Problem Constraints

Using the notations introduced in the previous subsection, we are now able to define the constraints that must be satisfied by a problem solution. According to the definition of sets Si and Di by equation (2), we can formulate the set of constraints involving the pickup and delivery points of an order. We consider two formulations: (i) the set formulation, employing the sets Si and Di introduced by equation (2), and (ii) the algebraic formulation, using a representation of sets Si and Di as two m × n Boolean matrices    = 1 if j ∈ Si , otherwise Sij = 0 and Dij = 1 if j ∈ Di , otherwise S  and D defined as Sij  = 0. Concerning the use of quantified variables i, j, k, and l in the specification of the Dij constraints let us assume that i, k represent hops, i.e. i, k ∈ {1, 2, . . . , m}, j represents orders, i.e. j ∈ {1, 2, . . . , n} and l represents trucks, i.e. l ∈ {1, 2, . . . , t}. • For each hop i = 1, . . . , m if j ∈ Si then i is the pickup point for order j, so using sets: (∀i, j)((j ∈ Si ) ⇒ (xi = osj ))

(3)

and equivalently in the algebraic representation:  = 1) ⇒ (xi = osj )) (∀i, j)((Sij

(4)

• For each hop i = 1, . . . , m if j ∈ Di then i is the delivery point for order j, so using sets: (∀i, j)((j ∈ Di ) ⇒ (xi = odj ))

(5)

and equivalently in the algebraic representation:  = 1) ⇒ (xi = odj )) (∀i, j)((Dij

4

(6)

961

962

Declarative Solution of Vehicle Amelia Routing Problem B˘ adic˘ a, B˘ adic˘ a, Leon, and Luncean Bădică et al. / Procedia Computer Science 108C (2017) 958–967

• There exists at least one load or unload operation in each hop i, i.e. using sets: (∀i)(Si ∪ Di = ∅)

(7)

and equivalently in the algebraic representation: (∀i)

n  j=1

  Sij + Dij ≥1

(8)

• For each hops i, k = 1, 2, . . . , m if j ∈ Si ∩ Dk then the pickup point i of order j must precede the delivery point k of order j, so using the set representation: (∀i, k)(((∃j)(j ∈ Si ∩ Dk )) ⇒ (i < k))

(9)

and equivalently in the algebraic representation:   = 1) ∧ (Dij = 1)) ⇒ (i < k)) (∀i, k)((∃j)((Sij

(10)

• For each order j = 1, . . . , n there is a unique load point and a unique unload point, so: (∀j)(∃!i)(j ∈ Si ) (∀j)(∃!i)(j ∈ Di )

(11)

and equivalently in the algebraic representation: (∀j)

m 

 Sij =1

i=1

(∀j)

m 

(12)

 Dij

=1

i=1

• Each order is completely served by a unique truck. So, for each truck l, the orders with load point assigned to l have also the unload point assigned to l, i.e. using sets: (∀l) ∪i∈Il Si = ∪i∈Il Di

(13)

and equivalently in the algebraic representation, for each truck l and each order j: (∀l, j)

bl 

i=al

 Sij =

bl 

 Dij

(14)

i=al

Finally we must specify the constraints stating that the capacities of the trucks are not overflowed along each truck route. Let cti denote the transported capacity of truck l between hops i − 1 and i, for all i = al , . . . , bl . Initially ct0 = 0. For each hop i the value of cti can be obtained from cti−1 by adding and subtracting the capacities loaded, respectively unloaded in hop i. The constraints on capacities usage can be formulated either using the set representation: ct0 cti cti

=0   = cti−1 + j∈Si cj − j∈Di cj ≤ γi

for all 1 ≤ l ≤ t and al ≤ i ≤ bl for all 1 ≤ l ≤ t

(15)

5



Declarative Solution of VehicleAmelia Routing Problem B˘ adic˘ a, B˘ a958–967 dic˘ a, Leon, and Luncean Bădică et al. / Procedia Computer Science 108C (2017)

and equivalently using the algebraic representation: ct0 cti cti

=0 n   = cti−1 + j=1 (Sij − Dij )cj ≤ γi

for all 1 ≤ l ≤ t and al ≤ i ≤ bl for all 1 ≤ l ≤ t

(16)

Note that for each truck l = 1, . . . , t, the remaining capacity to be transported along the last segment connecting the last hop to the truck home location is 0, i.e. ctbl = 0 holds. If there is a solution that specifies that a truck l can perform a load and an unload (for a different order) in hop j then, according to the constraints stating that there must be at least one pickup or delivery in each hop, the constraint solver can generate redundant solutions actually representing the same solution. A solution could specify only a single hop j defining both the pickup and the delivery, as well as two consecutive identical hops representing the pickup and the the delivery. This redundancy can be eliminated by stating that for each truck l, each of its two consecutive hops j and j + 1 with j ∈ [al , bl − 1] must be different, i.e.: (∀l, j)xj = xj+1

3

(17)

CLP Model

3.1

Model Development

In this section we present our proposed CLP model of the problem. We are using ECLiPSe [3, 12], a state of the art CLP system that incorporates a Prolog engine, as well as additional libraries for constraint satisfaction. A CLP program is represented as a set of logic programming facts and rules composed of predicates. CLP in general and ECLiPSe in particular distinguish between normal Prolog predicates as used by standard Prolog and constraints that are specific to CLP. This distinction is mandatory as constraints are handled by specialized constraint satisfaction algorithms that provide more efficient problem solving methods than the standard Prolog’s backtracking search. Let us assume for simplicity that the initial data is given as a set of Prolog facts: Listing 1: Problem data given as a set of Prolog facts n u m b e r _ o f _ o r d e r s (3). n u m b e r _ o f _ c it i e s (3). n u m b e r _ o f _ t r u c k s (3). nu mb er _ of _h om e s (1). % order ( OrderIndex , LoadIndex , UnloadIndex , C a p a c i t y ) order (1 ,1 ,2 ,5). order (2 ,1 ,3 ,2). order (3 ,2 ,3 ,6). % truck ( TruckIndex , HomeIndex , M a x i m u m C a p a c i t y ) truck (1 ,4 ,7). truck (2 ,4 ,4). truck (3 ,4 ,5). % d i s t a n c e ( LocationI , LocationJ , D i s t a n c e I J ) distance (1 ,2 ,10). distance (2 ,1 ,10). ... distance (4 ,3 ,10).

Following the methodology proposed in [9], a CLP-based program has three stages: (i) define variables and domains; (2) define constraints; (3) search for solutions. A problem solution is represented by a tuple of variables: M is the number of hops, N is the number of orders, T is the number of trucks, M M is an ECLiPSe array [12] with T elements such that for each I from 1 to T the value of M M [I] is the number of hops on the route of truck I, S and D are M × N Boolean ECLiPSe arrays for capturing the load / unload points associated to each hop, X is an M -size ECLiPSe array for defining the hops, and Ds represents the list of distances travelled by each truck (see Listing 2). 6

963

964

Declarative Solution of VehicleAmelia Routing Problem B˘ adic˘ a, B˘ a958–967 dic˘ a, Leon, and Luncean Bădică et al. / Procedia Computer Science 108C (2017)

Listing 2: Specification of the solution predicate solution (M ,N ,T , MM ,S ,D ,X , Ds ) : d o m a i n s _ a n d _ v a r i a b l e s (M ,N ,T , MM ,S ,D ,X , Delta ) , constraints (M ,N ,T , MM ,S ,D , X ) , labeling ([]( X ,S , D )) , c o m p u t e _ d i s t a n c e s (M ,T , MM , Delta ,X , Ds ).

The definition of variables and their domains is straightforward with the exception of variables M and M M . Note that N , K, and T act as parameters, i.e. they get initial values that do not change during the search process. However, we must explore all the possible values of M and M M , according to constraint (1). For each possible value of M and M M we define the problem constraints and then search for feasible solutions, as stated in the general methodology. Listing 3: Specification of problem variables and their domains d o m a i n s _ a n d _ v a r i a b l e s (M ,N ,T , MM ,S ,D ,X , Delta ) : n u m b e r _ o f _ c i ti e s ( K ) , n u m b e r _ of _ o r d e r s ( N ) , n u m b e r _ o f _ t r uc k s ( T ) , n u mb er _o f _h om es ( H ) , NT is K +H , i n i t i a l i z e _ d i s t a n c e s ( Delta , NT ) , M :: K ..2* N , labeling ([ M ]) , dim ( MM ,[ T ]) , MM :: 0.. M , % % or MM :: 1.. M to use all the T trucks ( for (L ,1 , T ) , param ( MM ) , fromto (0 , S0 , S1 , MSum ) do S1 #= S0 + MM [ L ] ) , MSum #= M , labeling ( MM ) , dim (S ,[ M , N ]) , dim (D ,[ M , N ]) , dim (X ,[ M ]) , S :: 0..1 , D :: 0..1 , X :: 1.. K .

Domains of variables are defined with the ::/2 operator. For example the goal M :: K..2 ∗ N specifies that variable M has domain {K, K + 1, . . . , 2N }, while X :: 1..K specifies that each element of X has domain {1, 2, . . . , K}. Matrices of variables are defined using the dim ( M atrix, Dimensions ) predicate. For example the goal dim(S, [M, N]) specifies that S is a matrix with M rows and N columns. One important facility of ECLiPSe to support the declarative modeling of iterations required by mathematical programming problems is provided by declarative loops, firstly proposed in [11]. A declarative loop has the following general format: ( IterationSpecs do Goal )

(18)

In (18), IterationSpecs denotes a list of iteration specifiers IterSpec1 , IterSpec2 while Goal denotes an ordinary Prolog goal. Most often this list is comma-separated, specifying that iterators are combined “synchronously”, i.e. all take their current value for the current execution of Goal, then moving to the next value, and so on. We are using the following iteration specifiers: • for ( V ariable , M inExpr , M axExpr ) specifies an iteration with the iteration variable V ariable ranging from all the integers from M inExpr to M axExpr. • param ( V ariable1 , V ariable2 . . . ) specifies that variables V ariable1, V ariable2, . . . are global, i.e. shared with the loop context, as well as shared by all the loop iterations. • fromto ( F irst , In , Out , Last ) specifies that Goal is iterated starting with In = F irst until Out = Last, while for all iterations, excepting the first, the value of Out is the value of In from the previous iteration. In Listing 2 we are using a declarative loop for constraining the values of M M according to equation (1). Note also the use of labeling/1 predicate for generating all the possible values of M and M M according to constraint (1) using the chronological backtracking algorithm. 7



Declarative Solution of Vehicle Amelia Routing Problem B˘ adic˘ a, B˘ adic˘ a, Leon, and Luncean Bădică et al. / Procedia Computer Science 108C (2017) 958–967

The most elaborated part of our model is responsible with the definition of the constraints. In what follows we focus on the algebraic, rather than set-based approach, for representing the constraints, as given by equations (4), (6), (8), (10), (12), (14), (16). For that purpose we are using the interval arithmetic constraint solver ic integrated into ECLiPSe system. Because of lack of space we consider here only the constraints given by equations (10) and (16), that we find more interesting1 . Let us first consider the equation (10). This can be simplified by mapping the existential quantifier to the universal quantifier using the equivalence of p ⇒ q with ¬q ⇒ ¬p and then moving the universal quantifiers in front of the equation. We obtain the following simpler constraint equivalent with (10):   (∀i, j, k)((i ≥ k) ⇒ ((Sij = 0) ∨ (Dij = 0)))

(19)

Constraint (19) can be represented in ECLiPSe using three nested loops controlled by 3 variables: J with values from 1 to N , I from 1 to M , and K from 1 to I (thus K ≥ I is always true), resulting the ECLiPSe model shown in Listing 4. Listing 4: Specification of constraint (19) constraint_2 (M ,N ,S , D ) : ( for (J ,1 , N ) , param (M ,S , D ) do ( for (I ,1 , M ) , param (J ,S , D ) do ( for (K ,1 , I ) , param (I ,J ,S , D ) do S [I , J ] #= 0 or D [K , J ] #= 0 ) ) ).

The ECLiPSe model of constraints (16) and (17) is represented in Listing 5. In the outer loop, for each truck L we determine the limits of the interval [al , bl ] in variables AL and BL and the value γi in variable Cmax. Then, in the next inner loop we determine the value cti in variable C1 by iterating with I for each hop of truck L in the interval [al , bl ]. Note that the last l = 1, 2, . . . , t. Finally, the innermost loop does the actual value is set to 0, as ctbl = 0n for all   − Dij )cj of equation (16). computation of the sum j=1 (Sij Listing 5: Joint specification of constraints (16) and (17)

constraint_5 (M ,N ,T , MM ,S ,D , X ) : ( for (L ,1 , T ) , param (S ,D ,N , MM , X ) , fromto (0 , S0 , BL , M ) do BL is MM [ L ]+ S0 , AL is 1+ S0 , truck (L ,_ , Cmax ) , ( for (I , AL , BL ) , param ( BL ,N , Cmax ,S ,D , X ) , fromto (0 , C0 , C1 ,0) do ( for (J ,1 , N ) , param (I ,S , D ) , fromto ( C0 , S0 , S1 , C1 ) do order (J ,_ ,_ , CJ ) , S1 #= S0 +( S [I , J ] - D [I , J ])* CJ ), ( I < BL -> C1 #= < Cmax , X [ I ] #\= X [ I +1] ; true ) ) ).

The integer equality and inequality constraints are represented using special operators, differently than the normal Prolog operators. For example the ≤, = and = constraints are represented in Listings 3, 4 and 5 using operators #=
3.2

Results and Discussion

We experimented with this approach using the 64-bit version of ECLiPSe 6.1 224 on an x64 based PC with Intel(R) Core(TM) i7-5500U CPU at 2.40GHz running Windows 10. We con1 The

8

complete ECLiPSe model can be downloaded from http://software.ucv.ro/~cbadica/iccs2017.zip.

965

966

Declarative Solution of Vehicle Amelia Routing Problem B˘ adic˘ a, B˘ adic˘ a, Leon, and Luncean Bădică et al. / Procedia Computer Science 108C (2017) 958–967

sidered 3 simple data sets described in Table 12 . Even these small values of the parameters determine a quite large size of the search space. For example, for data set 1 with n = 5 and k = 6 2n this size is m=k 2mn × 2mn × mk > 236 for each m = 6 . . . 10 and m1 , m2 ≥ 1, m1 + m2 = m ! # 1 2 3

n = # orders 5 5 5

k = # cities 6 7 7

t = # trucks 2 1 2

m ∈ k . . . 2n 6 . . . 10 7 . . . 10 7 . . . 10

# solutions 1366 8346 18812

cost 821 542 664

# opt. solutions 2 1 1

Table 1: Data sets. The experiment was focused on exploring the set of feasible solutions satisfying the constraints, for each of the data sets (i.e. we considered a FS-type problem according to [9]). We used a complete search of solutions with exactly t trucks. We experimented with some of the search options Select and Choice available in the built-in ECLiPSe predicate search/6 [3]. Select denotes the variable selection method, while Choice denotes the value-to-variable assignment method during the search process. Table 2 presents the values used in our experiments, together with the user cpu time recorded for running the search. The value of the user cpu time was retrieved with the help of the statistics/2 ECLiPSe built-in predicate, using the goal statistics(runtime,[_,T]). For example, the search query that we used for case 4 from Table 2 is search([](X,S,D),0,largest,indomain,complete,[backtrack(B)]). This replaced the standard search using the labeling/1 goal from Listing 2. #

Select

Choice

1 2 3 4 5 6

first fail input order largest most constrained most constrained occurrence

indomain indomain indomain indomain indomain max indomain

# 1 10304 13059 16916 7367 6451 6675

backtracks 2 3 35895 19050 51054 18926 50897 21997 37340 13767 36312 13383 28735 13403

runtime [ms] 1 2 3 22218 19031 24469 45562 47328 44750 54235 66766 65032 8406 14797 9484 8625 15172 9765 8203 16375 11000

Table 2: Experimental results. We also recorded the number of backtracks required to explore the space of feasible solutions, using option backtrack(B) of the predicate search/6. We counted all the backtracks for each search tree that was generated by each pair of feasible values of variables M and M M . Table 2 shows that the best results in terms of lower number of backtracks and execution time were obtained for the most constrained and occurrence variable selection methods. On the other hand it seems that for this particular problem and test data, the variable-to-value assignment method does not influence too much the result.

4

Conclusions

In this paper we formulated freight brokering as a special vehicle routing with pickup and delivery problem. We proposed a new set partitioning model by defining vehicle routes on the graph of cities, rather than on the graph of customer orders, as in standard set partitioning formulations. This approach can be useful when a large number of customer orders sharing a significantly lower number of pickup and delivery points must be scheduled. We developed a 2 The

cost is the total distance traveled by trucks.

9



Amelia Bădică et al. / Procedia Computer Science B˘ 108C (2017) 958–967 Declarative Solution of Vehicle Routing Problem adic˘ a, B˘ adic˘ a, Leon, and Luncean

declarative representation and solution of the model using ECLiPSe CLP system. We plan to extend it for representing and computing optimal solutions. We are also interested in mapping our general model to other declarative representations supported by ASP and SAT technologies.

References [1] Nicolas Barnier and Pascal Brisset. Optimization by hybridization of a genetic algorithm with constraint satisfaction techniques. In Proc. of IEEE International Conference on Evolutionary Computation 1998, IEEE WCCI, pages 645–649. IEEE, 1998. [2] Agostino Dovier, Andrea Formisano, and Enrico Pontelli. A comparison of clp(fd) and asp solutions to np-complete problems. In Maurizio Gabbrielli and Gopal Gupta, editors, Proceedings of the 21st International Conference on Logic Programming, ICLP 2005, volume 3668 of Lecture Notes in Computer Science, pages 67–82. Springer Berlin Heidelberg, Berlin, Heidelberg, 2005. [3] ECLiPSe. The eclipse constraint programming system. Accessed in January 2017. [4] Marco Gavanelli and Francesca Rossi. Constraint logic programming. In Agostino Dovier and Enrico Pontelli, editors, A 25-Year Perspective on Logic Programming: Achievements of the Italian Association for Logic Programming, GULP, volume 6125 of Lecture Notes in Computer Science, pages 64–86. Springer Berlin Heidelberg, Berlin, Heidelberg, 2010. [5] Filippos Gouidis, Theodore Patkos, Giorgos Flouris, and Dimitris Plexousakis. Declarative reasoning approaches for agent coordination. In Aristidis Likas, Konstantinos Blekas, and Dimitris Kalles, editors, Artificial Intelligence: Methods and Applications, volume 8445 of Lecture Notes in Computer Science, pages 489–503. Springer International Publishing, 2014. [6] Steffen H¨ olldobler, Norbert Manthey, and Peter Steinke. A compact encoding of pseudo-boolean constraints into sat. In Birte Glimm and Antonio Kr¨ uger, editors, KI 2012: Advances in Artificial Intelligence: 35th Annual German Conference on AI, Saarbr¨ ucken, Germany, September 24-27, 2012. Proceedings, volume 7526 of Lecture Notes in Computer Science, pages 107–118. Springer Berlin Heidelberg, Berlin, Heidelberg, 2012. [7] Florin Leon and Costin B˘ adic˘ a. A freight brokering system architecture based on web services and agents. In Theodor Borangiu, Monica Dragoicea, and Henriqueta N´ ovoa, editors, Exploring Services Science: 7th International Conference, IESS 2016, Bucharest, Romania, May 25-27, 2016, Proceedings, volume 247 of Lecture Notes in Business Information Processing, pages 537– 546. Springer International Publishing, 2016. [8] Lucian Luncean, Costin B˘ adic˘ a, and Amelia B˘ adic˘ a. Agent-based system for brokering of logistics services – initial report. In Ngoc Thanh Nguyen, Boonwat Attachoo, Bogdan Trawi´ nski, and Kulwadee Somboonviwat, editors, Intelligent Information and Database Systems: 6th Asian Conference, ACIIDS 2014, Bangkok, Thailand, April 7-9, 2014, Proceedings, Part II, volume 8398 of Lecture Notes in Computer Science, pages 485–494. Springer International Publishing, 2014. [9] Antoni Niederli´ nski. A Gentle Guide to Constraint Logic Programming via ECLiPSe. Jacek Skalmierski Computer Studio, Gliwice, third edition, 2014. [10] Sophie N. Parragh, Karl F. Doerner, and Richard F. Hartl. A survey on pickup and delivery problems. part ii: Transportation between pickup and delivery locations. Journal f¨ ur Betriebswirtschaft, 58(2):81–117, 2008. [11] Joachim Schimpf. Logical loops. In Peter J. Stuckey, editor, Logic Programming: 18th International Conference, ICLP 2002 Copenhagen, Denmark, July 29 – August 1, 2002 Proceedings, volume 2401 of Lecture Notes in Computer Science, pages 224–238. Springer Berlin Heidelberg, Berlin, Heidelberg, 2002. [12] Joachim Schimpf and Kish Shen. Eclipse-from lp to clp. Theory Pract. Log. Program., 12(1-2):127– 156, 2012. [13] Wayne L. Winston. Operations Research: Applications and Algorithms (4th edition). Brooks/Cole – Thomson Learning, 2004.

10

967