Learning User Preferences in Matching for Ridesharing

Mojtaba Montazery and Nic Wilson

Insight Centre for Data Analytics, School of Computer Science and IT, University College Cork, Cork, Ireland

Keywords:

Dynamic Ridesharing, Preference Learning.

Abstract:

Sharing car journeys can be very beneﬁcial, since it can save travel costs, as well as reducing trafﬁc congestion

and pollution. The process of matching riders and drivers automatically at short notice, is referred to as

dynamic ridesharing, which has attracted a lot of attention in recent years. In this paper, amongst the wide

range of challenges in dynamic ridesharing, we consider the problem of ride-matching. While existing studies

mainly consider ﬁxed assignments of participants in the matching process, our main contribution is focused

on the learning of the user preferences regarding the desirability of a choice of matching; this could then form

an important component of a system that can generate robust matchings that maintain high user satisfaction,

thus encouraging repeat usage of the system. An SVM inspired method is exploited which is able to learn a

scoring function from a set of preferences; this function measures the predicted satisfaction degree of the user

regarding speciﬁc matches. To the best of our knowledge, we are the ﬁrst to present a model that is able to

implicitly learn individual preferences of participants. Our experimental results, which are conducted on a real

ridesharing data set, show the effectiveness of our approach.

1 INTRODUCTION

Ridesharing (also carpooling and lift-sharing) is a

mode of transportation in which individual travellers

share a vehicle for a trip. Increasing the number of

travellers per vehicle trip by effective usage of spare

car seats may of course enhance the efﬁciency of pri-

vate transportation, and contribute to reducing trafﬁc

congestion, fuel consumption, and pollution. More-

over, ridesharing allows users to split travel costs such

as fuel, toll, and parking fees with other individuals

who have similar itineraries and time schedules. Con-

ceptually, ridesharing is a system that can combine the

ﬂexibility and speed of private cars with the reduced

cost of ﬁxed-line systems such as buses or subways

(Furuhata et al., 2013; Agatz et al., 2011).

Ridesharing is quite an old concept; it was ﬁrst

used in USA during World War II to conserve re-

sources for the war. It reappeared as a result of the

oil crisis in 1970s which led to the emergence of the

ﬁrst ridesharing algorithms. Nevertheless, rideshar-

ing usage declined drastically between the 1970s and

the 2000s due to the decrease in the price of fuel and

vehicle ownership cost (Chan and Shaheen, 2012).

Furthermore, there are some challenges that have

inhibited wide adoption of ridesharing. A few of the

most important of those are listed as follows:

Riding with Strangers. Surveys suggest little inter-

est in sharing a ride with strangers because of per-

sonal safety concerns. This phenomenon is called

Stranger Danger and could be alleviated by incor-

poration of social networks (Amey et al., 2011;

Furuhata et al., 2013). (Chaube et al., 2010) con-

ducted a survey among students of a university

which shows that while only 7% of participants

would accept rides from a stranger, 98% and 69%

would accept rides from a friend and the friend of

a friend, respectively.

Reliability of Service. One of the largest behavioral

challenges is the perception of low reliability in

ridesharing arrangements; the parties may not

necessarily follow through on the agreed-upon

ride. For instance, if the driver has an unexpected

appointment or emergency, the passenger may be

left with no ridesharing option; or, from the other

side, drivers might be required to wait because of

a passenger being late (Amey et al., 2011).

Schedule Flexibility. The lack of schedule ﬂexibility

has been one of the longest running challenges in

ridesharing arrangements. Drivers and passengers

often agree to relatively ﬁxed schedules and meet-

ing locations, not allowing much ﬂexibility. It is

interesting to note that increased ﬂexibility and in-

creased reliability in ridesharing arrangements are

often conﬂicting objectives (Amey et al., 2011).

Montazery, M. and Wilson, N.

Learning User Preferences in Matching for Ridesharing.

DOI: 10.5220/0005694700630073

In Proceedings of the 8th International Conference on Agents and Artiﬁcial Intelligence (ICAART 2016) - Volume 2, pages 63-73

ISBN: 978-989-758-172-4

Copyright

c

2016 by SCITEPRESS – Science and Technology Publications, Lda. All rights reserved

63

Ride Matching. Optimally matching riders and

drivers –or at least getting a good match–is among

most important challenges to be overcome. This

can lead to a complicated optimization problem

due to the large number of factors involved in the

objective function. We will discuss this aspect of

ridesharing further in Section 2.

Despite the above barriers to ridesharing, the de-

mand for ridesharing services has increased again

sharply in recent years, generating much interest

along with media coverage (Saranow, 2006). This

boost in ridesharing is mainly associated with a rel-

atively new concept in ridesharing, dynamic or real-

time ridesharing. Dynamic ridesharing refers to a sys-

tem which supports an automatic ride-matching pro-

cess between participants at short notice or even en-

route (Agatz et al., 2012).

Technological advances, both hardware and soft-

ware, are key enablers for dynamic ridesharing. The

ﬁrst inﬂuential fact is that the smartphones are becom-

ing increasingly popular (Emarketer, 2014; Smith,

2015). As the ﬁrst impact of smartphones on

ridesharing, they provide an infrastructure on which

a ridesharing application can run, replacing the old-

fashioned, sometimes not so convenient, approaches

such as phone or website. More importantly, smart-

phones are usually equipped with helpful communi-

cation capabilities, including global positioning sys-

tem (GPS) (Zickuhr, 2012) and network connectivity

(Duggan and Smith, 2013).

Dynamic ridesharing by its nature is able to ease

some aspects of existing challenges in traditional

ridesharing. For example, tracking participants by

means of GPS could mitigate safety concerns or in-

crease the reliability. In terms of ﬂexibility, since dy-

