Content uploaded by Andrzej P. Urbanski
Author content
All content in this area was uploaded by Andrzej P. Urbanski
Content may be subject to copyright.
Int. J. Appl. Math. Comput. Sci., 2010, Vol. 20, No. 2, 385–390
DOI: 10.2478/v10006-010-0028-0
INTERNET SHOPPING OPTIMIZATION PROBLEM
JACEK BŁA
˙
ZEWICZ
∗,∗∗∗
,MIKHAIL Y. KOVALYOV
∗∗
,J˛EDRZEJ MUSIAŁ
∗
,
A
NDRZEJ P. URBA
´
NSKI
∗
,ADAM WOJCIECHOWSKI
∗
∗
Institute of Computing Science
Pozna
´
n University of Technology, ul. Piotrowo 2, 60–965 Pozna
´
n, Poland
e-mail: {Jacek.Blazewicz,J˛edrzej.Musial}@cs.put.poznan.pl
{Andrzej.Urbanski,Adam.Wojciechowski}@cs.put.poznan.pl
∗∗
United Institute of Informatics Problems
National Academy of Sciences of Belarus, Surganova 6, 220012 Minsk, Belarus
e-mail: kovalyov_my@newman.bas-net.by
∗∗∗
Institute of Bioorganic Chemistry
Polish Academy of Sciences, Z. Noskowskiego 12/14, 61–704 Pozna
´
n, Poland
A high number of Internet shops makes it difficult for a customer to review manually all the available offers and select
optimal outlets for shopping. A partial solution to the problem is brought by price comparators which produce price rankings
from collected offers. However, their possibilities are limited to a comparison of offers for a single product requested by
the customer. The issue we investigate in this paper is a multiple-item multiple-shop optimization problem, in which total
expenses of a customer to buy a given set of items should be minimized over all available offers. In this paper, the Internet
Shopping Optimization Problem (ISOP) is defined in a formal way and a proof of its strong NP-hardness is provided. We
also describe polynomial time algorithms for special cases of the problem.
Keywords: algorithms, computational complexity, combinatorial algorithms, optimization, Internet shopping.
1. Introduction
On-line shopping is one of key business activities offered
over the Internet. A survey concerning American Inter-
net users behavior published by Pew Internet & Ameri-
can Life Project in February 2008 (Horrigan, 2008) shows
that the population of on-line customers grows rapidly and
systematically from year to year. The number of on-line
users either buying or searching for products on-line since
2000 has roughly doubled. While in 2000 22% of Ame-
ricans (46% of on-line users) had some experience with
buying products in virtual shops, the ratio grew to 39%
in 2003 and reached 49% (66% of on-line users) in 2007.
The developmentof on-line shopping is also stimulated by
the increasing number of Internet users. E-commerce re-
venue has grown from $7.4 billion in the middle of 2000 to
$34.7 billion in the third quarter of 2007. A survey concer-
ning the behavior of customers in Poland (Gemius, 2008)
confirms the tendency observed in America. Among va-
rious business instruments commonly available on-line
since 1990s, like auctions (Lee, 1998; Klein, 2000) and
(Vulkan, 2003, pp. 149-178), banking and secure pay-
ment (Langdon et al., 2000), shopping (Liang and Hu-
ang, 1998), electronic libraries (Lesk, 1997), etc., on-line
retail remains the service offered by the highest number of
providers. A growing number of on-line shops and incre-
ased accessibility to customers world-wide due to the use
of credit card payment in on-line transactions (Langdon
et al., 2000) are key attributes that force strong compe-
tition on the market, keep prices low (when compared to
off-line shopping) and make more and more customers in-
terested in on-line purchasing (Vulkan, 2003, pp. 22-27).
However, a wide choice of on-line shops makes it diffi-
cult to manually compare all the offers and choose optimal
providers for the required set of products.
A solution of this problem has been supported by
software agents (Tolle and Chen, 2000), so-called pri-
ce comparison sites. The concept of a price compara-
tor is built on the idea of collecting offers of many
on-line shops and building a price ranking on a custo-
386
J. Bła
˙
zewicz et al.
mer’s request. This approach is commonly accepted by
customers and, according to Alexa Rank, popular price
comparison services belong to the group of 1000 most
viewed sites world-wide: shopping.com: 518-th pla-
ce, nextag.com: 533-th place, bizrate.com: 600-
th place, shoplocal.com: 932-th place (site popularity
results registered in October 2008, www.alexa.com).
It is worth noting that price ranking built on-line on a
customer’s request expressed in a text query (product de-
scription) is a solution to a specific case of shopping, in
which a customer wants to buy a single product. Multi-
ple item shopping is not supported by price comparators
available nowadays. Furthermore, price comparison sites,
being commercial projects, tend to optimize their incomes
from directing customers to particular on-line shops. As a
result, price comparison sites play the role of recommen-
der systems (Satzger et al., 2006) which tend to detect a
customer’s preferences and interests in order to suggest
products to buy. A side effect of the problems mentioned
above is the loss of customer confidence. To illustrate the
optimization process, we would like to consider and assess
its benefits. To this end, let us consider an example below.
A customer wants to buy five books. The prices of the bo-
oks and delivery costs in six shops which the customer
considers as potential shopping locations are collected in
Table 1.
The customer’s goal is to buy all five books at mini-
mum expense. The support from currently available price
comparators allows building the customer’s basket based
on optimal offers for each individual book. The result of
the selection process is presented in Table 2.
The shopping performed upon price comparator sug-
gestions would not be optimal (total cost: 210) because
simple price comparison does not include delivery cost,
which grows as the number of shopping locations grows.
In order to find the cheapest solution for the ISOP illu-
strated above, one can perform a complete search of all
possible realizations of shopping. The simple example we
analyze shows that the optimization process may bring so-
me savings. In our example, the optimal cost of purcha-
se (in Shop 1 and Shop 4) equals 189 (see Table 3). The
problem addressed in this paper is to manage a multiple-
item shopping list over several shopping locations. The
objective is to have all the shopping done at minimum to-
tal expense. One should notice that dividing the original
shopping list into several sub-lists whose items will be
delivered by different providers increases delivery costs.
These are counted and paid individually for each package
(sub-list) assigned to a specific Internet shop in the opti-
mization process.
In the sequel, we consider the above mentioned Inter-
net shopping optimization problem in a more formal way.
In Section 2, a formal definition of the problem is given.
In Section 3, we prove that the ISOP is NP-hard in the
strong sense and that it is not approximable in polynomial
time. In Section 4, we demonstrate that the ISOP is po-
lynomially solvable if the number of products to buy, n,
or the number of shops, m, is a given constant. The paper
concludes with a summary of the results and suggestions
for future research.
2. Problem definition
The notation used throughout this paper is given in Ta-
ble 4. We study the following problem of Internet shop-
ping. A single buyer looks for a multiset of products
N = {1,...,n} to buy in m shops. A multiset of ava-
ilable products N
l
,acostc
jl
of each product j ∈ N
l
,
and a delivery cost d
l
of any subset of the products from
the shop to the buyer are associated with each shop l,
l =1,...,m. It is assumed that c
jl
= ∞ if j ∈ N
l
.
The problem is to find a sequence of disjoint selections
(or carts) of products X =(X
1
,...,X
m
),whichwe
call a cart sequence, such that X
l
⊆ N
l
, l =1,...,m,
∪
m
l=1
X
l
= N , and the total product and delivery cost, de-
noted by F (X):=
m
l=1
δ(|X
l
|)d
l
+
j∈X
l
c
jl
,is
minimized. Here |X
l
| denotes the cardinality of the mul-
tiset X
l
,andδ(x)=0if x =0and δ(x)=1if x>0.
We denote this problem as the ISOP, its optimal solution
as X
∗
, and its optimal solution value as F
∗
.
3. Strong NP-hardness and
inapproximability
In this section we will analyze the computational com-
plexity of the ISOP. We will demonstrate its strong NP-
hardness by proving strong NP-completeness of its deci-
sion counterpart—Problem P1. The latter has the same in-
put as the ISOP plus an additional parameter y,andthe
question is to determine whether there exists a selection
of products with the total cost F (X) ≤ y.
Theorem 1. The ISOP is NP-hard in the strong sense even
if all costs of the available products are equal to zero and
all the delivery costs are equal to one.
Proof. We construct a pseudo-polynomial transformation
of Problem P1 from the strongly NP-complete problem
E
XACT COVER BY 3-SETS (X3C), see (Garey and John-
son, 1979).
E
XACT COVER BY 3-SETS (X3C) can be defined
as follows: Given a family E = {E
1
,...,E
L
} of three-
element subsets of the set K = {1,...,3k}, does E con-
tain an exact cover of K, i.e., a subfamily Y ⊆ E such that
each j ∈ K belongs to exactly one three-element set in Y ?
It is clear that if Y is a solution to X3C, then |Y | = k.
Given an instance of X3C, we construct the following
instance of Problem P1. There are m = L shops with
available products of the sets N
l
= E
l
, l =1,...,L.The
Internet shopping optimization problem
387
Table 1. Prices of books and delivery costs offered by six internet shops.
Cost Book a Book b Book c Book d Book e Delivery Total
Shop 1 18 39 29 48 59 10 203
Shop 2 24 45 23 54 44 15 205
Shop 3 22 45 23 53 53 15 211
Shop 4 28 47 17 57 47 10 206
Shop 5 24 42 24 47 59 10 206
Shop 6 27 48 20 55 53 15 218
Table 2. Price comparator solution—the result of the selection process.
Book a Book b Book c Book d Book e Delivery Total
Price 18 39 17 47 44 45 210
Shop Shop 1 Shop 1 Shop 4 Shop 5 Shop 2
Table 3. Optimal purchase cost in selected shops.
Book a Book b Book c Book d Book e Delivery Total
Cost 18 39 17 48 47 20 189
Shop Shop 1 Shop 1 Shop 4 Shop 1 Shop 4
buyer would like to purchase the set of products N = K.
The cost of any product available in any shop is equal to
zero (c
jl
=0, j ∈ N
l
, l =1,...,m), the delivery cost
from any shop to the buyer is equal to one (d
l
=1, l =
1,...,m), and the threshold value of the criteria is y = k.
We show that X3C has a solution if and only if there exists
a solution X for the constructed instance of Problem P1
with F (X) ≤ k. It is easy to see that our transformation
is polynomial and pseudo-polynomial at the same time.
Therefore, Problem P1 belongs to the class NP.
Let Y be a solution to X3C. Construct a solution to
Problem P1, in which the required products are purchased
in k shops determined by their sets of products N
l
= E
l
∈
Y , i.e., X
l
= N
l
if N
l
∈ Y and X
l
= ∅ if N
l
∈ Y. Since
Y is an exact cover of K, all the required products are
purchased, and the cost of the corresponding solution is
F (X)=k.
Now assume that there exists a solution X to Pro-
blem P1 with the cost value F (X) ≤ k. On the one hand,
for this solution the number of shops with X
l
= φ should
not exceed k because otherwise F (X) >k. On the other
hand, the number of these shops should not be less than
k because otherwise at least one product j ∈ N will not
be purchased. Therefore, there are exactly k shops with
X
l
= ∅. Since the purchased products form the set K,the
collection of the shops with X
l
= ∅ represents a solution
to X3C.
We now discuss the approximability of the ISOP. Let
us consider its special case, in which the cost of any pro-
duct in any shop is equal to zero, and the delivery cost
from any shop to the buyer is equal to one. This special
case is equivalent to the following M
INIMUM SET CO-
VER problem, see (Crescenzi and Kann, 2008).
M
INIMUM SET COVER: Given a collection C of subsets
of a finite set S, find a set cover for S, i.e., a subset C
⊆
C such that every element in S belongs to at least one
member of C
, which minimizes the cardinality of the set
cover, i.e., |C
|.
Due to (Raz and Safra, 1997), the problem M
INI-
MUM SET COVER is polynomially non-approximable wi-
thin the ratio c·ln |S|, for some constant c>0. Therefore,
the following statement can be formed.
Statement 1. There exists no polynomial (c · ln n)-
approximation algorithm for the ISOP, unless P = NP.
4. Polynomial algorithms for special cases
Notice that the intractability of the ISOP is established un-
der the assumption that both the number of products to
buy, n, and the number of shops, m, are variables. In this
section we present two solution approaches for the ISOP,
which are polynomial if either n or m is a constant.
The idea of our first algorithm SHOP-ENUM is to
enumerate all possible selections of shops containing all
the required products, to choose the best cart sequence
X
(M)
for each selection of shops M , M ⊆{1,...,m},
to calculate the total product and delivery cost for each M ,
and, finally, to find a cart sequence X
∗
with the minimum
total cost, F
∗
.
Algorithm SHOP-ENUM
Step 1. Set F
∗
= ∞ and X
∗
l
= ∅, l =1,...,m.
Step 2. Consider selections of shops to buy all the requ-
ired products. Each shop l, l ∈{1,...,m}, such that
388
J. Bła
˙
zewicz et al.
Table 4. Problem definition—table of notation.
Symbol Explanation
n number of products
m number of shops
N
l
multiset of products available in shop l
c
jl
cost of each product j ∈ N
l
d
l
delivery cost for shop l, l =1,...,m
X =(X
1
,...,X
m
) sequence of selections of products in shops 1,...,m
F ( X) sum of product and delivery costs
δ(x) 0-1 indicator function for x =0and x>0
X
∗
optimal sequence of selections of products
F
∗
optimal (minimum) total cost
N
l
is non-empty can be selected or not; therefore, the-
re are at most 2
m
selections. For each selection of shops
M perform the following computations. If M does not
contain all the required products, then skip considering
this selection. Otherwise, do the following: Determine a
cart sequence X
(M)
=(X
(M)
1
,...,X
(M)
m
), X
(M)
l
⊆ N
l
,
l =1,...,m, as follows. For each product i ∈ N ,se-
lect a shop l ∈ M in which the cost of product i is lo-
west. This can be done in constant time if costs c
il
are
stored for each product i in a heap. Assign product i to
the corresponding multiset X
(M)
l
. Notice that the assign-
ment strategy can eliminate some of the selected shops.
This strategy is optimal for a given selection of shops due
to the fact that the total product costs are minimized and
the total delivery cost does not exceed the sum of deli-
very costs for the selected shops. Calculate the total cost,
F (X
(M)
).IfF (X
(M)
) <F
∗
, re-set F
∗
:= F (X
(M)
)
and X
∗
:= X
(M)
.
Step 3. Output optimal solution X
∗
with the minimum
cost F
∗
.
The time complexity of the SHOP-ENUM algorithm
is O(n2
m
), which is polynomial (linear) if the number of
shops m is a constant.
The idea of our second algorithm, PRODUCT-
ENUM, is to enumerate all possible shop choices for each
product. Let S =(S
1
,...,S
n
) be a shop sequence such
that S
i
∈{1,...,m} is a shop in which product i will
be purchased, i =1,...,n. The algorithm determines a
shop sequence S
∗
with the minimum total cost, F
∗
,ofthe
corresponding cart sequence.
Algorithm PRODUCT-ENUM
Step 1. Set F
∗
= ∞ and S
∗
i
= ∅, i =1,...,n.
Step 2. Consider shop sequences S =(S
1
,...,S
n
) such
that product i ∈ N will be purchased in shop S
i
, i =
1,...,n. There are at most m
n
such sequences. For each
sequence S, calculate the cost of the corresponding cart
sequence, F (S).IfF (S) <F
∗
, re-set F
∗
= F (S), S
∗
:=
S and pass on to considering the next shop sequence.
Step 3. Output optimal shop sequence S
∗
with the mini-
mum total cost F
∗
.
The time complexity of the algorithm PRODUCT-
ENUM is O(nm
n
), which is polynomial if the number
of products n is a constant.
The algorithm PRODUCT-ENUM can be applied in
practice if the number of products to buy, n,issmalland
the number of shops having these products, m,islarge.
Alternatively, if the number of shops m is small and the
number of the required products n is large, the algorithm
SHOP-ENUM can be efficient.
5. Conclusions
Internet shopping is often attributed with prices lower
than in traditional shops. Another strong advantage of an
on-line purchase is a wide choice of alternative retailers
which, in general, remain at the same distance from the
customer—at least one day for shopping delivery. Posta-
ge cost is often non-zero, which makes it reasonable to
group purchased products so that each group is ordered in
the same shop, and the total purchase and delivery cost is
minimized. Changing retail location for the same product
can be possible, provided that the customer is guarante-
ed that the product in a new location is identical to that
in an old one. In the case of changing the retail location,
the quantity and quality of the product must be identical.
However, the total price can change because of different
times of delivery, different profit margins, etc. Customers
are interested in minimizing the total product and delive-
ry cost. Currently available price comparators can be used
for these purposes only occasionally, because they do not
provide multiple-item basket optimization.
We introduced the Internet shopping optimization
problem and provided a proof of its strong NP-hardness.
Furthermore, two polynomial time algorithms for special
cases of the ISOP were described. In the future work, we
Internet shopping optimization problem
389
intend to derive and experimentally test heuristic appro-
aches for the ISOP to make the suggested approach ap-
plicable for solving complex shopping cart optimization
problems in on-line applications. The ideas and algorith-
mic results given in (Musiał and Wojciechowski, 2009)
for a simplified version of the ISOP can be generalized
and extended for these purposes.
Acknowledgment
The work was partially supported by the grant
from the Ministry of Science and Higher Education
no. N519188933. Also, Jacek Bła
˙
zewicz acknowledges
the support of an INRIA Rhone-Alpes grant.
References
Crescenzi, P. and Kann, V. (2008). A compendium of NP opti-
mization problems, http://www.nada.kth.se/
~viggo/wwwcompendium/.
Garey, M. and Johnson, D. (1979). Computers and Intractabili-
ty: A Guide to the Theory of NP-Completeness, Freeman,
New York, NY.
Gemius, S. (2008). E-commerce in Poland, http:
//gemius.pl/pl/raporty/2008-06/03.
Horrigan, J. (2008), On-line Shopping, Pew Research Center,
http://www.pewinternet.org/~/media
//Files/Reports/2008
/PIP_Onlinepping.pdf.pdf.
Klein, S. (2000). The emergence of auctions on the world wide
web, in M. Shaw, R. Blanning, T. Strader and A. Whin-
ston (Eds.), Handbook on Electronic Commerce, Springer-
Verlag, Berlin/Heidelberg, pp. 627–645.
Langdon, C., Roghe, F. and Shaw, M. (2000). Consumer mass
market on-line payment solutions, in M.Shaw,R.Blan-
ning, T. Strader and A. Whinston (Eds.), Handbook on
Electronic Commerce, Springer-Verlag, Berlin/Heidelberg,
pp. 273–288.
Lee, H. (1998). Do electronic marketplaces lower the prices of
goods?, Communications of the ACM 41(1): 73–80.
Lesk, M. (1997). Practical Digital Libraries: Books, Bytes and
Bucks, Morgan Kaufmann Publishers, San Francisco, CA.
Liang, T. and Huang, J. (1998). An empirical study on consumer
acceptance of products in electronic markets: A transactio-
nal cost model, Decision Support Systems 21(1): 29–43.
Musiał, J. and Wojciechowski, A. (2009). A customer assistance
system: Optimizing basket cost, Foundations of Computing
and Decision Sciences 34(1): 59–69.
Raz, R. and Safra, S. (1997). A sub-constant error-probability
low-degree test, and sub-constant error-probability PCP
characterization of NP, 29th Annual ACM Symposium on
Theory of Computing, El Paso, TX, USA, pp. 475–484.
Satzger, B. , Endres, M. and Kielssing, W. (2006). A preference-
based recommender system, in K. Bauknecht, B. Pröll and
H. Werthner (Eds.), E-Commerce and Web Technologies,
Lecture Notes in Computer Science, Vol. 4082, Springer-
Verlag, Berlin/Heidelberg, pp. 31–40.
Tolle, K. and Chen, H. (2000). Intelligent software agents
for electronic commerce, in M. Shaw, R. Blanning,
T. Strader and A. Whinston (Eds.), Handbook on
Electronic Commerce, Springer-Verlag, Berlin/Heidelberg,
pp. 265–382.
Vulkan, N. (2003). The Economics of E-Commerce. A Strategic
Guide to Understanding and Designing the On-line Mar-
ketplace, Princeton University Press, Princeton, NJ.
Jacek Bła
˙
zewicz, born in 1951 (M.Sc. in control engineering: 1974,
Ph.D. and D.Sc. in computer science: 1977 and 1980, respectively), is
a professor of computer science at the Pozna
´
n University of Technology.
Presently he is a deputy director of the Institute of Computing Science.
His research interests include algorithm design and complexity analysis
of algorithms, especially in bioinformatics as well as in scheduling the-
ory. He has published widely in the above fields (over 300 papers) in
many outstanding journals. He is the author and co-author of 14 mono-
graphs, an editor of the International Series of Handbooks in Information
Systems (Springer-Verlag) as well as a member of the editorial boards of
several scientific journals. His science citation index reaches 2300 (ac-
cording to the ISI database). In 1991 he was awarded an EURO Gold
Medal for his scientific achievements in the area of operations research.
In 2002 he was elected a corresponding member of the Polish Academy
of Sciences. In 2006 he was awarded an honorary doctoral degree by the
University of Siegen.
Mikhail Y. Kovalyov, born in 1959 (Ph.D. and D.Sc. degrees in ma-
thematical cybernetics in 1986 and 1999, respectively, professorial title
in computer science: 2004), is a deputy general director of the United
Institute of Informatics Problems, National Academy of Sciences of Be-
larus, and a professor of Belarusian State University. His research inte-
rests include combinatorial optimization, scheduling, logistics and bio-
informatics. He has authored over 100 publications in refereed scientific
journals. His paper co-authored with C.N. Potts is included in the list of
30 best papers published by the European Journal of Operational Rese-
arch in 1975–2005. His citation h-index is 14 according to Scopus and
16 according to Google Scholar. He is a co-author of one monograph
and a chapter in a monograph. Mikhail Y. Kovalyov is an associate edi-
tor for Omega and the Asia-Pacific Journal of Operational Research,a
member of the editorial boards of the European Journal of Operatio-
nal Research and Computers and Operations Research, a member of the
EURO working group on production management and scheduling, and
the vice-president of the Byelorussian Operational Research Society.
J˛edrzej Musiał, born in 1982 (M.Sc. in computer science from the Po-
zna
´
n University of Technology: 2006) is a Ph.D. student, researcher and
lecturer at the Institute of Computer Science of the Pozna
´
n University of
Technology. His research interests include electronic commerce, algo-
rithm design and combinatorial optimization. He has published several
papers. Since 2008 has been a board member of the Polish Information
Processing Society (Major Poland Branch).
Andrzej P. Urba
´
nski graduated in computer science from the Pozna
´
n
University of Technology, Poland, and obtained his PhD in the same field
from the Polish Academy of Sciences. Presently he is a researcher and
lecturer at the Institute of Computer Science of the Pozna
´
n University of
Technology. His research includes the fields of computer-aided design,
artificial intelligence, and electronic commerce. He has been publishing
and presenting papers at many European scientific conferences and has
also published articles and books popularizing computer science, espe-
cially for children, with some literary setting. Some of his computer pro-
grams have been marketed and reviewed in popular media, among others
390
J. Bła
˙
zewicz et al.
by Polish TV networks, Deutsche Rundfunk, BBC, Die Welt, The New
York Times, and Canadian CRBC.
Adam Wojciechowski graduated from the Pozna
´
n University of Tech-
nology (PUT) in 1995 with an M.Sc. in computer science. In 1997/98 he
worked at Dublin City University, Ireland. In 2002 he received a Ph.D.
degree in computer science/software engineering at the PUT, where he
currently works as an assistant professor. His research interests include
software engineering, electronic business, optimization issues on finan-
cial markets and distant education. He is an author or co-author of over
12 papers published in international scientific journals and internatio-
nal conference proceedings. He has also prepared Polish handbooks for
ECDL applicants and published a distant education course for webma-
sters.
Received: 19 June 2009
Revised: 24 October 2009