<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>An ASP-based system for preference handling and planning.</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Stefania Costantini</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giovanni De Gasperis</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Niva Florio</string-name>
          <email>niva.florio@univaq.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Claudia Zuppella</string-name>
          <email>claudia.zuppella@hotmail.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dept. of Information Engineering</institution>
          ,
          <addr-line>Computer Science and Mathematics</addr-line>
          ,
          <institution>University of L'Aquila</institution>
          ,
          <addr-line>Via Vetoio, Coppito, L'Aquila</addr-line>
        </aff>
      </contrib-group>
      <fpage>253</fpage>
      <lpage>257</lpage>
      <abstract>
        <p>Internet and mobile applications are becoming more and more helpful and widespread, while our daily lives are becoming increasingly busy and complicated. Preferences affect our actions, as well as those of intelligent agents. Answer Set Programming is a suitable framework for a decision making process which aims at supporting users by suitably planning their activities. Resourced Answer Set Programming (RASP) provides mechanisms for the optimization of answer sets according to preferences and resources. In this paper, an ASP-based system integrated with a mobile application able to plan the activities of a user is proposed, taking into account the context in which the user is located, the available resources, the geographical position and user's preferences.</p>
      </abstract>
      <kwd-group>
        <kwd>answer set programming</kwd>
        <kwd>logic programming</kwd>
        <kwd>preference handling</kwd>
        <kwd>resource management</kwd>
        <kwd>planning and scheduling</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>Everyone’s daily life is becoming increasingly complicated and busy, and
preferences affect our daily actions and the way in which we try to achieve our
goals. On the other side, the technology, and in particular intelligent agents, is
potentially able to help us, since mobile applications and the web in
particular are becoming more and more helpful and are available on affordable mobile
devices. In this scenario, evaluation and adequate handling of user preferences
(expressed either in an explicit or in an implicit way) is becoming increasingly
useful. In fact, an adequate preference handling system can help the user in the
organization of everyday life. In fact, preferences affect the way intelligent agents
(including human) act, and their decision-making process.</p>
      <p>
        Approaches concerning preferences in (constraint) logic programming and
non-monotonic reasoning are widely studied (cf., e.g., [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] and [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]). More
specifically, reasoning on preferences in relation to Answer Set Programming
(ASP, cf., e.g., [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] and [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]) has been investigated (see among many
[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] and [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]) These approaches introduce preferences either globally (e.g.,
[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]) or among rules (e.g., [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]). Particularly suitable to our purposes seems to
be the Resourced Answer Set Programming (RASP), an extension of ASP that
supports declarative reasoning on consumption and production of resources and
allows to model and plan preferences on these aspects in a very simple way (see
[
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] and [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] for a comprehensive treatment about RASP).
      </p>
      <p>In this paper, we illustrate the design of an integrated system able to plan
activities of users, taking into account the context in which the user is located,
the available resources, the geographical position and her/his preferences. This
system, which is being implemented, is ASP- and RASP-based and can interact
with the user through a mobile application. In Section 2 we briefly overview
RASP, while in Section 3 the design of the system is described and in Section 4
we conclude.
2</p>
    </sec>
    <sec id="sec-2">
      <title>RASP</title>
      <p>Even resource production and consumption processes are connected with
preferences: in fact, an agent may prefer to use some resources and not others in a
given situation, or it may prefer to use available resources for obtaining a certain
resource rather than others. o</p>
      <p>
        Resourced Answer Set Programming (RASP) extends the ASP framework
by introducing resources and preferences. With RASP we can easily specify
available resources and the amount of resources needed to produce others: it
supports reasoning about resource consumption and production, according to
preferences. Resources are modelled by amount-atoms of the form q#a (q is the
kind of resource and a its available quantity 1). Amount-atoms are used in r-facts
(RASP-facts) to represent the available quantities of resources. Thanks to r-rules
(RASP-rules), a specific quantity of certain resources can be transformed into a
specific quantity of another resource: amount-atoms in the body of a rule model
the consumed resources, while in the head they model the resources produced
by that rule. An r-rule can be fired several times thanks to the prefix [N − M ]
(respectively the minimum and the maximum number of times a rule can be
fired). In the following example (1), the rule can be fired from one to four times,
producing from one to four portions of pasta according to available resources; to
produce one portion of pasta with pesto the needed resources are 80 gr. of pasta
and a little bottle of home made pesto, while to make that bottle of pesto we
need some grams of many ingredients:
[
        <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4">1 − 4</xref>
        ]pasta with pesto#1 ← pasta#80, home made pesto#1.