namic ridesharing does not necessarily require long-

term commitment, users have the option to request a

trip sharing day-by-day or whenever they are pretty

sure about their itinerary.

Even though the above advancement in technol-

ogy could be beneﬁcially available, ridesharing is still

in short supply. In this study, we focus on the ride-

matching problem which is central to the concept.

However, we are mindful of the fact that there are a

number of other challenges should be dealt to accom-

plish the ultimate success of ridesharing.

The rest of the paper is structured as follows. In

Section 2, we model automated ride-matching prob-

lem and explain how user preferences could be con-

sidered in the matching process. In Section 3, a

method to learn user preferences is described in de-

tail. Section 4 evaluates the presented approach on a

real ridesharing database. Finally, in Section 5, we

summarize the main remarks and discuss some direc-

tions for future research.

2 AUTOMATED

RIDE-MATCHING

The essential element of dynamic ridesharing is the

automation of the trip matching process, which al-

lows trips to be arranged at short notice with mini-

mal effort from participants. This means that a sys-

tem helps riders and drivers to ﬁnd suitable matches

and facilitates the communication between partici-

pants (Hwang et al., 2006; Agatz et al., 2012).

In order to model the matching problem, two dis-

joint types of ridesharing request are considered: a

set of requests in which the owner of the request

are drivers (D), and requests created by riders (R).

Hence, all trip requests could be represented by the set

S = R ∪D. Then, ridesharing requests are represented

as a bipartite graph G = (D,R,E), with E denoting the

edges of the graph. This setting is extendable for the

case when some participants are ﬂexible with being

driver or rider.

This graph becomes a weighted graph by assign-

ing a weight c

i j

to the edge (S

i

,S

j

), where S

i

,S

j

∈ S .

Generally speaking, c

i j

quantiﬁes how much is gained

by matching S

i

and S

j

. This weight could be a compo-

sition of an assortment of factors, related to the overall

system, or to individual travellers.

For ﬁnding optimal matchings, one approach pop-

ular in the literature is solving an optimization prob-

lem in which the sum of the beneﬁts from proposed

matching should be maximized (Agatz et al., 2011).

To do this, a binary decision variable x

i j

is introduced

that would be 1 when the match (S

i

,S

j

) is proposed,

and 0 if not. Then, the objective function to be max-

imized is

∑

i, j

x

i j

c

i j

. After running the solver, a ﬁxed

schedule is proposed to users as the optimal solution.

However, this approach neglects a crucial require-

ment of a practical system, that is, getting users con-

ﬁrmation before ﬁxing a ride-share for them. Al-

though earlier we emphasised the concept of automa-

tion in ride-matching which attempts to minimize

users’ efforts, we believe that it couldn’t be fully au-

tomatic. In fact, it is hard in practice to convince users

to share their ride with somebody without their ﬁnal

agreement.

For this reason, in this study, we suggest a novel

attitude towards ride-matching problems, by looking

at the problem as a recommendation system rather

than an optimization problem. In this setting, the sys-

tem just recommends a set of best possible match-

ings to each individual with respect to the weights c

i j

.

Note that not only does c

i j

take into account partici-

ICAART 2016 - 8th International Conference on Agents and Artiﬁcial Intelligence

64

pants desires, but also it could incorporate the overall

system beneﬁts.

In terms of the system’s beneﬁts–which ultimately

could result in less pollution, trafﬁc congestion etc.-

– two measures are often mentioned in the related

studies; the saved travel distance (d

i j

obtained from

the match (S

i

,S

j

)) and the saved travel time (t

i j

) (Fu-

ruhata et al., 2013; Agatz et al., 2012).

The second aspect of c

i j

is how much the two indi-

viduals, who involved in the matching (S

i

and S

j

), are

happy with that matching. While positional and tem-

poral elements of a ride sharing usually play a more

important role in forming users’ satisfaction degree,

users’ social preferences such as the other party’s

reputation and gender, smoking habit and so forth

are also suggested as a relevant component (Ghoseiri

et al., 2011).

The common strategy for ﬁnding arcs’ weights

(c

i j

) is making a composition of the system’s bene-

ﬁts (e.g., c

i j

= d

i j

+ t

i j

) and posing some constraints

which expresses users’ limitations (Herbawi and We-

ber, 2012; Agatz et al., 2011). Nevertheless, there are

two main shortcomings have not been fully addressed

by adoption of this strategy:

Only Hard Constraints. The fact is that users might

sacriﬁce some of their desires in favour of another

ones. For instance, a rider who likes smoking

in the car may decide to share his trip in a non-

smoking vehicle due to other favourable condi-

tions. Therefore, having soft constraints instead

of hard ones may often be more plausible. Posing

soft constraints could be rephrased as considering

users’ preferences, the term that is mainly used in

this paper.

Eliciting Complicated Parameters. In order to set

constraints, there is a prerequisite to ask users to

specify several parameters explicitly; such as ear-

liest possible departure time, latest possible ar-

rival time and maximum excess travel time (Bal-

dacci et al., 2004; Agatz et al., 2011; Amey et al.,

2011). However, elicitation of such parameters

for every trip is quite impractical in real world sit-

uations. As an example, users can simply state

their departure time, but ﬁnding how much they

are ﬂexible with that time is not a straightforward

task. Moreover, some participants may be hes-

itant or unwilling to disclose certain preferences

for privacy reasons.

Our solution for attempting to overcome the afore-

mentioned issues is learning each user’s preferences

based on his (or her) past ridesharing records. For in-

stance, we can learn from his previous choices that

a particular user is normally more ﬂexible with time

than location. We will discuss more about this subject

Table 1: The scenario described in Example 1 is summa-

rized here. The user’s responses are Acceptance(A), Can-

