Hostname: page-component-74656f9884-qr5l4 Total loading time: 0 Render date: 2026-11-03T21:30:01.546Z Has data issue: false hasContentIssue false

Implementing Metric Temporal Answer Set Programming

Published online by Cambridge University Press:  24 September 2026

SUSANA HAHN
Affiliation:
Institute of Computer Science, University of Potsdam, Germany (e-mails: hahnmartinlu@uni-potsdam.de, arvidbecker@uni-potsdam.de)
ARVID BECKER
Affiliation:
Institute of Computer Science, University of Potsdam, Germany (e-mails: hahnmartinlu@uni-potsdam.de, arvidbecker@uni-potsdam.de)
PEDRO CABALAR
Affiliation:
Computer Science, University of Corunna, Spain (e-mail: cabalar@udc.es)
MARTÍN DIÉGUEZ
Affiliation:
Computer Science, Université d’Angers, France (e-mail: martin.dieguezlodeiro@univ-angers.fr)
JAVIER ROMERO
Affiliation:
Department of Computer Science, University of Potsdam, Germany (e-mails: javier@cs.uni-potsdam.de, torsten@cs.uni-potsdam.de)
TORSTEN SCHAUB
Affiliation:
Department of Computer Science, University of Potsdam, Germany (e-mails: javier@cs.uni-potsdam.de, torsten@cs.uni-potsdam.de)
Rights & Permissions [Opens in a new window]

Abstract

We develop a computational approach to Metric Answer Set Programming (ASP) to express quantitative temporal constrains, such as durations and deadlines. We investigate two specific fragments: plain metric logic programs, restricted to local temporal constraints, and general metric logic programs, which allow for arbitrary metric formulas. A central challenge in this context is maintaining scalability when dealing with fine-grained timing constraints, which can significantly exacerbate grounding bottleneck of ASP. To address this issue, we propose translations of both fragments into standard ASP and ASP extended with difference constraints, a simplified form of linear constraints, and prove their correctness and completeness. Our implementation, realized via meta-encodings, effectively decouples metric ASP from the granularity of time, resulting in a solution that is independent of time precision.

Information

Type
Original Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2026. Published by Cambridge University Press
Figure 0

Table 1. Durations between locationsTable 1 long description.

Figure 1

Table 2. Definition of sets η(ϕ)$\eta (\phi )$ and η∗(ϕ)$\eta ^*(\phi )$ for any metric temporal formula ϕ$\phi$Table 2 long description.

Figure 2

Table 3. Definition of sets ηk(φ)$\eta _k(\varphi )$ and ηk∗(φ)$\eta _k^*(\varphi )$ for any metric atom φ$\varphi$ and 0≤k<λ$0 \leq k \lt \lambda$Table 3 long description.

Figure 3

Fig. 1. Workflow of our implementations applied to the dentist example.

Figure 4

Listing 1. Metric logic program for dentist example (dentist.lp)

Figure 5

Listing 2. Metric logic program for the goal in dentist example (dentist-goal.lp)

Figure 6

Listing 3. Timed meta-encoding (meta.lp)

Figure 7

Listing 4. Meta encoding for base metric operators (bounded-base.lp)

Figure 8

Listing 5. Meta encoding for metric operators of Πλ(P)$\Pi _\lambda ({P})$ (bounded.lp)

Figure 9

Listing 6. Meta encoding for Δλ,ν$\Delta _{\lambda ,\nu }$ (time.lp)

Figure 10

Listing 7. Meta encoding for Ψλ,ν(P)$\Psi _{\lambda ,\nu }({P})$ (interval.lp)

Figure 11

Listing 8. Meta encoding for Δλc$\Delta ^{c}_{\lambda }$ (time-c.lp)

Figure 12

Listing 9. Meta encoding for Ψλc(P)$\Psi ^{c}_{\lambda }({P})$ (interval-c.lp)

Figure 13

Listing 10. Meta encoding for metric operators of Πλ(P)${\boldsymbol{\Pi }}_\lambda ({P})$ (bounded.lp)

Figure 14

Listing 11. Meta encoding for Ψλ,ν(P)${\boldsymbol{\Psi }}_{\lambda ,\nu }({P})$ (interval.lp)

Figure 15

Listing 12. Meta encoding for Ψλc(P)${\boldsymbol{\Psi }}^{c}_{\lambda }({P})$ (interval-c.lp)

Figure 16

Listing 13. System output showcasing the dentist example using clingo

Figure 17

Listing 14. System output showcasing the dentist example using clingcon

Figure 18

Table 4. Results for clingo, clingcon and clingo[dl] without goal condition (times in seconds; – represents a memout)Table 4 long description.

Figure 19

Table 5. Results for clingo, clingcon and clingo[dl] with goal condition, (times in seconds; – indicates the memory limit was reached)Table 5 long description.

Figure 20

Listing 15. Metric logic program for MAPF

Figure 21

Fig. 2. Empty grid (6 × 6).

Figure 22

Fig. 3. Random grid (8 × 8).

Figure 23

Fig. 4. Room grid (8 × 8).

Figure 24

Fig. 5. Warehouse grid (8 × 8).

Figure 25

Fig. 6. Fig. 6 long description.Total times for empty 6 × 6 grid MAPF instances with increasing number of agents. The shaded areas under the lines represent grounding time.

Figure 26

Fig. 7. Number of ground rules for empty 6 × 6 grid MAPF instances with increasing number of agents.

Figure 27

Fig. 8. Fig. 8 long description.Total times for 8 × 8 grid MAPF instances with increasing horizon. The shaded areas under the lines represent grounding time.

Figure 28

Listing 16. Metric logic program for Job-Shop Scheduling

Figure 29

Fig. 9. Fig. 9 long description.Total times for ft06 with time-point limit ν=55$\nu = 55$.

Figure 30

Fig. 10. Total times for ft06 with relaxed time-point limit ν=110$\nu = 110$.

Figure 31

Fig. 11. Number of ground rules for ft06 with time-point limit ν=55$\nu = 55$.

Figure 32

Fig. 12. Number of ground rules for ft06 with relaxed time-point limit ν=110$\nu = 110$.

Figure 33

Algorithm 1. Reduce (P, X, Y)Algorithm 1 long description.