SlideShare une entreprise Scribd logo
1  sur  37
Télécharger pour lire hors ligne
ACTION-BASED IMPERATIVE
PROGRAMMING WITH YAGI



Alexander Ferrein, Gerald Steinbauer, Stavros Vassos
Yet Another Golog Interpreter
2


       Golog [Levesque; Reiter; Lesperance; Lin; Scherl, „97]
         Agent   programming language
Yet Another Golog Interpreter
3


       Golog [Levesque; Reiter; Lesperance; Lin; Scherl, „97]
         Agent   programming language
           Can  be used to specify the high-level behavior of robots,
            software bots, and systems using conditionals, loops, and
            more sophisticated features
           Instead of operations on variables, it is based on actions that
            affect changing properties of the application domain


          Domain description           High-level Program
Yet Another Golog Interpreter
4


       YAGI: aiming toward a (more) practical Golog
        implementation
         Adopt a familiar syntax from popular software
          developing languages (C++, Java, Python, …)

         Identify a minimal subset of the full Golog
          functionality that can be used by non-experts

         Allow to be easily embedded to larger software
          projects and frameworks
The “smart elevator” example
5


       Simple running example to illustrate some of the
        basic functionality of Golog and YAGI

       Think of an elevator for a busy office center as an
        agent that follows a given high-level plan

         Whenever   there are pending floor requests pick one
          and serve the corresponding floor
Agent programming with Golog
6


       Logical domain description



       High-level program



          Domain description    High-level Program
Agent programming with Golog
7


       Logical domain description



       High-level program
         Specifies the behavior of the agent as a sketch of a
          plan using programming constructs

          Domain description        High-level Program
                                   Pick a floor with the button
                                       pressed and serve
Agent programming with Golog
8


       Logical domain description
         Fluents: the changing properties of the domain
         Actions: specify how the fluents change

       High-level program
         Specifies the behavior of the agent as a sketch of a
          plan using programming constructs

           Domain description           High-level Program
          Fluents: CurrentFloor, On    Pick a floor with the button
          Actions: Up, Down, TurnOff       pressed and serve
Agent programming with Golog
9


       Situation calculus
           FOL language specifically designed for reasoning about
            action and change

           Fluents: Similar to database relations but also conditioned
            on a situation argument: F(x,y,S0)

           S0 is the initial situation

           do(Α,S0) is the resulting situation after action A has been
            performed in S0

           Situations are used to refer to future states of the world
            F(x,y, do(A,S0))
Agent programming with Golog
10


        Logical domain description
          Fluent   CurrentFloor(x,s): elevator is located at floor x
            CurrentFloor(4,S0)

          Fluent   On(x,s): button pressed at floor x
            On(3,S0),   On(5,S0)



           Domain description

           Fluents: CurrentFloor, On
           Actions: Up, Down, TurnOff
Agent programming with Golog
11


        Logical domain description
          Action   Up(x)/Down(x): move up/downwards to floor x

          CurrentFloor(x,do(a,s))       a=Up(x)  a=Down(x)
              CurrentFloor(x,s)  y a=Up(y)  y a=Down(y)

          Poss(Up(x),s)     x ( CurrentFloor(y,s)  y<x )

           Domain description

           Fluents: CurrentFloor, On
           Actions: Up, Down, TurnOff
Agent programming with Golog
12


        High-level program
          Specifies the behavior of the agent as a sketch of a
           plan using programming constructs
        π x. ( (Up(x) | Down(x));
              TurnOff(x);
              open();
              close() )
                                      High-level Program
                                     Pick a floor with the button
                                         pressed and serve
Agent programming with Golog
13


        High-level program
          Specifies the behavior of the agent as a sketch of a
           plan using programming constructs
        π x. ( (Up(x) | Down(x));
              TurnOff(x);
              open();
              close() )
                                      High-level Program
        ServeAFloor()               Pick a floor with the button
                                         pressed and serve
Agent programming with Golog
14


        High-level program
          Off-line   vs On-line execution

        π x. ( (Up(x) | Down(x));
              TurnOff(x);
              open();
              close() )
           Domain description            High-level Program
           Fluents: CurrentFloor, On    Pick a floor with the button
           Actions: Up, Down, TurnOff       pressed and serve
Agent programming with Golog
15


        Golog programming constructs
Agent programming with Golog
16


        Logical domain description
          Precise   logical formulation based on situation calculus
        High-level program
          Precise   logical formulation based on Golog
        Typically implemented on top of some Prolog
         interpreter

           Domain description            High-level Program
           Fluents: CurrentFloor, On    Pick a floor with the button
           Actions: Up, Down, TurnOff       pressed and serve