cellation(C), Ignoring(I) and Rejection(R).

Day 1 Day 2 Day 3 (Today)

(S

2

,R) (S

5

,R) S

8

(w

1,8

=?)

(S

3

,A) (S

6

,C) S

9

(w

1,9

=?)

(S

4

,I) (S

7

,A)

in Section 2.1. As a result of learning weights, be-

sides modeling soft constraints in form of users’ pref-

erences, there is no need to directly ask those cumber-

some parameters from participants anymore.

Thus, an arc’s weight could be the combination

of the system’s beneﬁts and those learned weights.

To mathematically illustrate, assume c

i j

= (w

i j

· w

ji

) ·

(d

i j

+ t

i j

) where w

i j

indicates how much sharing the

ride with the user j is favourable for the user i, and the

converse for w

ji

. The weights w

i j

and w

ji

are learned

from the previous records of the users i and j, respec-

tively.

2.1 Learning Weights

In this section, the mechanism of learning users’ pref-

erences from the previous ridesharing records will be

characterized. To give an intuitive sense, we start with

an example.

Example 1. Assume there is a user who has a daily

trip at a speciﬁc time (e.g., every day at 8 : 30 from

the location A to B). This trip request is denoted by

S

1

.

On Day 1, the system recommends three matching

opportunities, namely S

2

, S

3

and S

4

. The user rejects

S

2

, accepts S

3

and leaves S

4

without any response. Ig-

noring of a case may potentially mean that the user

had been tentative about it.

On the second day, two recommendations, S

5

and

S

6

, are suggested to the user. S

5

is rejected and S

6

is

accepted. While the user was waiting for the response

of the other party in S

6

, he receives another sugges-

tion, S

7

; then, the user cancels his previous offer (to

S

6

) and accepts S

7

.

On the third day, the system has found two fea-

sible matches which are S

8

and S

9

. The goal is to

evaluate how much these two opportunities are desir-

able for the user. Using the notation of the previous

section, we would like to ﬁnd w

1,8

and w

1,9

which are

ﬁnally incorporated in the calculation of c

1,8

and c

1,9

,

respectively. Table 1 summarizes this example.

At ﬁrst glance, the problem might seem to be

a classiﬁcation problem because the supervision (la-

bels) is in the form of classes (i.e., Acceptance, Rejec-

Learning User Preferences in Matching for Ridesharing

65

tion etc.). However, a closer look suggests that learn-

ing a classiﬁer is not a correct choice. The ﬁrst reason

is that there is a logical order between classes in the

current case (e.g., Acceptance has a highest value and

Rejection the lowest value), whereas classiﬁcation is

often applied when there is no ordering between class

labels, such as classifying fruits into three categories,

apple, pear and orange. Secondly, a classiﬁer will

predict a class label whereas here, a scalar value is

required.

If each class label is replaced by an appropriate

number which keeps the natural ordering, the prob-

lem could be considered as a regression problem. For

instance, the number 1 might be assigned for Accep-

tance, 0.66 for Cancellation, 0.33 for Ignoring and 0

for Rejection.

In spite of the fact that learning a regressor has

none of those defects mentioned about classiﬁcation,

we believe that it still suffers from the following

ﬂaws:

• The ﬁrst point is that the user’s response to a rec-

ommended opportunity not only depends on the

properties of that particular case, but also depends

on other rival opportunities. Taking Example 1 to

illustrate, it couldn’t be said that if S

3

existed in

the suggestion list on the day 2, it would certainly

be accepted again, because the user accepted it in

presence of S

2

and S

4

which does not guarantee

its acceptance when S

6

and S

7

are available.

• Two class labels do not necessarily have the same

desirability distance for all instances. Consider

Example 1; assigning value numbers to classes as

described above suggests that the difference be-

tween S

2

and S

3

from the ﬁrst day, and S

5

and S

7

from the second day are both 1. However, the only

thing that is known is that the user preferred S

3

to

S

2

and S

7

to S

5

, not the extent of the difference.

To address the above issues, we suggest consid-

ering the supervision in the form of qualitative pref-

erences. This means that instead of assigning value

numbers, sets of preferences among alternatives are

derived from the user’s choices. The following pref-

erences set could be formed for Example 1:

λ = {(S

3

S

4

),(S

4

S

2

),(S

7

S

6

),(S

6

S

5

)}.

In the next section, a model will be proposed to

learn a scoring function by making use of this kind of

preferences set.

3 LEARNING MODEL: SVPL

3.1 Basic Formulation

As described above, the primary capability of the

method developing in this section should be learn-

ing a scoring function from a set of preferences, ex-

pressed between several alternatives (i.e., preferences

between suggested ridesharing trips that are derived

from the user’s feedback). This scoring function can

generate a value number for each alternative (i.e.,

ridesharing trip opportunity), measuring the expected

desirability degree of that alternative for the user.

Mathematically speaking, the set of alternatives

is expressed as X = {X

k

|k ∈ {1, .. ., m}, X

k

∈ R

d

}

in which d is the dimension of the features vector

(with each feature representing a different property

of the trip). We formulate the preferences set as

λ = {(X

i

Y

i

)|i ∈ {1,. .. ,n}, X

i

,Y

i

∈ X }. Then, the

goal is ﬁnding a function f (X ) : R

d

→ R which maps

a features vector to a scalar value and is in agreement

with the preferences set λ, i.e., if X

i

Y

i

is in λ then

we aim to have f (X

i

) > f (Y

i

). In order to achieve this

goal, we developed a derivation of conventional SVM

which eventually turns out to be similar to the ap-

proach proposed in (Joachims, 2002) as SVMRank.

In the rest of this section, the notation λ

i

(corre-

sponding to (X

i

Y

i

)) represents the preference point

