Topology / ALM-Compiler

A Java implementation of the ALM language that compiles to the SPARC variant of Answer Set Programming (ASP).
Apache License 2.0
0 stars 1 forks source link

CALM interface #37

Open zhangyuanlin opened 5 years ago

zhangyuanlin commented 5 years ago

A design proposal of the interface is below. Future discussion may be done here.

CALM: 
  input: theoryFile,  structureFile, [historyFile, taskFile]  
  output: a sparc program if input is theory and structure
              answers to the tasks specified in taskFile. 
              (sparc program and answer sets are always produced and stored in a default place.) 
              output results will be printed to the standard output. 
theoryFile: a file consisting of a theory. 
structureFile: a file consisiting of a structure
historyFile: a file consisting of a history 
taskFile: consisting of the specification of a task. 
A task specification: one of the following
===
System description
History (section) 
Tasks (section) 
[task1: ] Find current values of { f1, ..., fn}  
                    where fi is a fluent, variables allowed (as allowed in display section of SPARC).  
             (output: f1 = x, \newline f2 = y, \newline ) 
             (sorted or not: possibly future. pipeline maybe used to sort the output. ) 
             implementation: 
                 -answer sets is obtained 
                 -we may use display
                  - retrieve the fluent relation and map to fluent-value pair. 
[task2:  ] Find projected values of {f1, ..., fn} after executing (a1, ..., am) -- [ ({a11, ..., a1m}, ..., {an1, an2, ...})]
                   where ai is an action 
              (output: f1 = x, \newline f2 = y, \newline) 
              ( 
[task3:] Find plans for goal {f1=v1, ..., fn=vn} with horizon m.
                where fi is a fluent.  
            Allow history 
            (output:  
                plan 1 of 5: 
                    time step 1:  a1, ..., an
                    time step 2: a1, ..., am
                    time step 3:  ...)
[task 4:] Find diagnosis of {ob1, ...,  obm} with exogenous actions {a1, ..., an}
                 where obi is an observation now, and ai an exogenous action.
           History is assumed. {a1, ..., an} are called exogenous actions 
           (and they must be in the system description, all other actions in the system 
           description are called agent actions. It is assumed that all agent actions ever done are recorded 
           in the history, and normally relevant exogenous actions are recorded in the history.
           a diagnosis is a sequence of exogenous actions.
            (output:  
                Explanation 1 of 5: 
                    time step  -5: a1, ..., an
                    time step  -3: a1, ..., am
                    time step -1:  ...)
         Future assume there are missing steps between any two steps in the history.   In those steps exogenous actions may happen.  (Missing steps in between history steps). 
        implementation: 
               translate current observation, and history
                        required completeness of initial state
                        happened => occurs, for all steps 0.. n-1, n is the current step. 
                        for every observation, the believe shouldn't be in strong/strict contradiction with it.  
                               (observation doesn't change value of undefined fluent.   
                                      And does not cause contradiction. )
                       -- If this h
      configuration: 
              (history, current observation) is consistent if the program has an answerset.  
               Otherwise diagnostics are required.  
              Explanation 
                   occurs(A,I) :-  expl(A,I).  
                   expl(A,I) :+ if I befor n,  A is exogenous, and A didn't happen at I (not in history). 

=== 

For diagnostics, ``Just put diagnostic module somewhere and load the file with atoms of the form exogenous(a)." (from MG) -- see cr-rule on page 229 of KR book.

Topology commented 5 years ago

After discussion, diagnosis problem will use time steps of history for its actions.

For planning problem, start from time step N, where N-1 is the last time step in the history. Max step is N+M where M is the horizon.

Open question as how to approach counterfactual reasoning as a task.

Other possible task: Given an inconsistent history, what to remove from the history to make it consistent. (Related to debugging, diagnosis)