Agent programming with Golog
17


        Programming requires understanding the semantics
          CurrentFloor(x,do(a,s))  a=Up(x)  a=Down(x)
             CurrentFloor(x,s)  y a=Up(y)  y
           a=Down(y)
          Poss(Up(x),s)    x ( CurrentFloor(y,s)  y<x )
         π   x. ( (Up(x) | Down(x)); TurnOff(x); open(); close() )

        Features of Prolog are implicitly used in the domain
         specification and the high-level program
Agent programming with Golog
18


        Programming requires understanding the semantics
          CurrentFloor(x,do(a,s))  a=Up(x)  a=Down(x)
             CurrentFloor(x,s)  y a=Up(y)  y
           a=Down(y)
          Poss(Up(x),s)    x ( CurrentFloor(y,s)  y<x )
         π   x. ( (Up(x) | Down(x)); TurnOff(x); open(); close() )

        Features of Prolog are implicitly used in the domain
         specification and the high-level program

        Confusing in practice for non-expert users
Yet Another Golog Interpreter
19


        Aiming toward a (more) practical Golog
         implementation

          Firstiteration (this paper): YAGI language specification
           as a stand-alone interpreted programming language
           with familiar syntax
Yet Another Golog Interpreter
20


        YAGI language

          Make fluents look like variables of popular
           programming languages

          Make actions look like functions of popular
           programming languages

        Unify the domain description and high-level
         program using this metaphor
Yet Another Golog Interpreter
21


        Make fluents look like variables of popular
         programming languages

          CurrentFloor(2,S0)


            YAGI>> fluent CurrentFloor;
             YAGI>> On = {2};

          Dictionary/Associative     array/Map
              Associatesto a flat list of values
              Multi-dimensional key (here On is 0-dimensional)
Yet Another Golog Interpreter
22


        Make fluents look like variables of popular
         programming languages

          On(3,S0),   On(5,S0)

            YAGI>> fluent On;
             YAGI>> On = {1,3}

          x ( On(x,S0)  (x=1  x=3) )
          Note that we (currently) aim for complete knowledge
Yet Another Golog Interpreter
23


        Make fluents look like variables of popular
         programming languages

          Set-theoretic   operations on the list of values

            YAGI>> On += 5
             YAGI>> On
             {1,3,5}
             YAGI>> On -= 1
             {3,5}
             YAGI>> 3 in On
             True
Yet Another Golog Interpreter
24


        Make actions look like functions of popular
         programming languages

          Action   Up(x)

            YAGI>> action Up($n)
               ...
             end action

          Specify local variables using a $ prefix
          Specify preconditions and effects as YAGI statements
           between fluents
Yet Another Golog Interpreter
25


        Make actions look like functions of popular
         programming languages

          Action   Up(x)

            YAGI>> action Up($n)
             precondition:
               ...
             effect:
               currentFloor = {$n}
             end action
Yet Another Golog Interpreter
26


        Make actions look like functions of popular
         programming languages

          Action   Up(x)

            YAGI>> action Up($n)
             precondition:
               ...
             effect:
               for $i in On do
                    currentFloor += $i
               end for
             end action
Yet Another Golog Interpreter
27


        Use the same syntax/metaphor to specify the
         high-level program

            YAGI>> proc serveAFloor()
               pick $n from On such
                 choose
                    up($n)
                 or
                    down($n)
                 end choose
                 turnOff($n); open(); close();
               end pick
             end proc
Yet Another Golog Interpreter
28


        High-level program calls: Each YAGI call is
         searched offline and then executed online

            YAGI>> On
             {3,5}
             YAGI>> serveAFloor()
             YAGI>> On
             {5}

             YAGI>> serveAFloor()
             YAGI>> On
             {}
Yet Another Golog Interpreter
29


        High-level program calls: Each YAGI call is
         searched offline and then executed online

            YAGI>> On
             {3,5}
             YAGI>> serveAFloor(); serveAFloor()
             YAGI>> On
             {}
Yet Another Golog Interpreter
30


        Interoperability using string signals
        (Inspired from web services, aiming for XML-like or
         JSON-like interoperability)

            YAGI>> action Up($n)
             precondition:
               ...
             effect:
              ...
             signal:
              "Move up to floor " + $n
             end action