in R

d

, given by λ

i

= X

i

−Y

i

. We say that preferences

points are consistent if there is a scoring function f

satisﬁes the following condition:

f (λ

i

) > 0 ∀i. (1)

This condition comes from the fact that for all pref-

erences points, the condition f (X

i

) > f (Y

i

) should be

true. Here, in Section 3.1, we assume that all prefer-

ences points are consistent, meaning there is at least

one scoring function able to satisfy Eq. (1). In Section

3.2, we consider the inconsistent case.

Another assumption being made in this section is

that the scoring function is a linear function. So, there

is a vector ω with d components such that

f (X) = ω · X. (2)

We will consider the case of a non-linear scoring

function in Section 3.3.

With respect to these two assumptions, it can be

said that if h is the hyperplane f (X) = 0 (which is a

line in d = 2 case), then the hyperplane should include

the origin, and all preferences points should be in the

associated positive open half-space, given by h. This

condition is mathematically written as:

ω · λ

i

> 0 ∀i, (3)

ICAART 2016 - 8th International Conference on Agents and Artiﬁcial Intelligence

66

x

y

h

ω

1

h

ω

2

b

ω

2

b

ω

1

ω

1

ω

2

Figure 1: Two samples of plausible hyperplanes (h

ω

1

and

h

ω

2

) and their associated normal vectors (ω

1

and ω

2

) for a

set of consistent preferences points are illustrated. b

ω

1

and

b

ω

2

are the margins of h

ω

1

and h

ω

2

, respectively.

where ω is the normal vector to the hyperplane h. Two

examples of plausible hyperplanes (h

ω

1

and h

ω

2

) for

a consistent set of preferences points are illustrated in

Figure 1.

The margin of a hyperplane, denoted by b, is de-

ﬁned as the distance from the hyperplane to the clos-

est preference point; for the hyperplane h

ω

, it could

be found by:

b

ω

=

min

i

ω · λ

i

kωk

, (4)

where kωk is the Euclidean norm of ω (kωk

2

= ω ·ω).

Based on the principal idea in SVM (Burges,

1998), among all hyperplanes that can meet the condi-

tion stated in Equation (3), we look for the hyperplane

that produces the largest margin, since it seems rea-

sonable that for the preferences points, the maximum

marginal space from the condition boundary is desir-

able. Thus, in order to ﬁnd the optimal ω (say ω

∗

) and

consequently f (X ), we need to solve an optimization

problem as follows:

ω

∗

= arg max

ω

min

i

ω · λ

i

kωk

(5a)

subject to

ω · λ

i

> 0 ∀i. (5b)

Let a

ω

= min

i

ω · λ

i

where according to Eq. (5b)

a

ω

should be a positive number. Then we have:

ω

∗

= arg max

ω

a

ω

kωk

(6a)

subject to

ω · λ

i

≥ a

ω

> 0 ∀i. (6b)

Let ω

0

=

ω

a

ω

, where of course ω

0

like ω is a nor-

mal vector to the hyperplane h

ω

, because the positive

scalar value a

ω

just affects the magnitude of the vec-

tor not its direction. As a result, the problem could be

simpliﬁed by replacement of ω with the term a

ω

ω

0

.

That means the objective function (Eq. 6a) will be:

a

ω

kωk

=

a

ω

a

ω

kω

0

k

=

1

kω

0

k

and the constraint (Eq. 6b) is modiﬁed like this:

ω · λ

i

≥ a

ω

a

ω

ω

0

· λ

i

≥ a

ω

ω

0

· λ

i

≥ 1

Hence, the problem is reformulated as the following:

ω

0

∗

= arg max

ω

0

1

kω

0

k

(7a)

subject to

ω

0

· λ

i

≥ 1 ∀i. (7b)

Note that ω

0

∗

found from Eq. (7) is not necessar-

ily equivalent with ω

∗

found from Eq. (6), but as

described above, both give an equivalent hyperplane

(h

ω

≡ h

ω

0

). So, without loss of generality, we can use

the symbol ω instead of ω

0

in Eq. (7).

To have a more standard form, the arrangement of

the problem is reformulated as a Minimization prob-

lem in this manner:

ω

∗

= arg min

ω

1

2

kωk

2

(8a)

subject to

1 − ω.λ

i

≤ 0 ∀i (8b)

Now, this is a convex quadratic programming

problem, because the objective function is itself con-

vex, and those points which satisfy the constraints are

also from a convex set (a set of linear constraints de-

ﬁne a convex set).

In Section 3.3, more explanation will be given

as to why we are interested in the form of problem

formulation (both objective function and constraints)

in which preferences points only appear in the form

of pairwise dot products. To fulﬁll this demand, we

switch to the Lagrangian Dual Problem.

For our problem, the Lagrangian function which

is basically obtained by augmenting the objective

function with a weighted sum of the constraint func-

tions, is like this:

L(ω, µ) =

1

2

kωk

2

+

n

∑

i=1

µ

i

(1 − ω.λ

i

) (9)

where µ

i

is referred as the Lagrange multiplier asso-

ciated with the i

th

inequality constraint 1 − ω.λ

i

≤ 0

(Boyd and Vandenberghe, 2004, Chapter 5).

The optimization problem stated in Eq. (8) is

called the primal form; where the Lagrangian dual

form is formulated in this fashion:

(ω

∗

,µ

∗

) = arg max

µ

inf

ω

L(ω, µ) (10a)

subject to

µ

i

≥ 0 ∀i. (10b)

Learning User Preferences in Matching for Ridesharing

67

Because the primal form is convex and Slater’s

condition holds, we say the strong duality holds for

our problem (Boyd and Vandenberghe, 2004, Sec.

5.2.3). This means that the optimal value for the dual

