Towards SMT-based Abstract Planning in PlanICS Ontology
Artur Niewiadomski
1
and Wojciech Penczek
1,2
1
ICS, Siedlce University, 3-Maja 54, 08-110 Siedlce, Poland
2
ICS, Polish Academy of Sciences, Jana Kazimierza 5, 01-248 Warsaw, Poland
Keywords:
Web Service Composition, SMT, Abstract Planning, Service-oriented Architecture, PlanICS.
Abstract:
The paper deals with the abstract planning problem the first stage of Web Service Composition (WSC) in
the PlanICS framework. We present a solution based on a compact representation of abstract plans by multisets
of service types and a reduction of the planning problem to a task for an SMT-solver. The paper presents
theoretical aspects of the abstract planning as well as some details of our symbolic encoding, followed by
preliminary experimental results.
1 INTRODUCTION
The main concept of Service-Oriented Architecture
(SOA) (Bell, 2008) consists in using independent
components available via well-defined interfaces. Of-
ten, a simple web service does not realize the user ob-
jective, so a composition of them need to be executed
to this aim. The problem of finding such a composi-
tion is hard and known as the Web Service Composi-
tion Problem (WSCP) (Bell, 2008; Ambroszkiewicz,
2004; Rao and Su, 2004). In this paper, we follow the
approach of our system PlanICS (Doliwa et al., 2011),
which has been inspired by (Ambroszkiewicz, 2004).
The main assumption is that all the web services
in the domain of interest as well as the objects which
are processed by the services, can be strictly classi-
fied in a hierarchy of classes, organised in an ontol-
ogy. Another key idea is to divide planning into sev-
eral stages. The first phase deals with classes of ser-
vices, where each class represents a set of real-world
services, while the second one works in the space of
concrete services. The first stage produces an abstract
plan, which becomes a concrete plan in the second
phase. Such an approach enables to reduce the num-
ber of concrete services to be considered. This paper
focuses on the abstract planning problem only.
We propose a novel approach based on an appli-
cation of SMT-solvers. Contrary to a number of other
approaches (see Section 1.1), we focus not only on
searching for a single solution, but we attempt to find
all significantly different plans. We start with defin-
This work has been supported by the National Science
Centre under the grant No. 2011/01/B/ST6/01477.
ing the abstract planning problem (APP) and showing
that it is NP-hard. Then, we present a fully original
solution of APP based on a compact representation of
abstract plans by multisets of service types and a re-
duction to a task for an SMT-solver, which is the main
contribution of our paper. The encoding of block-
ing formulas allows for pruning the search space with
many sequences which use the same service types as
some plan already generated. Note that a multiset of
size k can be linearised even in k! ways if all its el-
ements are different. To the best of our knowledge,
the above approach is novel, and as our experiments
show it is also very promising.
The rest of the paper is organized as follows. Re-
lated work is discussed in Sect. 1.1. Sect. 2 deals
with the abstract planning problem. Sect, 3 presents
the SMT-based encoding and implementation of our
approach. Sect. 4 discusses experimental results of
our planning system. The last section summarizes and
discusses the results.
1.1 Related Work
Web services are widely used to implement SOA
paradigm, but much of their benefits is revealed when
they can be composed automatically. The existing
solutions to WSCP are divided into several groups.
Following (Li et al., 2010) our approach belongs
to AI planning methods, including also approaches
based on: automata theory (Mitra et al., 2007), Petri
nets (Gehlot and Edupuganti, 2009), theorem proving
(Rao et al., 2006), and model checking (Traverso and
Pistore, 2004).
123
Niewiadomski A. and Penczek W..
Towards SMT-based Abstract Planning in PlanICS Ontology.
DOI: 10.5220/0004514901230131
In Proceedings of the International Conference on Knowledge Engineering and Ontology Development (KEOD-2013), pages 123-131
ISBN: 978-989-8565-81-5
Copyright
c
2013 SCITEPRESS (Science and Technology Publications, Lda.)
A composition method closest to ours is presented
in (Nam et al., 2008), where the authors reduce WSCP
to a reachability problem of a state-transition system.
The problem is encoded as a propositional formula
and tested for satisfiability using a SAT-solver. This
approach makes use of an ontology describing a hi-
erarchy of types and deals with an inheritance rela-
tion. However, we consider also the states of the ob-
jects, while (Nam et al., 2008) deals with their types
only. Moreover, among other differences, we use a
multiset-based SMT encoding instead of SAT.
Most of the applications of SMT in the domain of
WSC is related to the automatic verification and test-
ing. For example, a message race detection problem
is investigated in (Elwakil et al., 2010), the authors of
(Bentakouk et al., 2011) take advantage of symbolic
testing and execution techniques in order to check be-
havioural conformance of WS-BPEL specifications,
(Bersani et al., 2010) deals with a service substi-
tutability problem, while (Monakova et al., 2009) ex-
ploits SMT to verification of WS-BPEL specifications
against business rules. However, to our best knowl-
edge, there are no other approaches dealing with SMT
as an engine to WSC.
2 ABSTRACT PLANNING PHASE
APP makes intensive use of the service types and the
object types defined in the ontology. A service type
represents a set of web services with similar capabili-
ties, while the object types are used to represent data
processed by the services. The attributes are compo-
nents of the object types, and the objects are simply
instances of the object types. An object state is deter-
mined by its attribute values. However, for APP it is
enough to know only whether an attribute does have
some value or it does not, and therefore, we introduce
the concept of abstract values.
Attributes, Object Types, and Objects Let I de-
note the set of all identifiers used as the names of the
types, the objects, and the attributes. In APP we deal
with abstract values only, the types of the attributes
are irrelevant, and we identify the attributes with their
names. Moreover, we denote the set of all attributes
by A, where A I. An object type is a pair (t,Attr),
where t I, and Attr A. That is, an object type con-
sists of a type name and a set of attributes. The set of
all object types is denoted by P. We define also a tran-
sitive, irreflexive, and antisymmetric inheritance rela-
tion Ext P × P, such that
(t
1
,A
1
),(t
2
,A
2
)
Ext
iff t
1
6= t
2
and A
1
A
2
. That is, a subtype contains all
the attributes of a base type and optionally introduces
more attributes. An object o is a pair o = (id,type),
where id I and type P. That is, an object is a pair
of the object name, and the object type, denoted by
type(o) for a given object o. The set of all objects
is denoted by O. Moreover, we define the function
attr : O 7− 2
A
returning a set of the attributes for
each object of O.
Service Types and User Queries. The service
types available for composition are defined in the on-
tology by service type specifications. The user goal is
provided in a form of a user query specification. Be-
fore APP, all the specifications are reduced to sets of
objects and abstract formulas over them, to be defined
in what follows.
Definition 1 (Abstract Formulas). An abstract for-
mula over a set of objects O and their attributes is
defined by the following BNF grammar:
<form> ::= <disj>
<disj> ::= <conj>|<conj> or <disj>
<conj> ::= <lit>|<conj> and <lit>
<lit> ::= isSet(o.a)|isNull(o.a)|true|false
where O O, o O, a attr(o), and o.a denotes the
attribute a of the object o.
The above grammar defines DNF formulas with-
out negations, i.e., alternatives of clauses, referred to
as abstract clauses. Every abstract clause is the con-
junction of literals, specifying abstract values of ob-
ject attributes using the functions isSet and isNull.
In the abstract formulas used in APP, we assume
that no abstract clause contains both isSet(o.a) and
isNull(o.a), for the same o O and a attr(o). The
syntax of the specifications of the user queries and of
the service types is the same and it is defined below.
Definition 2 (Specification). A specification is a 5-
tuple (in,inout, out, pre, post), where in, inout, out
are pairwise disjoint sets of objects, and pre is an
abstract formula defined over objects from in inout,
while post is an abstract formula defined over objects
from in inout out.
In what follows a user query specification q or
a service type specification s is denoted by spec
x
=
(in
x
,inout
x
,out
x
, pre
x
, post
x
), where x {q, s}, resp.
Notice that the objects of in
x
are read-only, these of
inout
x
can change their states, while out
x
is to contain
new objects only. In order to formally define the user
queries and the service types, which are interpreta-
tions of their specifications, we first need to introduce
the notions of valuation functions and worlds.
Definition 3 (Valuations of Object Attributes). Let ϕ
be an abstract formula over O s.t. ϕ =
W
i=1..n
α
i
,
where n N, and each α
i
is an abstract clause. A
valuation of the object attributes over α
i
is the partial
KEOD2013-InternationalConferenceonKnowledgeEngineeringandOntologyDevelopment
124
function v
α
i
:
S
oO
{o} × attr(o) 7− {true, false},
where:
v
α
i
(o,a)=true if isSet(o.a) is a literal of α
i
, or
v
α
i
(o,a)=false if isNull(o.a) is a lit. of α
i
, or
v
α
i
(o,a) is undefined, otherwise.
We define the restriction of a valuation func-
tion v
α
i
to a set of objects O O as v
α
i
(O) =
v
α
i
S
oO
{oattr(o)
. We write v
α
i
(o) instead of
v
α
i
({o}), when we restrict the valuation function v
α
i
to a single object and its attributes.
The undefined values appear when the interpreted
abstract formula does not specify abstract values of
some attributes. Obviously, this is a typical case in
the WSC domain as we often deal with incomplete,
uncertain, or irrelevant information. The undefined
values are a way to overcome this problem, but they
are also a form of representing families of total valu-
ation functions, which is explained below.
Definition 4 (Consistent Functions). Let A, A
0
, B be
sets such that A
0
A, f : A 7− B be a total func-
tion, and f
0
: A 7− B be a partial function, such that
f
0
restricted to A
0
is total. We say that f is consis-
tent with f
0
, if f
0
restricted to A
0
equals to f , i.e.,
aA
0
f
0
(a) = f (a).
Next, for a partial valuation function f , by
total( f ) we denote the family of the total valuation
functions, which are consistent with f . Moreover, we
define a family of the valuation functions V
ϕ
over the
abstract formula ϕ as the union of the sets of the con-
sistent valuation functions over every abstract clause
α
i
, i.e., V
ϕ
=
S
n
i=1
total(v
α
i
). The restriction of the
family of functions V
ϕ
to a set of objects O and their
attributes is defined as V
ϕ
(O) =
S
n
i=1
total(v
α
i
(O)).
Definition 5 (Worlds). A world w is a pair
(O
w
,v(O
w
)), where O
w
O and v(O
w
) is a total val-
uation function, restricted to the objects from O
w
, for
some valuation function v. The size of w, denoted by
|w|, is the number of the objects in w, i.e., |w| = |O
w
|.
That is, a world represents a state of a set of ob-
jects, where each attribute is either set or null.
By a sub-world of w we mean a world built from
a subset of O
w
and v
w
restricted to the objects from
the chosen subset. Moreover, a pair consisting of a
set of objects and a family of total valuation functions
defines a set of worlds. That is, if V = {v
1
,...,v
n
}
is a family of total valuation functions and O O
is a set of objects, then
O,V (O)
means the set
{
O,v
i
(O)
| 1 i n}, for n N. Finally, the set
of all worlds is denoted by W.
Now, we are in a position to define a service type
and a user query as an interpretation of its specifica-
tion.
Definition 6 (Interpretation of a Specification). Let
spec
x
= (in
x
,inout
x
,out
x
, pre
x
, post
x
) be a user query
or a service type specification, where x {q, s}, resp.
An interpretation of spec
x
is a pair of world sets x =
(W
x
pre
,W
x
post
), where:
W
x
pre
=
in
x
inout
x
,V
x
pre
, where V
x
pre
is the fam-
ily of the valuation functions over pre
x
,
W
x
post
=
in
x
inout
x
out
x
,V
x
post
, where V
x
post
is
the family of the valuation functions over post
x
.
An interpretation of a user query (service type) spec-
ification is called simply a user query (service type,
resp.).
For a service type (W
s
pre
,W
s
post
), W
s
pre
is called the
input world set, while W
s
post
- the output world set.
The set of all the service types defined in the ontology
is denoted by S. For a user query (W
q
pre
,W
q
post
), W
q
pre
is
called the initial world set, while W
q
post
- the expected
world set, and denoted by W
q
init
and W
q
exp
, respectively.
Notice that out
x
is supposed to contain only new ob-
jects, which are absent in W
x
pre
, but present in W
q
post
.
In case of a service type s, the objects of out
s
are pro-
duced as the result of a world transformation to be
defined in Sec. 2.2.
2.1 Abstract Planning Overview
Overall, the main goal of APP is to find a composi-
tion of service types satisfying a user query, which
specifies some initial and some expected worlds. In-
tuitively, an initial world contains the objects owned
by the user, whereas an expected world consists of
the objects required to be the result of the service
composition. In order to formally define how this is
achieved, we need to introduce several auxiliary con-
cepts.
Definition 7 (Compatible Object States). Let o,o
0
O, and let v and v
0
be valuation functions. We
say that v
0
(o
0
) is compatible with v(o), denoted by
v
0
(o
0
)
ob j
v(o), iff:
the types of both objects are the same, or the type
of o
0
is a subtype of type of o, i.e., type(o) =
type(o
0
) or (type(o
0
),type(o)) Ext, and
for all attributes of o, we have that v
0
agrees with
v, i.e.,
aattr(o)
v
0
(o
0
,a) = v(o, a).
Intuitively, an object of a richer type (o
0
) is com-
patible with the one of a base type (o), provided that
the valuations of all common attributes are equal.
Definition 8 (Worlds Compatibility). Let w, w
0
W
be worlds, and let w = (O, v), and w
0
= (O
0
,v
0
).
We say that the world w
0
is compatible with the
world w, denoted by w
0
wrl
w, iff there exists a
TowardsSMT-basedAbstractPlanninginPlanICSOntology
125
one-to-one mapping map : O 7− O
0
such that
oO
v
0
(map(o))
ob j
v(o).
Intuitively, w
0
is compatible with w if both of them
contain the same number of objects and for each ob-
ject from w there exists a compatible object in w
0
.
Definition 9 (Worlds Sub-compatibility). Let w, w
0
be
worlds such that w = (O,v) and w
0
= (O
0
,v
0
). The
world w
0
is called sub-compatible with the world w,
denoted by w
0
swrl
w iff there exists a sub-world of w
0
compatible with w.
2.2 World Transformations
One of the fundamental concepts in our approach con-
cerns a world transformation. A world w, called a
world before, can be transformed by a service type
s, having specification spec
s
, if w is sub-compatible
with some input world of s. The result of such a
transformation is a world w
0
, called a world after, in
which the objects of out
s
appear, and, as well as the
objects of inout
s
, they are in the states consistent with
some output world of s. The other objects of w do
not change their states. In a general case, there may
exist a number of worlds possible to obtain after a
transformation of a given world by a given service
type, because more than one sub-world of w can be
compatible with an input world of s. Therefore, we
introduce a context function, which provides a strict
mapping between objects from the worlds before and
after, and the objects from the input and output worlds
of a service type s.
Definition 10 (Context Function). A context function
ctx
s
O
: in
s
inout
s
out
s
7− O is an injection, which
for a given service type s and a set of objects O as-
signs an object from O to each object from in
s
, inout
s
,
and out
s
.
Now, we can define a world transformation.
Definition 11 (World Transformation). Let w, w
0
W
be worlds, called a world before and a world af-
ter, respectively, and s = (W
s
pre
,W
s
post
) be a service
type. Assume that w = (O, v), w
0
= (O
0
,v
0
), where
O O
0
O, and v, v
0
are valuation functions. Let
ctx
s
O
0
be a context function, and the sets IN, IO, OU
be the ctx
s
O
0
images of the sets in
s
, inout
s
, and out
s
, re-
spect., i.e., IN = ctx
s
O
0
in
s
, IO = ctx
s
O
0
inout
s
, and
OU = ctx
s
O
0
out
s
. Moreover, let IN,IO (O O
0
)
and OU = (O
0
\ O).
We say that a service type s transforms the world
w into w
0
in the context ctx
s
O
0
, denoted by w
s,ctx
s
O
0
w
0
, if for some v
s
pre
V
s
pre
and v
s
post
V
s
post
, all the
following conditions hold:
1.
IN, v(IN)
wrl
in
s
,v
s
pre
(in
s
)
,
2. (IO, v(IO))
wrl
inout
s
,v
s
pre
(inout
s
)
,
3. (IO, v
0
(IO))
wrl
inout
s
,v
s
post
(inout
s
)
,
4. (OU,v
0
(OU))
wrl
out
s
,v
s
post
(out
s
)
,
5.
o(O\IO)
aattr(o)
v(o,a) = v
0
(o,a).
Intuitively, (1) the world before contains a sub-
world built over IN, which is compatible with a sub-
world of some input world of the service type s, built
over the objects from in
s
. (2) The world before con-
tains a sub-world built over IO, which is compatible
with a sub-world of the input world of the service
type s, built over the objects from inout
s
. (3) Af-
ter the transformation the state of objects from IO is
consistent with post
s
. (4) The objects produced dur-
ing the transformation (OU) are in a state consistent
with post
s
. (5) The objects from IN and the objects
not involved in the transformation do not change their
states.
Definition 12 (Transformation Sequences). Let seq =
(s
1
,ctx
s
1
O
1
),...,(s
k
,ctx
s
k
O
k
)
be a sequence of length
k, where, for 1 i k, s
i
S, O
i
O, and ctx
s
i
O
i
is
a context function. We say that a world w
0
is trans-
formed by the sequence seq into a world w
k
, denoted
by w
0
seq
w
k
, iff there exists a sequence of worlds
(w
1
,w
2
,...,w
k1
) such that
1ik
w
i1
s
i
,ctx
s
i
O
i
w
i
=
(O
i
,v
i
) for some v
i
.
A sequence seq is called a transformation se-
quence, if there are two worlds w,w
0
W such that
w is transformed by seq into w
0
, i.e., w
seq
w
0
. The set
of all the transformation sequences is denoted by
~
S.
Having the transformation sequences defined, we
introduce the concept of user query solutions or sim-
ply solutions, in order to define a plan.
Definition 13 (User Query Solution). Let seq be a
transformation sequence and q = (W
q
init
,W
q
exp
) be a
user query. We say that seq is a solution of q, if for
w W
q
init
and some world w
0
such that w
seq
w
0
, we
have w
0
swrl
w
q
exp
, for some w
q
exp
W
q
exp
. The set of all
the solutions of the user query q is denoted by QS(q).
Intuitively, by a solution of q we mean every trans-
formation sequence transforming some initial world
of q, to a world sub-compatible to some expected
world of q.
2.3 Plans
Basing on the definition of a solution to the user query
q, we can now define the concept of an (abstract) plan,
by which we mean a non-empty set of solutions of q.
We define a plan as an equivalence class of the so-
lutions, which do not differ in the service types used.
KEOD2013-InternationalConferenceonKnowledgeEngineeringandOntologyDevelopment
126
The idea is that we do not want to distinguish between
solutions composed of the same service types, which
differ only in the ordering of their occurrences. So
we group them into the same class. There are clearly
two motivations behind that. Firstly, the user is typi-
cally not interested in obtaining many very similar so-
lutions. Secondly, from the efficiency point of view,
the number of equivalence classes can be exponen-
tially smaller than the number of the solutions. To this
aim, we introduce an equivalence relation partitioning
the set of all the solutions into distinct plans.
Definition 14 (Equivalence of User Query Solutions).
Let the function count :
~
S × S 7− N be such that
count(seq, s) returns the number of occurrences of the
service type s in the transformation sequence seq. The
equivalence relation QS(q)×QS(q) is defined as
follows: seq seq
0
iff count(seq, s) = count(seq
0
,s)
for each s S.
Intuitively, two user query solutions are equivalent
if they consist of the same number of the same service
types, regardless of the contexts.
Definition 15 (Abstract Plans). Let seq QS(q) be
a solution of some user query q. An abstract plan is
a set of all the solutions equivalent to seq, i.e., it is
equal to [seq]
.
It is important to notice that all the solutions
within an abstract plan are built over the same mul-
tiset of service types. The following result shows that
APP is a hard problem.
Theorem 1. The abstract planning problem is NP-
hard.
Proof Sketch. Let P be a set of propositions. We de-
fine a translation of 3-SAT to the problem of existence
of a user query solution. Let ϕ = ϕ
1
··· ϕ
n
, where
each clause ϕ
i
= l
i
1
l
i
2
l
i
3
with l
i
j
= p or l
i
j
= ¬p
for p P. We build an ontology of service types ST
and a user query q such that there is a plan for q over
ST iff ϕ is satisfiable. ST =
S
n
i=1
{s
i
1
,s
i
2
,s
i
3
},spec
s
i
j
=
in=
/
0,inout ={(o, O)}, out ={(o
i
,O
i
)}, pre= post =
isSet(o.p) if l
i
j
= p; pre = post = isNull(o.p) if l
i
j
=
¬p
,spec
q
=
in=
/
0,inout={(o, O)}, out={(o
i
,O
i
) |
1 i n}, pre = post =true
. The object o of type
O has the attribute o.p for each propositional variable
p used in ϕ. It is easy to show that there is a user so-
lution of q over ST iff there is a valuation satisfying
ϕ.
Below, we present an example showing an ontol-
ogy, a user query, and several solutions.
Example 1. Assume that Selling (S), Transport (T ),
and Assembly (A) are service types, while Boards,
Nails, and Doghouse are object types extending the
object type Ware. Because of space limit, we do not
give the attributes and the pre and post conditions.
S is able to provide any Ware (out
S
={(w, Ware)}),
T can deliver any Ware to the requested destina-
tion (inout
T
= {(w, Ware)}), and A can build a dog-
house using nails and boards (inout
A
={(b, Boards),
(n, Nails)}, out
A
={(d, Doghouse)}). The goal is to
get a doghouse, (the user query q: in
q
=inout
q
=
/
0,
out
q
={(d
1
, Doghouse)}). The shortest solution to q
is (S, T ). This is the only solution of the plan rep-
resented by the multiset [S, T ]. Another solution is
(S, T, S,T, A), where the first pair (S, T ) provides and
transports boards while the second pair (S, T ) pro-
vides and delivers nails, which are finally assembled
by A. This solution gives another abstract plan repre-
sented by [A,S,S, T,T ]. Note that there exists another
equivalent solution, namely, (S, S, T, T, A).
3 SMT-BASED SYMBOLIC
ENCODING
This section presents a symbolic encoding of APP by
an SMT formula, which is then tested for satisfiabil-
ity by an SMT-solver. First, we give an overview of
our planning algorithm, and discuss the structure of
the formula ϕ
q
k
encoding APP. Then, we present the
symbolic representation of the objects and the worlds,
followed by a sketch of the encoding of selected com-
ponents of ϕ
q
k
.
3.1 Abstract Planning Algorithm
Given an ontology, a user query, and parameters k
min
and k
max
, the planner is searching for solutions of
length k such that k
min
k k
max
. The algorithm
begins with k = k
min
and is looking for a user query
solution of length k, by checking the satisfiability of a
formula encoding APP.
When the solver returns SAT, this means that a so-
lution has been found. This solution is then analysed
as a representative of some abstract plan. As a result,
a blocking formula is computed, which is used to ex-
clude from a further search all the solutions belonging
to this abstract plan. If the solver returns UNSAT, then
there is no more plans of length k. If k does not ex-
ceed k
max
, then k is increased by 1, the new step of the
composition is encoded, and the search continues for
a possibly longer plan, until k
max
is reached. Overall,
to find a plan of length k satisfying the query q, we
build the following SMT-formula ϕ
q
k
:
ϕ
q
k
= I
q
^
i=1..k
_
sS
T
s
i
E
q
k
B
q
k
, (1)
TowardsSMT-basedAbstractPlanninginPlanICSOntology
127
where I
q
and E
q
k
are formulas encoding the initial and
the expected worlds, resp., T
s
i
encodes a transforma-
tion of one world into another by a service type s, and
B
q
k
is a blocking formula.
3.2 Objects and Worlds
The objects and the worlds are represented by sets of
variables, which are first allocated in the memory of
an SMT-solver, and then used to build formulas men-
tioned in the previous subsection. The representation
of an object is called a symbolic object. It consists
of an integer variable representing the type of an ob-
ject, called a type variable, and a number of Boolean
variables to represent the object attributes, called the
attribute variables. In order to represent all types
and identifiers as numbers, we introduce a function
num : AP S O 7− N, which with every attribute,
object type, service type, and object assigns a natural
number.
A symbolic world consists of a number of sym-
bolic objects. Each symbolic world is indexed by a
natural number from 0 to k. Formally, the i-th sym-
bolic object from the j-th symbolic world is a tu-
ple: o
i, j
= (t
i, j
,a
i,0, j
,a
i,1, j
,...,a
i,max
at
1, j
), where t
i, j
is the type variable, a
i,x, j
is the attribute variable for
0 x < max
at
, where max
at
is the maximal number of
the attribute variables needed to represent the object.
Note that actually a symbolic world represents a set
of worlds, and only a valuation of its variables makes
a single world. The j-th symbolic world is denoted by
w
j
, while the number of the symbolic objects in w
j
-
by |w
j
|. Fig. 1 shows subsequent symbolic worlds of
a transformation sequence.
o
0,0
o
1,0
o
3,0
o
4,0
o
2,0
s
1
Initial
Final
inout
q
o
0,1
o
1,1
o
3,1
o
4,1
o
2,1
s
2
w
0
w
1
o
5,1
o
6,1
o
0,1
o
1,1
in
q
out
s
1
o
0,1
o
1,1
o
3,2
o
4,2
o
2,2
s
k
w
2
o
5,2
o
6,2
o
0,2
o
1,2
o
7,2
o
8,2
out
s
2
...
o
0,1
o
1,1
o
3,k
o
4,k
o
2,k
w
k
o
5,k
o
6,k
o
0,k
o
1,k
o
7,k
o
8,k
o
x-1,k
o
x,k
...
out
s
1
...s
k
o
0,e
o
1,e
o
2,e
w
e
out
q
Expected
m
0,e
m
1,e
m
2,e
Figure 1: Symbolic worlds.
3.3 User Query
In order to encode the set W
q
init
by a symbolic world
w
0
, we allocate the variables needed to represent the
objects from in
q
inout
q
. Then, we build the formula
I
q
over these variables, which encodes the types and
the states of the objects from the initial worlds:
I
q
= t pF
w
0
,in
q
inout
q
stF
w
0
,W
q
init
(2)
The formula t pF(w
i
,O) encoding the types of the ob-
jects O over a symbolic world w
i
, is defined as:
t pF(w
i
,O) =
^
oO
t
num(o),i
= num
type(o)
The formula stF(w
i
,W ) encodes the states of the ob-
jects from the worlds W = (O, V ) over the symbolic
world w
i
:
stF(w
i
,W ) =
_
vV
^
oO
^
aattr(o)
vF(w
i
,v, o, a),
where vF(w
i
,v, o, a) is the expression encoding the
valuation v of the attribute o.a over the variables of
the symbolic world w
i
, defined as follows:
vF(w
i
,v, o, a) =
a
num(o),num(a),i
, if v(o,a) = true,
¬a
num(o),num(a),i
, if v(o, a) = false,
true, if v(o,a) is undef.
Thus, the symbolic world w
0
represents the initial
worlds. Then, after the first transformation we obtain
the symbolic world w
1
, enriched by the objects pro-
duced during the transformation (see Fig. 1). At the
k-th composition step, the symbolic world is trans-
formed by a service type s
k
, which results in the sym-
bolic world w
k
, representing the set of final worlds
possible to obtain after k transformations of the initial
worlds. The symbolic world w
k
contains a number of
“new” objects, produced in result of the subsequent
transformations. If the consecutive transformations
form a solution of the user query q, then among the
“new” objects are these from out
q
, requested by the
user.
Following Def. 6 we have W
q
exp
=
in
q
inout
q
out
q
,V
q
post
. First, we deal with the objects from in
q
inout
q
, which are encoded directly over the symbolic
world w
k
. Since these are the same objects as in the
initial worlds, we know their indices, and therefore
their states are encoded by the formula ioExp, defined
as follows:
ioExp(w
k
,W
q
exp
) =
stF
w
k
,
in
q
inout
q
,V
q
post
(in
q
inout
q
)
,
where V
q
post
in
q
inout
q
is the family of the valu-
ation functions V
q
post
restricted to the objects from
in
q
inout
q
. Note that the formula encoding the types
of the objects from in
q
inout
q
is redundant here. The
KEOD2013-InternationalConferenceonKnowledgeEngineeringandOntologyDevelopment
128
types are initially set by the formula encoding the ini-
tial worlds and the types are maintained between the
consecutive worlds by the formulas encoding the sub-
sequent world transformations (see Sec. 3.4).
Next, the objects of out
q
need to be identified
among the remaining objects of the symbolic world
w
k
, i.e., among these represented by the symbolic ob-
jects of indices greater than |w
0
|. To this aim, we al-
locate a new symbolic world w
e
with e = k
max
+ 1,
containing all the objects from out
q
. We encode their
states by the formula outExp:
outExp(w
e
,W
q
exp
)=stF
w
e
,
out
q
,V
q
post
(out
q
)
,
where V
q
post
out
q
is the family of the valuation func-
tions V
q
post
restricted to the objects from out
q
.
Next, we need to encode the types of these objects.
According to Def. 7, 9, and 13, a user query solution
ends with a world (call it final) sub-compatible with
an expected world. Notice that the objects from the
final world matched to the objects from out
q
, can be
their subtypes. This is the reason for introducing the
function subT : O 7− 2
N
\
/
0, which with every object
o assigns the set of natural numbers corresponding to
the type of o and all its subtypes.
Now, we define two formulas used for encoding
objects compatibility. The first one encodes all sub-
types of the objects from a given set O over a sym-
bolic world w
i
:
sbF(w
i
,O) =
^
oO
_
tsubT(o)
t
num(o),i
= t
The second formula encodes the compatibility of the
attribute valuations of two symbolic objects:
eqF(o
i, j
,o
m,n
)=
max
at
^
d=0
(a
i,d, j
=a
m,d,n
) (t
i, j
=t
m,n
)
Finally, to complete the encoding of the expected
worlds, we need a mapping between the objects from
a final world w
k
produced during the subsequent
transformations and the objects from w
e
. To this aim
we allocate p additional mapping variables in the
symbolic world w
e
, where p = |out
q
|. These vari-
ables, denoted by m
0,e
,...,m
p1,e
, are intended to
store the indices of the objects from a final world,
which are compatible with the objects encoded over
w
e
. Thus, the last part of the expected worlds encod-
ing is the formula:
mpF(w
e
,w
k
) =
^
o
i,e
w
e
|w
k
|−1
_
j=|w
0
|
eqF(o
i,e
,o
j,k
) m
i,e
= j
Now, we can put all the components together and
give the encoding of the expected worlds:
E
q
k
= ioExp(w
k
,W
q
exp
) sbF
w
e
,out
q
outExp(w
e
,W
q
exp
) mpF(w
e
,w
k
) (3)
3.4 World Transformation
According to Def. 11, given a service type s, a world
w, and a context function we can compute the world
w
0
obtained after such a transformation. Now, we
need to encode transformation sequences. In the pre-
vious subsection we presented the encoding of the ini-
tial and the expected worlds. Now, we need to al-
locate all intermediate symbolic worlds, and encode
over them all the possible transformation sequences.
Finally, the SMT-solver finds the valuations of such a
formula, if there exists any, and they allow to discover
the consecutive service types and the context func-
tions. Therefore, in this subsection we show an idea
how to build the formula encoding all the transforma-
tions w
s
w
0
over two subsequent symbolic worlds w
and w
0
.
For every planning step, i.e., for every transforma-
tion, we introduce additional sets of symbolic objects
in, io, and io
0
, the integer variable vs, and two sets of
integer mapping variables pin and pio. The symbolic
objects from in and io are used to represent the input
worlds of the service type being encoded. They corre-
spond to the sets IN and IO of Def. 11. The variable
vs represents the service type and the variables from
pin and pio are used to encode the context functions.
Finally, the objects from io
0
are used to encode the
objects modified during the transformation. The pro-
duced objects are encoded directly over the resulting
symbolic world.
The transformation of the worlds represented by
the symbolic world w
i
via a service type s into a sym-
bolic world w
i+1
is defined as follows:
T
s
i
=inF(in
i
,io
i
,W
s
pre
) cxF(w
i
,pin
i
,pio
i
)
ouF(w
i+1
,io
0
i
,W
s
post
) vs
i
= num(s)
cpF(w
i
,w
i+1
), (4)
where inF and ouF stand for input and output worlds,
resp., cxF encodes the context mappings, and cpF is
responsible for “copying” symbolic objects of w
i
not
involved in the transformation to w
i+1
. The detailed
definition of these formulas, built using similar con-
structions as for encoding a user query, is omitted due
to the lack of space.
3.5 Multiset Blocking
The last component of our encoding are the blocking
formulas, designed to prevent the search of solutions
TowardsSMT-basedAbstractPlanninginPlanICSOntology
129
Table 1: Experimental results.
(a) 1 plan in the search space
n k sat unsat time
[s] MB [s] MB [s]
64
6 6.31 8.8 4.77 15.8 12.8
9 19.49 17.5 38.08 83.8 58.7
12 156.4 41.9 622.3 684 781
15 469.7 229 > 2000
128
6 7.29 10.8 6.20 18.7 14.8
9 41.01 22.7 47.50 87.7 90.1
12 203.2 38.5 1757 1917 1962
15 382.1 47.9 > 2000
256
6 16.66 17.9 8.55 22.8 27.1
9 54.99 30.1 76.51 104 133
12 315.4 49.0 1628 1559 1947
15 1018 82.7 > 2000
(b) 10 plans in the search space
first next unsat time
[s] MB [s] MB [s] MB [s]
5.22 8.0 0.39 0.5 8.38 22.0 18.3
21.09 13.4 3.30 1.3 242.3 424 295
113.5 31.9 38.3 1.0 > 2000
413 240 458 0.5 > 2000
8.54 11.4 0.76 0.7 9.56 24.3 26.6
49.93 19.4 8.37 1.7 425.4 638 553
250.5 39.4 62.3 3.0 > 2000
1850 78 ? ? > 2000
11.93 16.1 0.64 0.6 18.34 36.6 38.1
113.3 32.5 5.54 2.0 810.8 1283 977
325.8 59.5 161 3.7 > 2000
931 72.3 925 11 > 2000
from already known classes (plans). To this aim, a
convenient representation of an abstract plan is a mul-
tiset of the service types occurring in a user query so-
lution.
In order to represent multisets, we need to encode
counting of service types occurrences in transforma-
tion sequences. Let B
?
be the set of all sequences of
Boolean values. We define a function cnt : B
?
7− N,
which every Boolean sequence assigns the number
of occurrences of the value true. The encoding of
this function makes use of two abilities of modern
SMT-solvers, namely ite (if-then-else) construct and
the ability of defining internal functions. Thus, we
encode the counting function as follows:
ct(b
1
,...,b
i
) =
(
ite(b
i
,1,0), for i = 1
ite(b
i
,1,0) + ct(b
1
,...,b
i1
), for i > 1
where the expression ite(b
i
,1,0) returns 1 if b
i
equals
true and 0 otherwise. Now, having a user query so-
lution we extract the sequence of service types s =
(s
1
,...,s
k
) and we compute its multiset representa-
tion M
s
=
(s
1
,c
1
),...,(s
n
,c
n
)
, where s
i
S, c
i
is
the number of occurrences of s
i
in the sequence, and
1 i n k. The formula blocking all solutions built
over a single multiset is as follows:
bl(M
s
) = ¬
n
^
i=1
ct
(vs
1
= s
i
),...,(vs
k
= s
i
)
= c
i
Assume that j abstract plans have been found, where
each plan is represented by a multiset. The formula
B
q
k
blocking the solutions from all these plans is as
follows:
B
q
k
=
j
^
i=1.. j
bl(M
s
i
) (5)
4 EXPERIMENTAL RESULTS
Below we discuss the experimental results. We imple-
mented our planner and evaluated its efficiency using
the ontologies, the user queries, and the abstract plans
generated by our Ontology Generator. The ontologies
and the queries are generated randomly, but meeting
the semantic rules, and in such a way that the number
of the existing abstract plans is equal to a value of a
given parameter.
The preliminary evaluation of our planner is pre-
sented in Tab. 1. The parameters of the experiments
are: the number of existing abstract plans (1 and
10), the number of the service types in each ontol-
ogy used (n), and the lengths of the abstract plans
(k). The remaining table columns display the sum-
mary results of the experiments. All presented data
are the average values, because each experiment was
repeated from 5 to 10 times. The results include the
following data: time and memory consumed by the
solver while searching for the first abstract plan (sat
and first columns), time and memory that the solver
needs to find a different plan (next), time and mem-
ory used by the solver for checking that there are
no different plans (unsat), and the total computation
time (time column). The experiments have been per-
formed on a computer equipped with 2.0GHz CPU
and 8GB RAM, using the SMT-solver Z3 (de Moura
and Bjørner, 2008). It follows from the experi-
ments that the consumption of computing resources
increases with the number of service types and the
length of the plan. However, when the first plan
is found, the next ones are computed several times
faster.
In order to evaluate the efficiency of the encod-
ing of the multiset blocking we have compared it with
the sequence blocking. To this aim we performed
KEOD2013-InternationalConferenceonKnowledgeEngineeringandOntologyDevelopment
130
0
1000
2000
3000
4000
5000
6000
7000
8000
90 900 1680 16800 34650
s
Multisets Sequences
Figure 2: Multiset blocking versus sequence blocking.
additional experiments, using our encoding in which
the formula (5) has been replaced by the one block-
ing the subsequent user query solutions. The results
are summarised in Fig. 2. We used 15 benchmarks
of Tab. 1, which do not exceed the 2000 sec. time-
out. The values of the x-axis are the numbers of user
query solutions, while the values of y-axis stand for
the time needed to find all the plans. The general
observation is that the more user query solutions ex-
ist, the more the multiset blocking outperforms the
sequence blocking, and thus it works as we have ex-
pected. Moreover, during the 2000 sec. time limit, us-
ing sequences blocking we are able to generate all the
solutions of length at most 9, while taking advantage
of the multisets encoding we can find all the plans
even for length 12. So, we are able to explore the
search space 2
24
times bigger in the same time.
We have compared the efficiency of our tool with
another system. The paper (Nam et al., 2008) reports
7 experiments performed on a set of 413 concrete
Web services, where SAT-time consumed for every
composition varies from 40 to 60 sec. We have re-
peated these experiments translating the input data to
the PlanICS ontology. PlanICS is able to find the short-
est solution in just fractions of a second of SAT-time
and in several seconds of the total computation time.
5 CONCLUSIONS
We presented an SMT-based approach to the abstract
planning problem. Our main idea is to find sig-
nificantly different abstract plans by partitioning the
search space into equivalence classes of user query
solutions. This concept has been realized by com-
puting formulas, which encode multisets representing
abstract plans, and blocking all solutions belonging to
the plans already known. We have implemented our
planner on the top of state of the art SMT-solver, and
evaluated it using a number of scalable benchmarks.
The experimental results are encouraging and confirm
the efficiency of our approach.
REFERENCES
Ambroszkiewicz, S. (2004). Entish: A language for de-
scribing data processing in open distributed systems.
Fundam. Inform., 60(1-4):41–66.
Bell, M. (2008). Introduction to Service-Oriented Model-
ing. John Wiley & Sons.
Bentakouk, L., Poizat, P., and Zaidi, F. (2011). Checking
the behavioral conformance of web services with sym-
bolic testing and an SMT solver. In Tests and Proofs,
volume 6706 of LNCS, pages 33–50. Springer.
Bersani, M. M., Cavallaro, L., Frigeri, A., Pradella, M.,
and Rossi, M. (2010). SMT-based verification of LTL
specification with integer constraints and its applica-
tion to runtime checking of service substitutability. In
SEFM, pages 244–254.
de Moura, L. M. and Bjørner, N. (2008). Z3: An efficient
SMT solver. In Proc. of TACAS’08, volume 4963 of
LNCS, pages 337–340. Springer-Verlag.
Doliwa, D., Horzelski, W., Jarocki, M., Niewiadomski, A.,
Penczek, W., P
´
ołrola, A., Szreter, M., and Zbrzezny,
A. (2011). PlanICS - a web service compositon
toolset. Fundam. Inform., 112(1):47–71.
Elwakil, M., Yang, Z., Wang, L., and Chen, Q. (2010). Mes-
sage race detection for web services by an SMT-based
analysis. In Proc. of the 7th Int. Conference on Auto-
nomic and Trusted Computing, ATC’10, pages 182–
194. Springer.
Gehlot, V. and Edupuganti, K. (2009). Use of colored petri
nets to model, analyze, and evaluate service compo-
sition and orchestration. In System Sciences, 2009.
HICSS ’09., pages 1 –8.
Li, Z., O’Brien, L., Keung, J., and Xu, X. (2010). Effort-
oriented classification matrix of web service compo-
sition. In Proc. of the Fifth International Conference
on Internet and Web Applications and Services, pages
357–362.
Mitra, S., Kumar, R., and Basu, S. (2007). Automated
choreographer synthesis for web services composition
using I/O automata. In ICWS, pages 364–371.
Monakova, G., Kopp, O., Leymann, F., Moser, S., and
Sch
¨
afers, K. (2009). Verifying business rules using
an SMT solver for BPEL processes. In BPSC, pages
81–94.
Nam, W., Kil, H., and Lee, D. (2008). Type-aware web ser-
vice composition using boolean satisfiability solver. In
Proc. of the CEC’08 and EEE’08, pages 331–334.
Rao, J., K
¨
ungas, P., and Matskin, M. (2006). Composition
of semantic web services using linear logic theorem
proving. Inf. Syst., 31(4):340–360.
Rao, J. and Su, X. (2004). A survey of automated web ser-
vice composition methods. In Proc. of SWSWPC’04,
volume 3387 of LNCS, pages 43–54. Springer.
Traverso, P. and Pistore, M. (2004). Automated compo-
sition of semantic web services into executable pro-
cesses. In The Semantic Web ISWC 2004, volume
3298 of LNCS, pages 380–394.
TowardsSMT-basedAbstractPlanninginPlanICSOntology
131