Yet Another Golog Interpreter
31


        High-level program calls: Each YAGI call is
         searched offline and then executed online

            YAGI>> serveAFloor()
             “Move up to floor 5”
             “Turn-off button at floor 5”
             “Open elevator door”
             “Close elevator door”
             YAGI>> serveAFloor()
             “Move up to floor 3”
             “Turn-off button at floor 3”
             “Open elevator door”
             “Close elevator door”
Yet Another Golog Interpreter
32


        High-level program calls: Each YAGI call is
         searched offline and then executed online

            YAGI>> serveAFloor(); serveAFloor()
             “Move up to floor 5”
             “Turn-off button at floor 5”
             “Open elevator door”
             “Close elevator door”
             “Move up to floor 3”
             “Turn-off button at floor 3”
             “Open elevator door”
             “Close elevator door”
Situation calculus semantics
33


        YAGI operates as a persistent object that
          Holdsa situation calculus basic action theory
          Responds to a YAGI call by
            finding an appropriate sequence of actions to perform
             following Golog semantics
            updating the theory by progressing the initial knowledge
             based executing each action one by one
            producing signals along the way

          Responds   to a YAGI declaration by updating directly
           the specification of the theory
Situation calculus semantics
34


        Differences with the family of Golog languages
          Complete   knowledge
          No while loops in the language (only for loops)

          Addition and equality support with Presburger
           arithmetic
          Progression is built-in the semantics
Current and future work
35


        Aiming toward a (more) practical Golog
         implementation

          Firstiteration (this paper): YAGI language specification
           as a stand-alone interpreted programming language
           with familiar syntax
            YAGI  BNF spefication in the paper
            Parser available online: http://code.google.com/p/yagi/


          Second iteration (current and future work):
           YAGI prototype interpreter
            C++, Java, Lua
            On top of existing Prolog implementation
Conclusions
36


        YAGI: First formal specification of Golog as a non
         logic-based programming language
        A roadmap for some essential requirements
          Non-functional   requirements
            Q1: Familiarity
            Q2: Embeddedness
            Q3: Interoperability
            Q4: Transparency

          Functional   requirements
            F1-F12:  Action-based, imperative, goal-oriented, arithmetic,
             queries, null values, probabilistic values, sensing, …
ACTION-BASED IMPERATIVE
PROGRAMMING WITH YAGI



Alexander Ferrein, Gerald Steinbauer, Stavros Vassos

Contenu connexe

Plus de Stavros Vassos

Pathfinding - Part 3: Beyond the basics
Pathfinding - Part 3: Beyond the basicsPathfinding - Part 3: Beyond the basics
Pathfinding - Part 3: Beyond the basicsStavros Vassos
 
Pathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in UnityPathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in UnityStavros Vassos
 
Pathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic searchPathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic searchStavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2Stavros Vassos
 
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCsThe SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCsStavros Vassos
 

Plus de Stavros Vassos (13)

Pathfinding - Part 3: Beyond the basics
Pathfinding - Part 3: Beyond the basicsPathfinding - Part 3: Beyond the basics
Pathfinding - Part 3: Beyond the basics
 
Pathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in UnityPathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in Unity
 
Pathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic searchPathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic search
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
 
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCsThe SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
 

Dernier

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Dernier (20)

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 