problem equals the optimal value for the primal form.

As a consequence, solving the Lagrangian dual form

(Eq. 10) is equivalent to solving the primal form of

the problem (Eq. 8).

As stated, strong duality is obtained for our prob-

lem, and also the objective function is differentiable.

Regarding these two criteria, an optimal value must

satisfy the Karush Kuhn Tucker (KKT) conditions

(Boyd and Vandenberghe, 2004, Sec. 5.5.3). Here,

we just exploit the stationary condition of KKT which

states:

∂L

∂ω

= 0 i.e., ω =

n

∑

i=1

µ

i

λ

i

(11)

We substitute equality constraint (11) into Eq. (9)

which leads to a remodeled Eq. (10), in the form that

we are interested in:

µ

∗

= arg max

µ

L =

n

∑

i=1

µ

i

−

1

2

n

∑

i=1

n

∑

j=1

µ

i

µ

j

λ

i

· λ

j

(12a)

subject to

µ

i

≥ 0 ∀i. (12b)

At this stage, we have just a simple positivity

condition on µ

i

which is more manageable than Eq.

(8b) and more importantly, the preferences points are

shown just in the form of dot products (λ

i

· λ

j

).

Solving this new form of the problem gives opti-

mal values for the Lagrange multipliers (µ

∗

); we then

can use Equation (11) to ﬁnd ω

∗

as well.

3.2 Handling Inconsistencies

So far, we assumed that there exists at least one hy-

perplane such that all preferences points are placed

in the positive open half-space of it. However, it is

plausible that in many practical cases this assumption

may result in ﬁnding no feasible solution. To handle

inconsistencies, we develop the basic model by refor-

mulating the initial constraint (8b) such that it could

be violated with an appropriate amount of cost.

For this purpose, the constraint (8b) is rewritten as

1 − ω.λ

i

≤ ξ

i

where ξ

i

represents the cost of violat-

ing the i

th

constraint and obviously should be non-

negative (ξ

i

≥ 0). Then, the objective function is

augmented by the term C

n

∑

i=1

ξ

i

to reveal the effect of

costs, where C is a constant parameter to be chosen

by the user. The parameter C scales the impact of in-

consistent points; a larger C corresponds to assigning

a higher penalty to errors. Thus, the primal form of

the problem becomes the following:

ω

∗

= arg min

ω,ξ

i

1

2

kωk

2

+C

n

∑

i=1

ξ

i

(13a)

subject to

1 − ω.λ

i

− ξ

i

≤ 0 ∀i, (13b)

ξ

i

≥ 0 ∀i. (13c)

This optimization problem (Eq. 13) is equivalent

to Optimization Problem 1 (Ranking SVM) proposed

in (Joachims, 2002).

Because we have a new set of constraints (ξ

i

≥

0), a new set of positive Lagrange multipliers α

i

(i =

1,...,n) are introduced. The Lagrangian changes as

follows:

L =

1

2

kωk

2

+C

n

∑

i=1

ξ

i

+

n

∑

i=1

µ

i

(1−ω.λ

i

−ξ

i

)−

n

∑

i=1

α

i

ξ

i

(14)

The stationary KKT condition entails the new equal-

ity constraints:

∂L

∂ξ

i

= 0 i.e., α

i

= C − µ

i

∀i. (15)

By substituting C − µ

i

for α

i

in Equations (14), the

Lagrangian dual form of the problem becomes:

(ω

∗

,µ

∗

) = arg max

µ

inf

ω

L =

1

2

kωk

2

+

n

∑

i=1

µ

i

(1 − ω.λ

i

)

(16a)

subject to

µ

i

≥ 0 ∀i, (16b)

α

i

≥ 0 i.e., C − µ

i

≥ 0 ∀i. (16c)

As in the previous section, replacing ω with

n

∑

i=1

µ

i

λ

i

gives us the simpler form of the problem:

µ

∗

= arg max

µ

i

L =

n

∑

i=1

µ

i

−

1

2

n

∑

i=1

n

∑

j=1

µ

i

µ

j

λ

i

· λ

j

(17a)

subject to

0 ≤ µ

i

≤ C ∀i. (17b)

Since neither the ξ

i

nor its associated Lagrange

multiplier (α

i

) appear in the objective function, this

format of the problem is very similar to the one with-

out introducing costs (Eq. 12), except µ

i

is con-

strained by the upper bound value of C.

ICAART 2016 - 8th International Conference on Agents and Artiﬁcial Intelligence

68

3.3 Non-linear Scoring Function

Remember that we assumed that the scoring function

(with its associated hyperplane) is a linear function.

Conversely, a non-linear scoring function might be a

better choice in some real-world applications. To deal

with this matter, in this section, the model is devel-

oped further to cover the non-linear case as well.

The Kernel function concept (Aizerman et al.,

1964) is a widely-used trick for pattern recognition

problems which can be also exploited for our case.

The idea comes from this fact that a set of non

linearly-representable data could be linearly managed

if they mapped to a higher dimension. To do the map-

ping, we assume a function Φ of the form:

Φ : R

d

→ H , (18)

where H denotes a higher dimensional space than d-

dimension. If all preferences points are mapped into

H by making use of Φ, the Lagrangian function will

be:

L =

n

∑

i=1

µ

i

−

1

2

n

∑

i=1

n

∑

j=1

µ

i

µ

j

Φ(λ

i

) · Φ(λ

j

). (19)

A deeper look into the process of computing L

(Eq. 19) reveals that, even though L is still a scalar

value, the optimization problem performs a dot prod-

uct operation (Φ(λ

i

) · Φ(λ

j

)) in the high dimensional

space which is computationally expensive.

Principally, a kernel is a function which operates

