Learning Resources for v1.0.x

Index


Cycles

LPS execution happens in discretely timestamped cycles. There are three steps that occur in each cycle:

  1. Updating the database based on selected actions and observed events
  2. Process reactive rules
  3. Process goal clauses

The database is updated destructively according to a domain-specific causal theory specified in the given LPS program. An executed action or externally observed event can either initiate a fluent, terminate a fluent or update a fluent.

Halting Conditions

Theorectically speaking, LPS cycles can go on infinitely without stopping. However, for practicality, there are several halting conditions of a LPS program:

  • The maximum execution time of the program has reached.
  • Program specifically requested to halt.
  • An error has occurred during the cycle.

The maximum number of cycles allowed for the execution of a LPS program can be set using the maxTime/1 definition. By default, the maximum number of cycles allowed is 20 if no definition for maxTime/1 is given. For example to set the maximum timestamp to 12:

maxTime(12).

To specifically request for the program to be halted, the term lpsHalt/0 can be used. Upon execution of the lpsHalt/0, the interpreter will finish the current cycle and stop execution. To write a rule that says if an event operationComplete was observed, the program halts:

operationComplete(T1, T2) -> lpsHalt.