home made pesto#1 ← basil#15, garlic#1, pine nuts#25,
oil#10, grated parmesan#25.
basil#300. pine nut#250.
garlic#3. oil#120. grated parmesan#120.
(1)
1 For lack of space we do not consider management of quantities here, and in the
example we just use integers.
(2)
      </p>
      <p>
        If we want to clearly express which resource we prefer to use, we have to
introduce p-lists (i.e. preference-lists), where the leftmost element of the list has
high priority. For example, we can state that when we cook pasta with pesto we
prefer to use home made pesto rather than pesto from supermarket:
[
        <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4">1 − 4</xref>
        ]pasta with pesto#1 ←
pasta#80, (home made pesto#1 &gt; supermarket pesto#1).
      </p>
      <p>RASP provides also two kinds of conditional preference lists (cp-list ): pref when
and only when lists. Suppose that one prefers normal pasta instead of gluten
free pasta, but not in case of allergy : the only when condition is false and the
cp-list is ignored. And suppose that when one has guests, one prefers to use
home made pesto instead of supermarket pesto: if the condition has guest does
not hold, the cp-list becomes simply a disjunction.</p>
      <p>
        [
        <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4">1 − 4</xref>
        ]pasta with pesto#1 ←
(pasta#80 &gt; gluten f ree pasta#80 only when notallergy),
(3)
(home made pesto#1 &gt; supermarket pesto#1 pref when has guest).
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Framework Design</title>
      <p>The design of an ASP-based integrated system for preference and resource
management and planning is proposed here as a concrete application in real-world
contexts. The main purpose of this system is to simplify our daily life, and for
this reason the ASP-based system is integrated with web services to reach users
everywhere, in every moment and situation via inexpensive mobile devices,
typically smartphones. It is important to notice that the system is able to handle even
conditional preferences and priorities among preferences. Furthermore, starting
from the user’s geographic location, the system optimizes the preferred answer
sets according to her/his objectives, whether they are declared in an explicit or
implicit way.
Resources managed by the system are al least time and money, but the
enduser can define others, through a web application interface, so to ensure a simple
customization and personalization of the system. The framework is composed of
different parts (Fig. 1): a database, a web application, an answer set viewer and
the core of the system. In the database, the data needed by the system to make
inferences are stored. It is a NoSQL database (http://nosql-database.org/), useful
when we have to deal with a huge quantity of data that do not require a relational
model. NoSQL is the de facto standard for mobile applications, and has bee
chosen in view of efficiency and scalability, since the reasoning part is performed
by the ASP module and thus no complex queries are needed. Data extracted
from the database are processed by the data-transformer module, that
transforms query results into an ASP-compatible format. At first, a pre-processing
is needed: the system extracts the activities to plan and the preferences from
the database, and then constructs suitable RASP rules and ASP facts and rules
(needed to describe available resources and constraints). At this point, the files
built in the previous step are processed by the ASP/RASP reasoning module,
that consists of two parts: the ASP interpreter processes the data and grounds
the program; the RASP interpreter processes the ground program and produces
the preferred answer sets. Finally, these answer sets are transformed into a
format understandable by a non academic user: the interaction between end-users
and the system is made through the web application, via a smartphone. The end
interface also performs user monitoring and profiling, feeding the system with
new data, so as to elicit user needs, habits and preferences.</p>
      <p>In the implementation which is being developed, the database and ASP/RASP
parts are on a server, while the interface is on the mobile. In perspective (i.e.,
when a suitable deployment will be available) for the sake of scalability the
ASP/RASP part can be moved on the mobile.</p>
      <p>Let us provide an example of use. Assume that John wants to keep fit and
hates gyms, but loves being outdoors and is very busy because of his new job:
the system can produce a training program tailored for him in real time, that
changes from time to time according to his preferences, resources, objectives and
the place he actually is (the current user geographic and contextual location).
The database has a catalogue of gym exercises, John’s preferences (he hates gym,
loves being outdoors, etc.), his available resources (the amount of his free time
today, exercise equipment he has at home, parks nearby, and so on), resources
he wants to be produced (e.g. loss of weight). If it is a sunny day, but John is
very busy and has a lot of work to do: the system plans for him a run in the
park near the office during his lunch break and exercises suitable for outdoor.
However, if it is a rainy day and John had a rough day, the system plans for him
training less hard exercises he can do while watching TV.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Concluding Remarks</title>
      <p>The main purpose of the proposed framework is not to advance the state of the
art of ASP and RASP approaches, but to realize an innovative application of logic
programming, by means of an effective integration with modern technologies
affordable and understandable by everyone. The architecture includes in fact a
suitable user interface, which is being designed so as to be understandable also
by elder or impaired users, for which such a system can be particularly useful.</p>
      <p>The novelty is the design of the framework itself; it aims at moving ASP and
RASP outside the academic world, into the real world, and make them usable in
concrete situations by ordinary people. In fact, we gave two small examples that
can represent situations of our daily lives: in the first (see Section 1) the system
can be a cooking teacher who offers us recipes suitable to our needs, while in the
second (see Section 2) a personal trainer that offers custom workouts.</p>
      <p>As mentioned, an implementation is under way, where the system will be able
to automatically learn user preferences and objectives through machine learning
mechanisms typical of proactive and adaptive agents.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Anger</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schaub</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Truszczynski</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Aspargus-the Dagstuhl initiative</article-title>
          . (
          <year>2004</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Baral</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Knowledge representation, reasoning and declarative problem solving</article-title>
          . Cambridge University Press. (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Bienvenu</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lang</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , Wilson, N., et al.:
          <article-title>From preference logics to preference languages, and back</article-title>
          .
          <source>Proc. KR</source>
          <year>2010</year>
          .
          <article-title>(</article-title>
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Brewka</surname>
          </string-name>
          , G.:
          <article-title>Complex preferences for answer set optimization</article-title>
          .
          <source>In: Principles of Knowledge Representation and Reasoning: Proc. of the Ninth International Conference (KR2004)</source>
          .
          <fpage>213</fpage>
          -
          <lpage>223</lpage>
          . (
          <year>2004</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Costantini</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Formisano</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Petturiti</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Extending and implementing RASP</article-title>
          .
          <source>Fundamenta Informaticae</source>
          ,
          <volume>105</volume>
          (
          <issue>1</issue>
          ),
          <fpage>1</fpage>
          -
          <lpage>33</lpage>
          . (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Costantini</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Formisano</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Modeling preferences and conditional preferences on resource consumption and production in ASP</article-title>
          .
          <source>Journal of Algorithms</source>
          ,
          <volume>64</volume>
          (
          <issue>1</issue>
          ),
          <fpage>3</fpage>
          -
          <lpage>15</lpage>
          . (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Costantini</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Formisano</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Answer set programming with resources</article-title>
          .
          <source>Journal of Logic and Computation</source>
          ,
          <volume>20</volume>
          (
          <issue>2</issue>
          ),
          <fpage>53</fpage>
          -
          <lpage>571</lpage>
          . (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Cui</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Swift</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>Preference logic grammars: fixed point semantics and application to data standardization</article-title>
          .
          <source>Artif. Int.</source>
          ,
          <volume>138</volume>
          (
          <issue>1</issue>
          ),
          <fpage>117</fpage>
          -
          <lpage>147</lpage>
          . (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Domshlak</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hllermeier</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kaci</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Prade</surname>
          </string-name>
          , H.:
          <article-title>Preferences in AI: An overview</article-title>
          .
          <source>Artif. Intell</source>
          .
          <volume>175</volume>
          (
          <issue>7-8</issue>
          ),
          <fpage>1037</fpage>
          -
          <lpage>1052</lpage>
          . (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Gelfond</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Answer sets</article-title>
          .
          <source>Foundations of Artificial Intelligence</source>
          ,
          <volume>3</volume>
          ,
          <fpage>285</fpage>
          -
          <lpage>316</lpage>
          . (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Govindarajan</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jayaraman</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mantha</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Preference queries in deductive databases</article-title>
          .
          <source>New Generation Computing</source>
          ,
          <volume>19</volume>
          (
          <issue>1</issue>
          ),
          <fpage>57</fpage>
          -
          <lpage>86</lpage>
          . (
          <year>2001</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Guo</surname>
            ,
            <given-names>H.F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jayaraman</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          :
          <article-title>Mode-directed preferences for logic programs</article-title>
          .
          <source>In: Proc. of the 2005 ACM symposium on Applied computing</source>
          . ACM Press,
          <fpage>1414</fpage>
          -
          <lpage>1418</lpage>
          . (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Leone</surname>
          </string-name>
          , N.:
          <article-title>Logic programming and nonmonotonic reasoning: From theory to systems and applications</article-title>
          .
          <source>In: Logic Programming and Nonmonotonic Reasoning</source>
          . Springer, 1. (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Van Nieuwenborgh</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vermeir</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Preferred answer sets for ordered logic programs</article-title>
          .
          <source>Theory and Practice of Logic Programming</source>
          ,
          <volume>6</volume>
          (
          <issue>2</issue>
          ),
          <fpage>107</fpage>
          -
          <lpage>167</lpage>
          . (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>