in the lower dimension (K(X,Y ) : R

d

× R

d

→ R),

but yields an identical result to the dot product of

mapped vectors in the higher dimension (K(X,Y ) =

Φ(X) · Φ(Y )).

Due to the above property of the kernel function,

the term Φ(λ

i

) · Φ(λ

j

) can be simply replaced in Eq.

(19) with an appropriate kernel. The great advantage

of such a replacement is that the complexity of the

optimization problem remains only dependent on the

dimensionality of d (the preferences points space) and

not of H .

Note that this simpliﬁcation happens without even

explicitly stating the Φ function because the problem

has been formulated in terms of dot product of points,

the property that we insisted to have in the previous

sections. So, the problem is rewritten as follows:

µ

∗

= arg max

µ

L =

n

∑

i=1

µ

i

−

1

2

n

∑

i=1

n

∑

j=1

µ

i

µ

j

K(λ

i

,λ

j

)

(20a)

subject to

0 ≤ µ

i

≤ C ∀i (20b)

There still remains one point that should be con-

sidered. Solving this optimization problem only gives

µ

∗

where after all, ω

∗

is required. The Eq. (11) cannot

be used to attain ω anymore, because after the map-

ping, ω will live in H ; that is:

ω =

n

∑

i=1

µ

i

Φ(λ

i

) (21)

However, recall that ﬁnding ω

∗

is just an interme-

diate goal to achieve the scoring function. Therefore,

referring back to the scoring function in Equation (2)

and using Equation (21) for eliminating ω, brings the

following form of the scoring function:

f (X) = ω · Φ(X)

= (

n

∑

i=1

µ

i

Φ(λ

i

)) · Φ(X)

=

n

∑

i=1

µ

i

(Φ(λ

i

) · Φ(X))

Importantly, this result contains points only in the

format of dot products; where incorporating a kernel

function gives:

f (X) =

n

∑

i=1

µ

i

K(λ

i

,X) (22)

Equations (20) and (22) form the method, which

is referred to as SVPL (Support Vector Preferences

Learner) in our experiments. As seen, the input pa-

rameters should be chosen in SVPL are C and the ker-

nel function’s parameters if it has any.

4 EXPERIMENTS

4.1 Data Repository

The experiments make use of a subset of a year’s

worth of real ridesharing records (from Apr 2014 to

Apr 2015), provided by Carma

1

(formerly Avego).

Carma is a software company currently offering a dy-

namic ride-share application for internet-enabled mo-

bile phones. In addition to their App, any individual

can create his own App, powered by the Carma’s free

API which uses Carma’s live data.

The process of Carma’s application is brieﬂy ex-

plained so as to facilitate the understanding of the

structure of the provided database. Users can request

a ridesharing as a driver, rider or both (ﬂexible to be

rider or driver). Once a ridesharing request is cre-

ated, the user could ask the system to ﬁnd appropri-

ate matching opportunities. Then, a suggestion list

is shown on the user’s screen. For each suggested

1

https://carmacarpool.com/

Learning User Preferences in Matching for Ridesharing

69

item, the user can accept, reject or just leave it with

no response. Note that accepting an opportunity at

this stage does not mean the ridesharing will certainly

happen, because it also needs the conﬁrmation of the

other party; so, it is observed in the database that for

a single trip a user may have several accepted items.

While the system is waiting to get the second conﬁr-

mation, the user can cancel an initially accepted item.

It should be pointed out that the cancellation of a spe-

ciﬁc item differs from the cancellation of the whole

trip request; the former often happens because of the

greater attractiveness of a new item, and the latter is

for the time when the user does not want to share the

ride for the created trip anymore.

According to the above mechanism, any ride-

matching record could be associated with a class la-

bel which is among these four: Accepted, Cancelled,

Ignored or Rejected. As explained earlier, a class la-

bel comes from the response of the main user towards

sharing the ride with the target user.

The second element of a ride-matching record is

a vector of features, built from the personal informa-

tion of both the main and the target user and the prop-

erties of their trips. Before starting the learning pro-

cess, normalizing the features’ spaces is an essential

requirement due to the fact that margin based meth-

ods are known to be sensitive to the way features are

scaled (Ben-Hur and Weston, 2010). Because of that,

features are scaled to an identical range, i.e., [0, 1].

The extracted features from the provided database are

listed here:

• Positional Component: Expressing how much the

pick-up and drop-off locations will be suitable for

the main user.

• Temporal Component: Expressing how much the

departure time will be appropriate for the main

user.

• Gender Component: Indicating whether the target

user is of the same gender (1) or the opposite (0).

• Has Image: it considers whether the target user’s

proﬁle contains his/her picture or not.

• Average Rating: At the end of a ridesharing ex-

perience, users can rate the other party. This fea-

ture holds the average rate that the target user has

gained from previous trips.

• Is Favourite: As well as the rating, a user can mark

a particular user as a favourite person at the end of

ridesharing. This feature shows whether the target

user is among individuals who are marked as a

favourite of the main user or not.

• Previous Rating: If the main user and the target

user have had a previous ridesharing experience

with each other, this feature shows the rating that

the main user has given to the target user.

Considering the fact that a separate model will be

individually learned for each user, and with the pur-

pose of having an appropriate number of records, the

experiments are run for those users who have at least

50 records. In the provided data set, 44 users met this

condition, where the best user in terms of number of

records had 402 records. The total number of records

were 5676.

4.2 Results

Besides SVPL, using a Regression based method is

another viable approach for learning weights, as ex-

plained in Section 2.1. Thus, in this section, the per-

formance of SVPL is compared with a Regression

based method as a competitor.

These two methods need different formats for the

input data, though they both eventually produce a

scoring function. For the regression method, the main