Action-Based Imperative Programming with YAGI

  • 1. ACTION-BASED IMPERATIVE PROGRAMMING WITH YAGI Alexander Ferrein, Gerald Steinbauer, Stavros Vassos
  • 2. Yet Another Golog Interpreter 2  Golog [Levesque; Reiter; Lesperance; Lin; Scherl, „97]  Agent programming language
  • 3. Yet Another Golog Interpreter 3  Golog [Levesque; Reiter; Lesperance; Lin; Scherl, „97]  Agent programming language  Can be used to specify the high-level behavior of robots, software bots, and systems using conditionals, loops, and more sophisticated features  Instead of operations on variables, it is based on actions that affect changing properties of the application domain Domain description High-level Program
  • 4. Yet Another Golog Interpreter 4  YAGI: aiming toward a (more) practical Golog implementation  Adopt a familiar syntax from popular software developing languages (C++, Java, Python, …)  Identify a minimal subset of the full Golog functionality that can be used by non-experts  Allow to be easily embedded to larger software projects and frameworks
  • 5. The “smart elevator” example 5  Simple running example to illustrate some of the basic functionality of Golog and YAGI  Think of an elevator for a busy office center as an agent that follows a given high-level plan  Whenever there are pending floor requests pick one and serve the corresponding floor
  • 6. Agent programming with Golog 6  Logical domain description  High-level program Domain description High-level Program
  • 7. Agent programming with Golog 7  Logical domain description  High-level program  Specifies the behavior of the agent as a sketch of a plan using programming constructs Domain description High-level Program Pick a floor with the button pressed and serve
  • 8. Agent programming with Golog 8  Logical domain description  Fluents: the changing properties of the domain  Actions: specify how the fluents change  High-level program  Specifies the behavior of the agent as a sketch of a plan using programming constructs Domain description High-level Program Fluents: CurrentFloor, On Pick a floor with the button Actions: Up, Down, TurnOff pressed and serve
  • 9. Agent programming with Golog 9  Situation calculus  FOL language specifically designed for reasoning about action and change  Fluents: Similar to database relations but also conditioned on a situation argument: F(x,y,S0)  S0 is the initial situation  do(Α,S0) is the resulting situation after action A has been performed in S0  Situations are used to refer to future states of the world F(x,y, do(A,S0))
  • 10. Agent programming with Golog 10  Logical domain description  Fluent CurrentFloor(x,s): elevator is located at floor x  CurrentFloor(4,S0)  Fluent On(x,s): button pressed at floor x  On(3,S0), On(5,S0) Domain description Fluents: CurrentFloor, On Actions: Up, Down, TurnOff
  • 11. Agent programming with Golog 11  Logical domain description  Action Up(x)/Down(x): move up/downwards to floor x  CurrentFloor(x,do(a,s))  a=Up(x)  a=Down(x)  CurrentFloor(x,s)  y a=Up(y)  y a=Down(y)  Poss(Up(x),s)  x ( CurrentFloor(y,s)  y<x ) Domain description Fluents: CurrentFloor, On Actions: Up, Down, TurnOff
  • 12. Agent programming with Golog 12  High-level program  Specifies the behavior of the agent as a sketch of a plan using programming constructs  π x. ( (Up(x) | Down(x)); TurnOff(x); open(); close() ) High-level Program Pick a floor with the button pressed and serve
  • 13. Agent programming with Golog 13  High-level program  Specifies the behavior of the agent as a sketch of a plan using programming constructs  π x. ( (Up(x) | Down(x)); TurnOff(x); open(); close() ) High-level Program  ServeAFloor() Pick a floor with the button pressed and serve
  • 14. Agent programming with Golog 14  High-level program  Off-line vs On-line execution  π x. ( (Up(x) | Down(x)); TurnOff(x); open(); close() ) Domain description High-level Program Fluents: CurrentFloor, On Pick a floor with the button Actions: Up, Down, TurnOff pressed and serve
  • 15. Agent programming with Golog 15  Golog programming constructs
  • 16. Agent programming with Golog 16  Logical domain description  Precise logical formulation based on situation calculus  High-level program  Precise logical formulation based on Golog  Typically implemented on top of some Prolog interpreter Domain description High-level Program Fluents: CurrentFloor, On Pick a floor with the button Actions: Up, Down, TurnOff pressed and serve
  • 17. Agent programming with Golog 17  Programming requires understanding the semantics  CurrentFloor(x,do(a,s))  a=Up(x)  a=Down(x)  CurrentFloor(x,s)  y a=Up(y)  y a=Down(y)  Poss(Up(x),s)  x ( CurrentFloor(y,s)  y<x ) π x. ( (Up(x) | Down(x)); TurnOff(x); open(); close() )  Features of Prolog are implicitly used in the domain specification and the high-level program
  • 18. Agent programming with Golog 18  Programming requires understanding the semantics  CurrentFloor(x,do(a,s))  a=Up(x)  a=Down(x)  CurrentFloor(x,s)  y a=Up(y)  y a=Down(y)  Poss(Up(x),s)  x ( CurrentFloor(y,s)  y<x ) π x. ( (Up(x) | Down(x)); TurnOff(x); open(); close() )  Features of Prolog are implicitly used in the domain specification and the high-level program  Confusing in practice for non-expert users
  • 19. Yet Another Golog Interpreter 19  Aiming toward a (more) practical Golog implementation  Firstiteration (this paper): YAGI language specification as a stand-alone interpreted programming language with familiar syntax
  • 20. Yet Another Golog Interpreter 20  YAGI language  Make fluents look like variables of popular programming languages  Make actions look like functions of popular programming languages  Unify the domain description and high-level program using this metaphor
  • 21. Yet Another Golog Interpreter 21  Make fluents look like variables of popular programming languages  CurrentFloor(2,S0)  YAGI>> fluent CurrentFloor; YAGI>> On = {2};  Dictionary/Associative array/Map  Associatesto a flat list of values  Multi-dimensional key (here On is 0-dimensional)
  • 22. Yet Another Golog Interpreter 22  Make fluents look like variables of popular programming languages  On(3,S0), On(5,S0)  YAGI>> fluent On; YAGI>> On = {1,3}  x ( On(x,S0)  (x=1  x=3) )  Note that we (currently) aim for complete knowledge
  • 23. Yet Another Golog Interpreter 23  Make fluents look like variables of popular programming languages  Set-theoretic operations on the list of values  YAGI>> On += 5 YAGI>> On {1,3,5} YAGI>> On -= 1 {3,5} YAGI>> 3 in On True
  • 24. Yet Another Golog Interpreter 24  Make actions look like functions of popular programming languages  Action Up(x)  YAGI>> action Up($n) ... end action  Specify local variables using a $ prefix  Specify preconditions and effects as YAGI statements between fluents
  • 25. Yet Another Golog Interpreter 25  Make actions look like functions of popular programming languages  Action Up(x)  YAGI>> action Up($n) precondition: ... effect: currentFloor = {$n} end action
  • 26. Yet Another Golog Interpreter 26  Make actions look like functions of popular programming languages  Action Up(x)  YAGI>> action Up($n) precondition: ... effect: for $i in On do currentFloor += $i end for end action
  • 27. Yet Another Golog Interpreter 27  Use the same syntax/metaphor to specify the high-level program  YAGI>> proc serveAFloor() pick $n from On such choose up($n) or down($n) end choose turnOff($n); open(); close(); end pick end proc
  • 28. Yet Another Golog Interpreter 28  High-level program calls: Each YAGI call is searched offline and then executed online  YAGI>> On {3,5} YAGI>> serveAFloor() YAGI>> On {5} YAGI>> serveAFloor() YAGI>> On {}
  • 29. Yet Another Golog Interpreter 29  High-level program calls: Each YAGI call is searched offline and then executed online  YAGI>> On {3,5} YAGI>> serveAFloor(); serveAFloor() YAGI>> On {}
  • 30. Yet Another Golog Interpreter 30  Interoperability using string signals  (Inspired from web services, aiming for XML-like or JSON-like interoperability)  YAGI>> action Up($n) precondition: ... effect: ... signal: "Move up to floor " + $n end action
  • 31. Yet Another Golog Interpreter 31  High-level program calls: Each YAGI call is searched offline and then executed online  YAGI>> serveAFloor() “Move up to floor 5” “Turn-off button at floor 5” “Open elevator door” “Close elevator door” YAGI>> serveAFloor() “Move up to floor 3” “Turn-off button at floor 3” “Open elevator door” “Close elevator door”
  • 32. Yet Another Golog Interpreter 32  High-level program calls: Each YAGI call is searched offline and then executed online  YAGI>> serveAFloor(); serveAFloor() “Move up to floor 5” “Turn-off button at floor 5” “Open elevator door” “Close elevator door” “Move up to floor 3” “Turn-off button at floor 3” “Open elevator door” “Close elevator door”
  • 33. Situation calculus semantics 33  YAGI operates as a persistent object that  Holdsa situation calculus basic action theory  Responds to a YAGI call by  finding an appropriate sequence of actions to perform following Golog semantics  updating the theory by progressing the initial knowledge based executing each action one by one  producing signals along the way  Responds to a YAGI declaration by updating directly the specification of the theory
  • 34. Situation calculus semantics 34  Differences with the family of Golog languages  Complete knowledge  No while loops in the language (only for loops)  Addition and equality support with Presburger arithmetic  Progression is built-in the semantics
  • 35. Current and future work 35  Aiming toward a (more) practical Golog implementation  Firstiteration (this paper): YAGI language specification as a stand-alone interpreted programming language with familiar syntax  YAGI BNF spefication in the paper  Parser available online: http://code.google.com/p/yagi/  Second iteration (current and future work): YAGI prototype interpreter  C++, Java, Lua  On top of existing Prolog implementation
  • 36. Conclusions 36  YAGI: First formal specification of Golog as a non logic-based programming language  A roadmap for some essential requirements  Non-functional requirements  Q1: Familiarity  Q2: Embeddedness  Q3: Interoperability  Q4: Transparency  Functional requirements  F1-F12: Action-based, imperative, goal-oriented, arithmetic, queries, null values, probabilistic values, sensing, …
  • 37. ACTION-BASED IMPERATIVE PROGRAMMING WITH YAGI Alexander Ferrein, Gerald Steinbauer, Stavros Vassos