user responses (class labels) are converted to scalar

values, and for SVPL, a set of preferences among

ride-matching records is created (Section 2.1 illus-

trates how).

Along the wide spectrum of regression methods,

the SVM regression method is chosen. This choice

serves two purposes. First, since both rival meth-

ods have a similar foundation in their learning mech-

anism, the merit of using the preferences set rather

than scalar values could be assessed more precisely.

Secondly, the same input parameters (e.g., cost error,

the kernel’s parameters etc.) have been used to tune

models in order to have a fair comparison.

In terms of choosing the kernel function, although

there are many kernels available in the literature, and

devising a new kernel by meeting Mercer’s Condition

is possible, we just simply utilize three well-known

kernels, listed here:

• K(x,y) = x · y: The linear kernel which is equiva-

lent to the non-kernel based formulation (Eq. 17).

• K(x,y) = (γx · y + r)

p

: The polynomial kernel of

degree p; here, we assume p = 2, γ = 1 and r = 0.

• K(x,y) = e

−kx−yk

2

/2σ

2

: This is the Gaussian ra-

dial basis function (RBF), a typical choice for the

kernel function. The parameter σ is tuned as an

input parameter.

For each user, the ride-matching records are sorted

in ascending order of the creation time, and then split

into two parts. The ﬁrst part includes 80% of the

records and is used to learn the model. At the end

of learning stage, models can predict, for each record,

ICAART 2016 - 8th International Conference on Agents and Artiﬁcial Intelligence

70

Table 2: Five ride-matching records which are used in Example 2.

Ground Truth SVPL Prediction Regression Prediction

Labels Ranking Value Ranking Value Ranking

S

1

C 2 0.52 2 0.71 3

S

2

I 3 0.35 4 0.28 5

S

3

I 3 0.31 5 0.36 4

S

4

A 1 0.77 1 0.91 1

S

5

R 4 0.43 3 0.75 2

a scalar value which expresses the goodness of that

record for the main user.

The second part of the data is used for the testing

stage. From this data, a weak order (a kind of rank-

ing in which incomparable items are assigned with

the same rank) with respect to class labels could be

derived. This ranking is used as the ground truth

for testing. From the other side, the predicted scalar

values for records produced by learned models sug-

gest a total order (ordinal ranking) between records.

Thereafter, C-Index (or concordance C) as one of

standard ranking assessment measures, is exploited

so as to ﬁnd the accuracy of models (F

¨

urnkranz and

H

¨

ullermeier, 2010). It is is calculated as follows:

C-Index(r, ˆr) =

κ

κ +

¯

κ

where κ is the number of correctly ranked pairs and

¯

κ (Kendall tau distance) is the number of incorrectly

ranked pairs. This is illustrated by the following ex-

ample.

Example 2. Assume there are 5 ride-matching

records to test the learned models. Table 2 includes

the user’s responses to these records, derived par-

tial ranking as the ground truth and predicted scalar

values/ranking by using SVPL and Regression. Ac-

cording to the given information, there are two pairs

that are incorrectly ranked for SVPL ((S

2

,S

5

) and

(S

3

,S

5

)). So, the C-Index for SVPL is

7

9

= 0.77.

For the Regression method, Kendall tau distance is

3 due to three wrong ranked pairs ((S

1

,S

5

), (S

2

,S

5

)

and (S

3

,S

5

)). Hence, the C-Index is

6

9

= 0.66. Note

that S

1

and S

3

are incomparable here.

In order to adjust the input parameters, we use the

Grid Search algorithm for hyper-parameter optimiza-

tion (Bergstra and Bengio, 2012). Roughly speaking,

in the Grid Search, input parameters are tuned for

each rival method individually to yield the best per-

formance for that particular method. So, the accuracy

of models are compared at their optimal point.

Each run of the learning and testing phases for all

those 44 users takes less than a couple of minutes,

making use of a computer facilitated by a Core i7 2.60

GHz processor and 8 GB RAM memory. In our ex-

periments, simply averaging the accuracy of a model

among users is used to compute the overall accuracy

of the model in each run. Figure 2 depicts the ac-

curacy of models for those three aforementioned ker-

nels.

As seen in the ﬁgure, SVPL outperforms the re-

gression method overall where the difference between

two methods is most notable in the linear case. The

accuracy of Regression increases by utilizing the RBF

kernel, while it is not the case for SVPL. We should

note that kernel methods are supposed to ease rep-

resentation of points in the features space whilst in-

curring computational expense; that could mean if a

model has almost the same accuracy in a non-kernel

and kernel based formulation, the non-kernel one is

preferred.

5 CONCLUDING REMARKS

In this paper, we have presented novel aspects of

the potential automatic ride-matching system, mak-

ing use of user preferences. Unlike the prevalent sys-

tems in ridesharing, this approach gives freedom to

participants in the choice of ridesharing partner; it is

supported by the fact that the user may disapprove of

the assigned matching which is found from the op-

timization of the whole system. A model similar to

SVMRank(Joachims, 2002) in form, SVPL, was dis-

cussed in Section 3 with the ability of learning user

preferences in a natural way in order to ﬁnally con-

tribute in the suggestion of a menu of good choices to

the user. Moreover, despite providing the ﬂexibility

in the matching process to deviate from the optimal

solution, learning user preferences softens the tradi-

tional way of setting hard constraints, and remove the

need for eliciting some complex parameters from par-

ticipants.

A natural extension would be if the preferences

set (pairwise trade-offs) derived from the user’s feed-

back could be associated with some degree of uncer-

tainty. For instance, if it is said that the user proba-

Learning User Preferences in Matching for Ridesharing

71

Figure 2: The accuracy of models when linear formulation, polynomial kernel and gaussian kernel are chosen.

bly prefers the case A to B, with certainty degree of

0.7. We plan to study the uncertainty in preferences

in our future works. Other interesting subjects related

to this paper that could be addressed in future works,

include handling nominal and unknown values in the

features space, online learning, and utilizing a general

model for users who still do not have enough records

for learning a dedicated model.

ACKNOWLEDGEMENT

This publication has emanated from research sup-

ported in part by a research grant from Sci-

ence Foundation Ireland (SFI) under Grant Num-

ber SFI/12/RC/2289, and also supported by Carma

(http://carmacarpool.com).

REFERENCES

Agatz, N., Erera, A., Savelsbergh, M., and Wang, X. (2012).

Optimization for dynamic ride-sharing: A review. Eu-

ropean Journal of Operational Research, 223(2):295

– 303.

Agatz, N. A., Erera, A. L., Savelsbergh, M. W., and Wang,

X. (2011). Dynamic ride-sharing: A simulation study

in metro atlanta. Transportation Research Part B:

Methodological, 45(9):1450–1464.

Aiolli, F. and Sperduti, A. (2011). A preference optimiza-

tion based unifying framework for supervised learn-

ing problems. In F

¨

urnkranz, J. and H

¨

ullermeier, E.,

editors, Preference Learning, pages 19–42. Springer

Berlin Heidelberg.

Aizerman, A., Braverman, E. M., and Rozoner, L. I.

(1964). Theoretical foundations of the potential func-

tion method in pattern recognition learning. Automa-

tion and Remote Control, 25:821–837.

Amey, A., Attanucci, J., and Mishalani, R. (2011).

Real-time ridesharing the opportunities and chal-

lenges of utilizing mobile phone technology to im-

prove rideshare services. Transportation Research

Record: Journal of the Transportation Research

Board, 2217(1):103–110.

Armant, V. and Brown, K. N. (2014). Minimizing the driv-

ing distance in ride sharing systems. In Tools with

Artiﬁcial Intelligence (ICTAI), 2014 IEEE 26th Inter-

national Conference on, pages 568–575. IEEE.

Baldacci, R., Maniezzo, V., and Mingozzi, A. (2004). An

exact method for the car pooling problem based on

lagrangean column generation. Operations Research,

52(3):422–439.

Ben-Hur, A. and Weston, J. (2010). A users guide to support

vector machines. In Carugo, O. and Eisenhaber, F.,

editors, Data Mining Techniques for the Life Sciences,

volume 609 of Methods in Molecular Biology, pages

223–239. Humana Press.

Bergstra, J. and Bengio, Y. (2012). Random search for

hyper-parameter optimization. The Journal of Ma-

chine Learning Research, 13(1):281–305.

Boyd, S. and Vandenberghe, L. (2004). Convex optimiza-

tion. Cambridge university press.

Burges, C. J. (1998). A tutorial on support vector machines

for pattern recognition. Data mining and knowledge

discovery, 2(2):121–167.

Chan, N. D. and Shaheen, S. A. (2012). Ridesharing in

north america: Past, present, and future. Transport

Reviews, 32(1):93–112.

Chaube, V., Kavanaugh, A. L., and Perez-Quinones, M. A.

(2010). Leveraging social networks to embed trust

in rideshare programs. In System Sciences (HICSS),

2010 43rd Hawaii International Conference on, pages

1–8. IEEE.

Duggan, M. and Smith, A. (2013). Cell internet

use 2013. Pew Research Center, http://www.

pewinternet.org/2013/09/16/cell-internet-use-2013/.

Emarketer (2014). 2 billion consumers worldwide to

get smart(phones) by 2016. http://www.emar

keter.com/Article/2-Billion-Consumers-Worldwide-

Smartphones-by-2016/1011694.

F

¨

urnkranz, J. and H

¨

ullermeier, E. (2010). Preference learn-

ing. Springer.

ICAART 2016 - 8th International Conference on Agents and Artiﬁcial Intelligence

72

Furuhata, M., Dessouky, M., Ord

´

o

˜

nez, F., Brunet, M.-E.,

Wang, X., and Koenig, S. (2013). Ridesharing: The

state-of-the-art and future directions. Transportation

Research Part B: Methodological, 57:28–46.

Ghoseiri, K., Haghani, A. E., and Hamedi, M. (2011). Real-

time rideshare matching problem.

Herbawi, W. M. and Weber, M. (2012). A genetic and inser-

tion heuristic algorithm for solving the dynamic ride-

matching problem with time windows. In Proceedings

of the 14th annual conference on Genetic and evolu-

tionary computation, pages 385–392. ACM.

Hwang, M., Kemp, J., Lerner-Lam, E., Neuerburg, N., and

Okunieff, P. (2006). Advanced public transportation

systems: state of the art update 2006. Technical report.

Joachims, T. (2002). Optimizing search engines using click-

through data. In Proceedings of the eighth ACM

SIGKDD international conference on Knowledge dis-

covery and data mining, pages 133–142. ACM.

Saranow, J. (2006). Carpooling for grown-ups—high gas

prices, new services give ride-sharing a boost; rating

your fellow rider. Wall Street Journal.

Simonin, G. and O’Sullivan, B. (2014). Optimisation for the

ride-sharing problem: a complexity-based approach.

In ECAI, pages 831–836.

Smith, A. (2015). Us smartphone use in 2015.

Pew Research Center, http://www.pewinternet.

org/2015/04/01/us-smartphone-use-in-2015/.

Zickuhr, K. (2012). Three-quarters of smartphone owners

use location-based services. Pew Research Cen-

ter, http://www.pewinternet.org/2012/05/11/three-

quarters-of-smartphone-owners-use-location-based-

services/.

Learning User Preferences in Matching for Ridesharing

73