Manuscript Offprint
arXiv:2611.09022Optimal Probabilistic Answer Set Programming: Complexity and Implementations
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.
TPLP: Page 1–8. © The Author(s), 2021. Published by Cambridge University Press 2021 doi:10.1017/xxxxxx
1
Optimal Probabilistic Answer Set Programming: Complexity and Implementations*
DAMIANO AZZOLINI
University of Ferrara
GIUSEPPE MAZZOTTA
University of Calabria
FRANCESCO RICCA
University of Calabria
FABRIZIO RIGUZZI
University of Ferrara
submitted xx xx xxxx; revised xx xx xxxx; accepted xx xx xxxx
Abstract
Probabilistic Answer Set Programming (PASP) extends Answer Set Programming with the possibility of representing uncertain data. Among the possible available semantics, we focus here on the credal semantics. In this setting, prior work has focused exclusively on plain ASP programs, i.e., programs without optimization constructs. However, many real world tasks define optimality criteria over the possible solutions, which cannot be conveniently modeled with existing probabilistic ASP frameworks. In this paper, we close this gap and propose optimal Probabilistic Answer Set Programming, which extends PASP by also allowing weak constraints, which are the standard optimization construct of ASP. We define the semantics of such programs, study the computational complexity of the inference and most probable explanation tasks, and propose practical implementations based on Algebraic Model Counting and Answer Set Programming with Quantifiers. An empirical evaluation of the proposed approach on three real world tasks confirms the applicability of our framework.
KEYWORDS: Probabilistic Answer Set Programming, Uncertainty, Weak Constraints, Answer Set Programming with Quantifiers
- DA and FR are members of the Gruppo Nazionale Calcolo Scientifico – Istituto Nazionale di Alta Matematica (GNCS-INDAM). This work has been partially funded by the Italian Ministry of Industrial Development (MISE) under project EI-TWIN n. F/310168/05/X56 CUP B29J24000680005 and also partially by projects SIGENERA (CUP J29I24001770005) and MOZART (J49I24001740005) selected within the framework of the PR FESR – FSE Calabria 2021/2027 and implemented with the support of the Italian State and the Calabria Region.
explainable artificial intelligence (Kaminski et al. 2024), scheduling in health-related domains (Dodaro et al. 2026; Dodaro and Maratea 2017; Dodaro et al. 2021; Cappanera et al. 2023), shift design (Abseher et al. 2016), mass spectrum analysis (Küchenmeister et al. 2026), among others.
Despite its widespread success, standard ASP does not natively support probabilistic reasoning, which is often essential for modeling uncertainty in real-world scenarios (De Raedt et al. 2007; Cozman and Mauá 2020). To account for this, Probabilistic ASP (PASP) extends ASP with the support of primitives that represent uncertain data, either in the form of weights (Lee et al. 2017) or probabilities (Cozman and Mauá 2020; Baral et al. 2009; Totis et al. 2023). More in detail, we adopt the PASP framework, which extends ASP with probabilistic facts (De Raedt et al. 2007), i.e., facts with an associated probability, and adopt the credal semantics (CS) (Mauá and Cozman 2020). Among the key tasks of PASP, are inference, and most probable explanation (MPE). Inference consists of computing the probability of a ground atom (the query). Under the credal semantics (CS), each possible combination of probabilistic facts defines a selection, and each selection induces a world represented as an answer set program, thereby determining the probability of that world. The probability of a query is, then, characterized by a lower and an upper bound, depending on whether the query holds in at least one or in all answer sets of the considered worlds. On the other hand, MPE requires identifying the selection with maximum probability such that the induced world bravely or cautiously entails a given atom (often referred to as evidence).
These tasks have been extensively studied in the literature, typically in the setting of plain ASP programs, i.e., without optimization constructs. However, many real-world applications involve optimality criteria over solutions (Calimeri et al. 2016; Erdem et al. 2016), which are not naturally captured by existing probabilistic ASP frameworks.
We address this gap by introducing optimal PASP, enabling probabilistic reasoning over ASP programs with weak constraints (Buccafurri et al. 2000), extended with probabilistic facts. Weak constraints are the standard ASP construct used to represent desiderata (i.e., optimization criteria) over answer sets. In particular, they select those answer sets that minimize violations, referred to as optimal answer sets. Building on standard PASP semantics and the established semantics of weak constraints, we obtain a natural extension in which the probabilistic reasoning tasks are computed by considering only optimal answer sets.
In the paper, we define formally the semantics of PASP programs with weak constraints, study the computational complexity of the inference and most probable explanation tasks, demonstrate its modeling capabilities in encoding real-world-inspired problems, and propose practical implementations based on Algebraic Model Counting (Kimmig et al. 2017) and Answer Set Programming with Quantifiers (Amendola et al. 2019). We also report on the results of an empirical evaluation of the proposed approach conducted on three interesting problems that confirm the applicability of our framework. This paper extends the work presented in (Azzolini et al. 2025c) by refining the computational complexity proofs and providing practical implementations.
The paper is structured as follows: after introducing the required background (Section 2), we precisely define the syntax and semantics of our proposal (Section 3), illustrate its modeling capabilities with three real-world examples (Section 4), provide a
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 3
computational complexity study of the inference and MPE tasks (Section 5), and propose (Section 6 and Section 7) practical implementations to solve them. Before concluding the paper (Section 9), we provide a broad overview of related work (Section 8).
2 Background
In this section, we recall the background involving Answer Set Programming, Probabilistic Answer Set Programming, Answer Set Programming with quantifiers, and Algebraic Model Counting.
2.1 Answer Set Programming
In ASP a variable is a string starting with an uppercase letter, while a constant is a number or a string starting with a lowercase letter. In ASP a term is either a variable or a constant. A standard atom is an expression of the form , where is predicate of arity (i.e., number of arguments) and are terms. A standard literal is either a standard atom or its negation not , where not denotes negation as failure. A standard literal is ground if it contains no variables. Let be a standard literal then denote the complement of that is if ; otherwise . A symbolic set is an expression of the form where is a list of terms and is a conjunction of standard literals. A ground set is an expression of the form where for each , is a list of constants and is a conjunction of ground standard literals. An aggregate atom is an expression of the form , where is an aggregate function and we consider only two function types, count and sum, is a symbolic or a ground set, is a comparison operator, and is a term called guard. An aggregate atom is ground if is a ground set and does not contain variables.
An atom is either a standard atom or an aggregate one. A literal is either an atom or its negation not . A literal is said to be positive if it is an atom , otherwise it is negative. Given a set of literals , and represent the set of positive and negative literals in , respectively.
A rule is an expression of the form
where , is a disjunction of standard atoms called head, and is a conjunction of literals called body. A weak constraint is an expression of the form , where , is a conjunction of literals called body, and are numbers representing the weight and the level, respectively, and is a list of terms that can be also omitted. In case @l is omitted, the level is assumed to be 0.
Given an ASP expression (i.e., atom, aggregate, rule, ...), denotes the set of variables appearing in , and it is ground if . For a rule , is the set of atoms that appear in the head. For a rule (resp. a weak constraint ) we denote by (resp. ) the set of literals appearing in the body. (resp. ) is the set of standard literals in (resp. ) and (resp. ) is the set of aggregate literals in (resp. ).
A rule is said to be a fact if , a constraint if , or normal if . For a rule (resp. a weak constraint ), global variables are variables that appear in (resp. ). Let be an aggregate literal of the form appearing in the body of some rule or weak constraint. Then, is said to be safe if each variable in appears in some positive literal in , , and each variable in is global.
A rule is safe if , and for each , is safe. The definition of safety extends also to weak constraints. A weak constraint of the form [] is safe if , for each , is safe, and variables appearing in appear also in .
An answer set program is a finite set of rules and weak constraints. For a program we denote by and the set of rules and weak constraints of , respectively. A program is said to be plain if ; whereas is said to be normal if each rule in is normal. In the following, we consider only safe programs, i.e., programs containing only safe rules and safe weak constraints.
Given an ASP , we denote by the set of constants appearing in called Herbrand Universe, and by the set of ground standard atoms that can be obtained by predicates in and constants in , called Herbrand Base.
A variable substitution is a total function that maps variables from the set to constants in . Given an ASP expression (i.e., atom, literal, rule, ), denotes the expression obtained from by substituting each occurrence of variables in with the constant they are mapped to. Given a symbolic set of the form , then ground() denotes the ground set made of pairs , where is a possible variable substitution.
Let be a rule of the form . An instantiation of is a rule of the form where , for each , , and for each if , then , otherwise is of the form . We denote by ground() the set of all possible ground instantiations of . Let be a weak constraint of the form []. An instantiation of is a weak constraint of the form where , for each if then , otherwise is of the form , , , and . For an ASP , ground() denotes the union of all possible ground instantiations for each rule and weak constraint in .
Example 1
Let be the following program:
c(1,2). c(2,1). d(1). d(2). a(X,Y): - d(X), d(Y). b(X): - c(X,Y), #count{Z:a(X,Z)} > Y. :~ b(X). [X@1]
The first line contains 4 facts, the second line contains a normal rule, the third line also represents a normal rule but with an aggregate in the body, while the last rule contains a weak constraint. Then, ground() denotes the following ground program
c(1,2). c(2,1). d(1). d(2). a(1,1): - d(1), d(1).
Optimal Probabilistic Answer Set Programming: Complexity and Implementations
5
a(1,2):- d(1),d(2). a(2,1):- d(2),d(1). a(2,2):- d(2),d(2). b(1):- c(1,2), #count{1:a(1,1); 2:a(1,2)} > 2. b(2):- c(2,1), #count{2:a(2,1); 2:a(2,2)} > 1. :~ b(1). [1@1] :~ b(2). [2@1]
The dependency graph of , denoted by , is a directed labeled graph whose nodes are atoms appearing in and there exists a positive (resp. negative) edge ) (resp. ) if there exists a rule such that appears in the head of and for at least one of the following conditions holds: (i) appears in (resp. not appears in ); (ii) contains an aggregate of the form such that appears in (resp. not appears in ). is said to be stratified if contains no loops involving negative edges; head-cycle-free (HCF) if for each and each pair of atoms there are no positive loops in involving both and .
An interpretation is a set of ground standard atoms. A positive (resp. negative) ground standard literal (resp. ) is true w.r.t. , denoted by , if (resp. ); otherwise, is false w.r.t. , denoted by .
Let be a ground set of the form , then . Let be a ground aggregate literal of the form , then iff holds, with if , otherwise, . A disjunction of ground standard literals is true w.r.t. , denoted by , if , for some . A conjunction of ground standard literals is true w.r.t. , denoted by , if , for each . Let be a rule, then is satisfied w.r.t. if is false w.r.t. or is true w.r.t. . An interpretation is a model of if satisfies each rule in .
Let be a program and be an interpretation, then denotes the FLP-reduct (Faber et al. 2011), that is, the program obtained from by removing each rule having a false body w.r.t. . A model is an answer set of if a -minimal model of (i.e., there is no such that is a model of ). For an ASP we denote with the set of its answer sets.
For , weak constraints in define the cost of . More precisely, the set of weak constraint violations is defined as . Then, for each level , the cost of at level is defined as . Let , then is dominated by if there exists an level such that , and for each , . An answer set is also an optimal answer set if, for each , is not dominated by . We denote by the set of optimal answer sets of . In what follows, we consider ground head-cycle-free programs containing only stratified aggregates (Alviano et al. 2023). Note that stratified aggregates do not introduce any additional source of complexity (Alviano et al. 2023), but they are instrumental in providing natural and intuitive encoding in our proofs.
2.2 Probabilistic Answer Set Programming
Probabilistic facts (De Raedt et al. 2007) are among the simplest syntactical constructs to express uncertainty in a logic-based language. In detail, a probabilistic fact has the form where is a ground standard atom and is a probability. A probabilistic answer set program (PASP, and we use the same acronym to also denote Probabilistic Answer Set Programming) is a tuple where is a plain head-cycle-free ASP and is a set of probabilistic facts. With we identify the ground standard atoms associated with the probabilistic facts in . We impose that probabilistic facts cannot appear in heads of rules. This is a standard assumption in the literature (De Raedt et al. 2007). A subset of identifies a selection . For a PASP with probabilistic facts, there are possible selections. A selection identifies a world , i.e., an answer set program obtained by adding each atom in to . We denote with and the set of all possible selections and worlds, respectively.
To assign a meaning to PASPs, we consider the credal semantics (CS) (Cozman and Mauá 2020). The probability of a world , , is computed by multiplying the probabilities of the probabilistic facts according to whether they are included or not in the world . More precisely,
where . We also use the notation for a selection and we set it to .
The probability of a ground atom (the query) is characterized by a lower and an upper bound (also called lower and upper probability). In words, a world contributes to the upper probability if the query is present in some answer sets while it contributes to the lower probability if the query is present in all answer sets. In formulas,
Computing the probability of a query is called inference.
The CS requires that every world has at least one answer set, i.e., to be coherent. This is necessary as it ensures that, for a query , . If some worlds are incoherent, then there is a loss of probability mass, and the above relation does not hold. In this paper, we always assume coherent PASP, unless otherwise stated.
The most probable explanation (Azzolini et al. 2025b) task in PASP requires finding the selection which generates the world associated with the highest probability (computed with Equation 1) where a ground literal (the evidence) holds cautiously (i.e., in every answer set) or bravely (i.e., in at least one answer set). These two are defined as and , respectively, and are computed as
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 7
Table 1: Selections, probabilities, and answer sets for Example 2.
We denote with (resp. ) the probability of the selection associated with (resp. ).
Example 2
Consider the following simple PASP, which will be our running example.
0.2::a. 0.3::b. q:- a. q;nq:- b.
There are 4 worlds, whose probabilities and answer sets are listed in Table 1. If we consider the query , it is present in every answer set of and , so these worlds contribute to the lower probability. For the upper probability, contributes as well. Overall, and . Similarly, and .
2.3 Answer Set Programming with Quantifiers
We now introduce Quantified Answer Set Programming (ASP(Q)) which will be instrumental in our complexity studies. ASP(Q) extends ASP by introducing the concept of quantifiers over (optimal) answer sets of ASP programs (Amendola et al. 2019; Mazzotta et al. 2024). With quantifiers, we can model problems throughout the entire PH as naturally as we can model NP problems in ASP. An ASP(Q) program is of the form:
where, for each , is a normal ASP program, , and is a normal program both plain and stratified. An ASP(Q) program is said to be existential if , otherwise it is universal. Moreover, we say that an ASP(Q) program is uniform if , for each . Let be an ASP(Q) of the form (6), be a program, and . Then, denotes the set of facts and constraints and the ASP(Q) of the form . The ASP(Q) semantics can now be defined inductively:
-
is coherent iff there exists such that is coherent.
-
is coherent iff for each , is coherent.
-
is coherent iff there exists such that is coherent.
-
is coherent iff for each , is coherent.
For an existential ASP(Q) program of the form (6), is a quantified answer set of iff is coherent. denotes the quantified answer sets of .
2.4 Algebraic Model Counting
Algebraic Model Counting (AMC) (Kimmig et al. 2017) is a generic framework that generalizes the well-known Weighted Model Counting (WMC) tasks to commutative semirings (Gondran and Minoux 2008).
Definition 1 (Commutative Semiring)
A commutative semiring is a tuple where is the domain of interest (for example, , , etc), and are associative and commutative operations, and 0 and 1 are the neutral elements for and , respectively.
Definition 2 (Algebraic Model Counting)
Given a propositional theory over variables , a commutative semiring , and a weight function , where is the set of propositional literals build with the variables in , is defined as
where is the set of models of T.
By selecting an appropriate semiring, it is possible to encode many different tasks (see (Kimmig et al. 2017) for a list of examples).
Despite the generality of AMC, some tasks in Statistical Relational Artificial Intelligence (De Raedt et al. 2016) can be better formalized within the Second-Level Algebraic Model Counting (2AMC) framework (Kiesel et al. 2022). Intuitively, 2AMC extends AMC by nesting an AMC task inside another AMC task.
Definition 3 (Second-Level Algebraic Model Counting)
Given a propositional theory whose variables are partitioned into , two commutative semirings and , two weight functions, and , and a transformation function mapping the values of to , let , 2AMC on is defined as:
where is the set of possible assignments to and the set of assignments of such that satisfies .
3 Optimal Probabilistic ASP
We now introduce the Optimal Probabilistic Answer Set Programming (optimal PASP/optPASP) framework.
Definition 4
An optimal PASP is a tuple , where is a plain head-cycle-free ASP, is a set of probabilistic facts, and is a set of weak constraints.
In other words, an optimal PASP is a PASP extended with a set of weak constraints. The set of weak constraints imposes an optimality criterion on the possible answer sets for a world. As for plain PASP (i.e., PASP without weak constraints), we require that
Optimal Probabilistic Answer Set Programming: Complexity and Implementations
9
each world has at least one (optimal) answer set. Clearly, if has only one answer set A, then A will also be the optimal answer set.
The probability bounds of a query in an optimal PASP are computed by checking whether query is true in the optimal answer sets of the worlds: a world contributes to the upper probability if the query is present in some optimal answer sets while it contributes to the lower probability if the query is present in all optimal answer sets. This is analogous to Equations (2) and (3) which target plain PASP, the only difference is in the answer sets to check (all for plain PASP while only the optimal ones for optPASP). In formulas, given an optimal PASP , the lower (resp. upper) optimal probability (resp. ) for a query are computed as
and
We now introduce the MPE task for optPASP, analogously to the definition for PASP (Equation 4 and 5). Given a ground literal (the evidence), the lower (cautious) and upper (brave) optimal MPE states are now computed by considering only optimal answer sets. That is,
The next theorem relates the probability of a query computed in a plain PASP to that computed in an optimal PASP.
Theorem 1
Let , and be a set of normal rules, probabilistic facts, and weak constraints, respectively, and an atom (query). Let and . Then, .
Proof
The number of worlds of and is the same, as is the probability for each world, since the set of probabilistic facts is the same. Consider a world in and its counterpart for . Since , if the condition for the world to contribute to the lower bound is satisfied for , then it will be satisfied for but not vice versa (the condition for is stronger). Conversely, if the condition for the world to contribute to the upper bound is satisfied for , then it will be satisfied for but not vice versa (the condition for is stronger).
Theorem 1 shows that the semantics of optimal PASP is credal as it is the set of all probability measures that dominate an infinitely monotone Choquet capacity (Augustin et al. 2014; Cozman and Mauá 2017). As in the credal semantics for plain PASP, the distribution of the probability mass of a world over the optimal answer set is left open.
The only difference is that the set of answer sets is a subset of those for plain PASP. Moreover, the following theorems immediately hold.
Theorem 2
Let with query and with with or with with . Then, .
Theorem 3
Let with query and with with or with with . Then, .
Observation 1
The credal semantics is not defined when there is at least one incoherent world. Incoherencies are usually due to constraints (or odd cycles through negation). The possibility of using weak constraints allows us to relax “strong” constraints, making such problems coherent and interpretable under the credal semantics.
Example 3
Consider Example 2 extended with a weak constraint and a rule, thus obtaining an optPASP:
0.2::a. 0.3::b. q:- a. q;nq:- b. qr:- nq. :~ qr.[1]
Here, the world obtained with selection (see Table 1) will have only one optimal answer set, namely . Here, . Then, . If we change the last rule to , the unique optimal answer set for will be so, in this case, . Now, . For this example, the lower and upper probability (resp. MPE states) coincide, but this does not hold in general.
4 Modeling Examples
In this section, we show how three real world problems can be naturally encoded within the optPASP framework.
Optimal Reviewer Assignment. The optimal reviewer assignment problem has received substantial interest in literature (Bhaisare and Bharati 2025; Kalmukov 2020; Di Perro et al. 2025; Amendola et al. 2016), with many different variations. In brief, it consists of assigning reviewers to articles for peer review. For ease of explanation, here we consider a simplified scenario where each reviewer may accept the invitation and terminate her/his reviews within the deadline with a certain probability and in which each paper may be assigned to at least one reviewer. The probabilities may derive from historical data. For example, a particular reviewer was invited to be a member of the program committee of
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 11
N conferences and X times he/she accepted the invitation and completed the reviews within the expected deadline. So, the value can be the probability value associated to that particular reviewer. The goal is to find a set of paper assignments such that the number of papers assigned to each reviewer is roughly the same. This task can be encoded with the following , for the case of three reviewers and two papers.
0.6::reviewer(r1). 0.7::reviewer(r2). 0.8::reviewer(r3).
paper(p1). paper(p2). willing(R,P):- reviewer(R), paper(P).
assign(R,P):- willing(R,P), not skip(R,P). skip(R,P):- willing(R,P), not assign(R,P).
reviewed(P):- assign(R,P).
load(R,2):- assign(R,P1), assign(R,P2), P1!=P2. load(R,1):- assign(R,P), not load(R,2). load(R,0):- reviewer(R), not load(R,1), not load(R,2). less_than_two :- load(R,C), C < 2.
delta(R0,R1,D):- load(R0,L0), load(R1,L1), R0 != R1, L0<=L1, D=L1-L0. :~ assign(R1,P), assign(R2,P), assign(R3,P), R1!=R2, R1!=R3, R2!=R3. [1@2,P] :~ paper(P), not reviewed(P). [1@1,P] :~ delta(R0,R1,D). [D@0,R0,R1]
Articles to review are identified with the predicate paper/1 while reviewers with reviewer/1 probabilistic facts. For simplicity, we assume that every reviewer is willing to review any article (willing/2) and can (assign/2) or not (skip/2) be assigned to a paper. The predicate (load/2) computes the load of a reviewer, i.e., the number of papers that she/he has to review. The difference in load between each pair of reviewers is represented by delta/3. Two weak constraints impose optimality criteria on the solutions:
- the weak constraint at the priority level 2 minimizes the number of papers assigned to more than two reviewers;
- the weak constraint at the priority level 1 minimizes the number of articles not reviewed;
- the weak constraint at the priority level 0 minimizes the difference in load among reviewers.
By asking less_than_two, we can compute the probability (bounds) that at least one reviewer is assigned with less than two papers (which, for the previous program, is [0.336, 0.788]). We can also ask other queries within this program. For instance, we can compute the probability that at least one paper received exactly one review, by adding rules of the form
one_review :- assign(r1,P), not assign(r2,P), not assign(r3,P). one_review :- assign(r2,P), not assign(r1,P), not assign(r3,P). one_review :- assign(r3,P), not assign(r1,P), not assign(r2,P).
and then asking the probability of one_review. Overall, with our proposed formalism, it is now possible to answer probability queries involving the optimal assignment for reviewers, which were not possible with plain PASP.
Scheduling Problem under No-Show Behavior. The patient scheduling and overbooking problem under no-show behavior (Topuz et al. 2024; Cayirli et al. 2012; Alaeddini et al. 2011; Dodaro et al. 2021) describes a scenario where patients should undergo different medical exams that require different resources. As patients may not show up, the facility adopts overbooking to avoid leaving resources idle. However, this may result in patients that actually show up, but do not have the required resource assigned: in this case, they should be refunded. The following models the problem in a simplified scenario.
0.4::show(1). 0.4::show(2). 0.4::show(3). 0.4::show(4). 0.4::show(5).
res(r1,chair). res(r3,bed). res(r2,chair). res(r4,bed). exam(e1,chair). exam(e2,bed). take(1,e1). take(2,e2). take(3,e1). take(4,e2). take(5,e2). require(P,R):- take(P,E),exam(E,R).
assign(P,R,Id) :- show(P), require(P,R), res(Id,R), not nAssign(P,R,Id). nAssign(P,R,Id) :- show(P), require(P,R), res(Id,R), not assign(P,R,Id). :- assign(P1,R,I), assign(P2,R,I), P1!=P2.
fulfilled(P):- show(P), assign(P,R,I). two_not_fulfilled:- show(A),show(B), A!=B, not fulfilled(A), not fulfilled(B).
refund_cost(P,2):- show(P), not fulfilled(P). resource_cost(R,1):- assign(P1,chair,R). resource_cost(R,2):- assign(P1,bed,R).
:~ refund_cost(R,C). [C01,R] :~ resource_cost(R,C). [C00,R]
The probabilistic facts of the form show(X) with , denote the probabilities with which the patients may or may not show up. The facts of the form exam(E,R) state that exam E requires resource R. We assume that there are two exams, e1 and e2, and two types of resources, chair and bed, each associated with an id (res(Id, R)). The facts of the form take(P, E) state that the patient P undergoes exam E. A resource of type R with id Id can be assigned (assign(P, R, Id), and in this case, the request has been fulfilled) or not assigned (nAssign(P, R, Id)) to a patient P who showed up and actually required that resource. The constraint prohibits assigning a resource to two patients at the same time. The predicate refund_cost(P, R) states that the cost for refunding a patient P that is present but not fulfilled is R. Similarly, used resources are associated with a cost through resource_cost/2. Two weak constraints impose optimality of the solutions: we want to minimize the cost of the refund (level 1) and then the cost of the used resources (level 0). Here we may be interested in computing the probability of having two patients not fulfilled, by querying two_not_fulfilled, obtaining [0.0256, 0.16].
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 13
In general, with optimal PASP we can compute probabilities of events in scenarios of optimal resource allocation.
Viral Marketing. The viral marketing problem is a well-studied problem in decision theory (Van den Broeck et al. 2010; Domingos and Richardson 2001; Azzolini et al. 2025). It considers a social network of people, represented by a graph. Some of them can be targeted by an ad. Friendship relations influence the shopping behavior of the people involved. The following optimal PASP, adapted from (Van den Broeck et al. 2010), models the problem:
0.7::buys_from_viral(P0,P1):- person(P0), person(P1), P0 != P1. 0.2::buys_from_marketing(P):- person(P).
market(P) :- person(P), not noMarket(P). noMarket(P) :- person(P), not market(P).
buys(P):- market(P), buys_from_marketing(P). buys(P):- friend(P,F), buys(F), buys_from_viral(P,F).
:~ market(P). [20@1,P] :~ buys(P). [-5@1,P]
where person/1 facts describe people in the network and friend/2 facts denote friendship relationship. A person can be marketed (market(P)) or not (nMarket(P)). The rule with 0.7 :: buys_from_viral(P0,P1) in the head represents, in a compact way, a set of ground probabilistic facts of the form 0.7 :: buys_from_viral(P0,P1) probabilistic fact for each pair of people P1 and P2. These facts state that the shopping behavior of P1 is influenced with probability 0.7 by the behavior of P2. Similarly for the probability of buying from direct marketing (0.2 :: buys_from_marketing/1). Then, a person buys (buys(P)) a product if it is marketed and buys from the marketing or if it has a friend who buys the product and influences her. Two weak constraints, with the same priority level, represent the cost of two actions: marketing a particular person has a certain cost, but if someone buys the product, this gives a reward (i.e., a negative cost). We are interested in computing, for example, the probability that a particular person or group buys the product, or that the number of people that buys the product is above a certain threshold. Overall, with optPASP we can now reason about the viral marketing scenario in a more fine-grained way, by considering different optimization criteria for the underlying ASP.
5 Computational Complexity Study
In this section, we study the complexity of the main reasoning tasks in optimal Probabilistic Answer Set Programs. In particular, we focus on propositional programs and consider the following decision problems.
Definition 5 (Inference)
Given an optimal PASP , a ground literal , and a rational , the
- brave optimal inference task asks whether ;
- cautious optimal inference task asks whether .
Table 2: Complexity results for plain and optimal PASP. Results with a reference are proven in this paper while the remaining are taken from (Mauá and Cozman 2020).
| MPE / MPE* Complexity | Inference Complexity | ||
|---|---|---|---|
| Plain | NP (Theorem 4) | PPNP | |
| Weak Constraint | (Theorem 9) | (Theorem 9) | PPNP (Theorem 13) |
Definition 6 (MPE)
Given an optimal PASP , a ground literal , and a rational , the
-
brave optimal MPE task asks whether ;
-
cautious optimal MPE task asks whether .
Computational complexity results for PASP without weak constraints (i.e., plain PASP) are well known. In particular, Mauá and Cozman (2020) showed that the complexity of the cautious MPE problem for HCF programs (the fragment we consider in this paper) is , while the complexity of cautious inference is .
Observation 2
Note that brave inference can be cast as cautious inference using the relation . For this reason, when we use the term inference while discussing complexity results, we refer to either brave or cautious inference. However, this relation does not hold for and . Therefore the two tasks must be studied separately.
We first focus on the cautious and brave MPE problems, by showing that the usage of weak constraints causes a jump in complexity in the brave case (i.e., ) w.r.t. plain PASP while the inherited complexity of weak constraints is absorbed in the cautious case (i.e., ). So, surprisingly, the two cases have the same computational complexity for optimal PASP.
Lastly, we focus on the brave inference task (as the cautious case can be converted to the brave one) and show that the complexity coincides with the complexity of brave inference in plain PASP. That is, weak constraints do not change the complexity of the inference problem. To facilitate the comparison, Table 2 summarizes the completeness results for both plain and optimal PASP.
5.1 Computational Complexity of MPE
Mauá and Cozman (2020) proved that the complexity of cautious MPE for plain PASP is complete for . However, to the best of our knowledge, no completeness results are available for the brave MPE problem. To this end, the following theorem provides a completeness results for such a problem. Note that in the following proofs we assume that the logarithm can be efficiently computed and rounded in such a way that distinct probability values are mapped to distinct integers.
Theorem 4
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 15
Let be a plain PASP, be a ground literal, and be a rational number. Deciding whether is NP-complete.
Proof
(Hardness) Let be a boolean formula in 3-CNF over a set of propositional variables of the form , where each clause is of the form and each literal (with ) is either a variable or its negation .
Verifying the satisfiability of is NP-complete. To prove hardness for brave MPE in plain PASP, we encode into a plain PASP , such that iff is satisfiable.
More precisely, is composed of probabilistic facts of the form for each variable , whereas is of the form:
Let be a possible selection, then encodes a truth assignment for the variables in . More precisely, for each , if , then (i.e., is true in ); otherwise (i.e., is false in ). Rules in check whether a truth assignment satisfies or not: the atom is derived iff such an assignment satisfies all the clauses of ; whereas the atom is derived if there is at least one clause of which is not satisfied.
Thus, the world , which enforces the truth assignment into , admits an answer set containing iff satisfies , and so is satisfiable.
Since all possible selections have the same probability, which is , and they are in one-to-one correspondence with possible truth assignments for variables in , then iff is satisfiable.
(Membership) We prove membership to the NP class by means of an head-cycle-free ASP encoding that is coherent iff . Recall that verifying coherence of head-cycle-free ASP is NP-complete (Dantsin et al. 2001).
Let be a PASP and be a ground literal. We construct the following :
where each is a unique identifier for the probabilistic fact , each atom is a fresh atom not appearing anywhere else, and is a ground set where for each probabilistic fact there are two elements of the form and . Note that is the complement of .
Intuitively, rules of the form , for , guess a possible selection and the log-probability of is encoded by means of atoms over the predicate deriving for each and for each . Then, rules in guess a model of the world and the last two constraints impose that (i) the sum of log-probability of probabilistic facts cannot be less than and (ii) evidence cannot be false.
Thus, there exists an answer set of iff there exists such that and there exists such that , and so the thesis follows.
Theorem 4 completes the complexity study on MPE for plain PASP, establishing that brave MPE is easier than the cautious MPE for plain PASP. We now study the complexity of MPE for optimal PASP.
First, we provide hardness for brave optimal MPE via a reduction from the well-known Propositional Abduction Problem (PAP) (Eiter and Gottlob 1995a). Recall that a PAP is defined as a tuple of the form , where is a set of propositional variables, is a satisfiable propositional logic theory over variables in , is a set of hypotheses, and is a set of manifestations. A solution for is a subset of the hypotheses such that is satisfiable and . Let be the set of solutions to PAP, then deciding whether is -complete (Eiter and Gottlob 1995a).
Theorem 5 (Hardness of brave optimal MPE)
Let be an optimal PASP, be a ground literal, and be a rational number. Deciding whether is -hard.
Proof
Let be a PAP. We assume w.l.o.g. that the theory is a 3-CNF formula over the variables in . Recall that a 3-CNF formula is a conjunction of clauses , where each clause is of the form and each (with ) is either a variable or its (classical) negation . With a slight abuse of notation, we refer to the theory as a set of clauses, and each clause as a set of literals (i.e., , where for each , ). From we can construct an optimal PASP such that iff . In detail, where , , and is
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 17
of the form:
We now prove that iff . Since each probabilistic fact in has probability 0.5, each selection has the same probability, which is . Thus, iff there exists such that such that .
Let be a possible selection and . By construction, guesses a pair of assignments (encoded by atoms over predicates tau and tau', respectively), then:
• consistent is true in I iff satisfies ;
- entailed is true in iff satisfies the entailment (i.e., if satisfies and satisfies also ); and
• e is true in I iff both consistent and entailed are true in I.
Thus, given , then iff consistent and entailed . Since consistent iff the guessed assignment satisfies , then is a witness for the consistency of . On the other hand, if entailed , then . So, this means that for each , entailed , otherwise would not be optimal. Thus, for every guessed assignment associated to a , satisfies , and so entailed iff holds. Since consistent iff is consistent and entailed iff holds, then, we can conclude that iff and so iff .
Theorem 6 (Hardness of cautious optimal MPE)
Let be an optimal PASP, be a ground literal, and be a rational number. Deciding whether is -hard.
Proof
The proof follows directly by observing that each PASP is indeed an optimal PASP where the underlying ASP contains no weak constraints. Deciding whether P(MPE*(e)) ≥ γ for a PASP is Σ₂^P-hard (Mauá and Cozman 2020) and so the thesis follows. □
From Theorem 5 and 6 we can observe that weak constraints cause a jump in complexity for brave MPE, but they do not introduce further complexity for cautious MPE. Indeed, both problems are hard for Σ₂^P.
We now provide memberships, which give us the completeness for cautious/brave MPE for optimal PASP. In both cases, we rely on ASP(Q) (Amendola et al. 2019; Mazzotta et al. 2024) which allows modeling this problem in a very natural way.
Theorem 7 (Membership of brave optimal MPE)
Let be an optimal PASP, be a ground literal, and be a rational number. Deciding whether P() is in .
Proof
For an optimal PASP , deciding whether P() is equivalent at verifying that there exists a selection such that P() and there exists such that .
To this end, we provide an ASP(Q) encoding that verifies the existence of such . More precisely, we can encode this problem into an ASP(Q), namely , of the form where is made of the following rules for each probabilistic fact :
where is a unique identifier for the probabilistic fact and is a fresh atom not appearing anywhere else. Finally, , and is of the form:
where is a ground set where for each probabilistic fact there are two elements of the form and . From Theorem 5 by Mazzotta et al. (2024), verifying the coherence of is -complete. So, this gives us the membership to .
By construction, the program guesses a set and then entails:
-
an atom iff and ; and
-
an atom iff and .
Thus, corresponds to a possible selection, and atoms over the predicate encode the log-probability of such a selection. So, there is a one-to-one correspondence between possible selections and the answer sets of program . According to the semantics of ASP(Q), is coherent iff there exists such that is coherent, with .
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 19
Let and the corresponding selection then, by construction, is of the form:
We can observe that, by construction, fresh atoms of the form , for some , probabilistic facts and atoms over the predicate do not appear in the head of any rule of . So, this means that atoms appearing in the constraints of are false in every answer set of and so such constraints are trivially satisfied. Thus, we can simplify to , where is:
Moreover, we observe that fresh atoms of the form , for some , and the atoms over the predicate do not appear in anywhere else in and so they do not affect the answer sets of the program .
Let A be the following set of atoms:
Then, we can remove facts over atoms in from , obtaining the world , and so answer sets of will be of the form where . Since atoms in do not appear in any weak constraint of , then iff .
According to the coherence of ASP(Q), is coherent iff there exists such that is coherent.
Let , then and . By construction, the program is coherent iff the constraints in are satisfied w.r.t. . Thus, is coherent iff and the sum of the log-probability of probabilistic facts (encoded by atoms over the predicate in ) is greater than or equal to .
Thus, is coherent iff there exists such that and there exists such that , that is . Thus, the thesis follows.
Based on the approach of the proof of Theorem 7 we can also provide a membership result for cautious MPE.
Theorem 8 (Membership of cautious optimal MPE)
Let be an optimal PASP, be a ground literal, and be a rational number. Deciding whether is in .
Proof
For an optimal PASP , deciding whether is equivalent to verifying that there exists a selection such that and for each , . Thus, similarly to Theorem 5, we provide an ASP(Q) encoding that verifies the existence of such . More precisely, we can encode such a problem into an ASP(Q) of the form where is equal to of 7. Finally, , with being the lowest level among weak constraints in , and is as in Theorem 7. As in the previous case, verifying the coherence of is -complete (Mazzotta et al. 2024).
By construction, the program guesses a set and then entails:
-
an atom iff and ; and
-
an atom iff and .
Thus, corresponds to a possible selection, and the atoms over the predicate encode the log-probability of such a selection. So, there is a one-to-one correspondence between the possible selections and the answer sets of the program . According to the semantics of ASP(Q), is coherent iff there exists such that is coherent, with .
Let , and be the corresponding selection. By construction is of the form:
As in the previous case, we can observe that, by construction, atoms of the form , for some , probabilistic facts, and atoms over the predicate do not appear in the head of any rule in . So, this means that atoms appearing in the constraints of are false in every answer set of and so such constraints are trivially satisfied. Thus, we can simplify to , where is of the form:
Moreover, we observe that atoms of the form , for some , and atoms over the predicate do not appear in anywhere else in and so they do not affect the answer sets of the program .
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 21
Let A be the following set of atoms:
Then, we can remove from facts over the atoms in , obtaining the program So, each answer set of is of the form where , since extends the world with a weak constraint.
According to the semantics of ASP(Q), is coherent iff there exists such that is coherent. The constraints in impose that the sum of the log-probabilities of probabilistic facts (encoded by atoms over the predicate prob/2 in ) must be greater than or equal to and must be true w.r.t. .
Thus, we now show that there exists such iff the evidence is true in every optimal answer set of , which means and so the thesis follows.
Let , then where . Then we show that (i) and (ii) iff is true in every .
By construction we know that:
• for each , ; and
• if , then , otherwise .
So, if (i.e., is an optimal answer set of but it is not optimal for ), then is dominated by , and so would not be optimal for , which is a contradiction. So .
Now, let us assume that there exists such that and the evidence is true in (i.e., ). Since , then and . Thus, is dominated by since , and so, for each , and . This is a contradiction, since is an optimal answer set of .
Thus, we can conclude that iff for each , , and the thesis follows.
Theorem 9 (Complexity of cautious and brave optimal MPE)
Given an optimal PASP , a ground literal , and a rational number , deciding whether is -complete and is -complete.
Proof
The proof follows from theorems 5-8. ☐
5.2 Computational Complexity of Inference
We now study the complexity of the brave inference problem (Definition 5). We start from the hardness result and then also provide a membership result, thus proving completeness. Recall that brave inference can be converted to cautious inference and vice versa, so studying one is enough. This is because for a query atom . Also note that for MPE, converting the lower state into the upper state is not possible in general, as the latter is a world in which the query is cautiously or bravely entailed.
Theorem 10 (Hardness of brave optimal inference)
Let be an optimal PASP, be a ground literal, and be a rational number in . Verifying whether is hard for .
Proof
Hardness directly follows from the inference problem in PASP. Indeed, every PASP is an optimal PASP where the set of weak constraints is empty, so the complexity of the inference problem is at least difficult as in PASP, that is, (Mauá and Cozman 2020).
Before considering membership of the brave inference problem for optimal PASP, we first recall the complexity of brave reasoning in HCF programs with weak constraints (i.e., the ASP fragment considered in this paper), which is instrumental in what follows.
Theorem 11 (Buccafurri et al. (2000))
Let be an HCF program with weak constraints and be ground literal. Verifying whether there exists such that is -complete.
Theorem 12 (Membership of brave optimal inference)
Let be an optimal PASP, be an atom, and be a rational number. Then, verifying whether is in .
Proof
To prove this, we can apply, with slight modifications, the methodology employed by Cozman and Mauá (2017) to prove the complexity of brave inference for plain PASP.
Let be an optimal PASP. We construct a non-deterministic Turing Machine such that, for each probabilistic fact , with for some (smallest) integers and , it chooses one among computation paths. For of these computation paths, is considered true, while for the remaining , is considered false. This means that such a machine has computation paths, and for each selection , there are computation paths. Each of these paths is polynomial w.r.t. the input size and returns yes iff such that .
Let s.t. , i.e., the set of selections such that the query is true in at least one optimal answer set of the world identified by . Then, the number of accepting paths of is equal to
If we divide this quantity by the total number of paths, we obtain the probability of the query q. That is,
This means that if and only if the number of accepting paths of is greater than .
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 23
If , then if and only if more than half of the computational paths are accepting. For a generated selection, verifying the existence of an optimal answer set is (Theorem 11). Thus, for the problem is in .
We now reduce the general case, i.e., with an arbitrary value of , to the specific case , obtain membership in . First, consider . Then construct an optimal PASP , where , and , with fresh atoms and not appearing elsewhere, and prove that if and only if .
Selections for are obtained from selections for by including or not . Therefore, for each selection for , we have two possible selections, , where is not included, and , where is included. The corresponding worlds and preserve all the optimal answer sets of as and appear only in the new rule , and they do not appear in any weak constraints. For each we have: 1) since and so ; and 2) if and only if . Thus,
Thus, if and only if i.e., . If , then set the probability of to and proceed as before. Thus, deciding whether is in . As observed by Mauá and Cozman (2020), and so the thesis follows.
Theorem 13
Let be an optimal PASP, be a ground literal, and be a rational number. Then, verifying whether is -complete.
Proof
Follows from Theorem 10 and 12.
6 Implementation of Inference and MPE in Optimal PASP
We now show how inference and the computation of the MPE in optimal PASP can be naturally encoded as a 2AMC tasks. After this, we consider an ASP(Q)-based implementation for the MPE task.
6.1 Encoding Inference as a 2AMC Task
Here we consider an optimal PASP with query , probabilistic facts , and weak constraints , where, w.l.o.g., each weak constraint is of the form , is a ground atom, and (the weight). We omit the level , as multiple levels of weak constraints can be rearranged into only one level and negative weights can be rewritten as positive, see (Alviano and Dodaro 2016; Buccafurri et al. 2000). Furthermore, each weak constraint of the form can be rewritten as a normal rule of the form and a weak constraint of the form . This will be instrumental in what follows, as our implementation assumes that weights are associated with atoms.
To perform inference, the two layers of AMC (Definition 3) are instantiated as follows.
Inner Layer. For the inner layer we have:
• as semiring, ;
• as variables
• as weight function:
where and is the weight (cost) associated with atom , and
The first component stores the weights, the second counts the number of models where the query q is true, while the last counts all the models. As the transformation function, we use:
Remember that cannot be larger than .
Outer Layer. For the outer layer we have:
• as semiring, , i.e., a double probability semiring extended to two dimensions;
• as variables ;
• as weight function:
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 25
where p.f. stands for probabilistic fact.
Theorem 14
is commutative.
Proof
To prove that is commutative, we have to show that both and are commutative. Let and be arbitrary elements in . For , we have to show that . We have three cases: 1) , 2) , and 3) . Cases 1) and 2) follow from the definition. For case 3) , , addition in is commutative, and , so the resulting tuples are identical.
For , we have to show, as before, that . For and . Addition and multiplication on are commutative, thus .
Theorem 15
is commutative.
Proof
This is trivial, as it is a duplication of the probability semiring (Kimmig et al. 2017), which is commutative.
We now prove that the transformation function is a monoid homomorphism between the inner and outer semiring. This is crucial to ensure an efficient implementation (see (Kiesel et al. 2022)).
Definition 7 (Monoid Homomorphism)
Given two monoids and where, for , are the domains, are binary operations with neural elements , a function is a monoid homomorphism if and .
Theorem 16
is a monoid homomorphism between (obtained from ) and (obtained from )
Proof
We have to prove that 1) and 2) . For 1) we are in the case of , thus, by definition. For 2) we have to consider three possible cases.
Case 1, where and . Then . . In the other direction, , , , and the two results match.
Case 2, where and with . Then , and as the last two elements are equal and
- In the other direction, and , so , and the two results match.
Case 3, where with and with . Then . Note that so . In the other direction, and , so , and the two results match. The other case where, for either or , both the second and third elements of the tuple are equal can be similarly proven.
Example 4
Consider Example 3 and query . Here, in the innermost layer we consider the atoms while in the outermost . Assume we fix the atom in the outermost layer. For clarity, assume has cost 2.
We have two answer sets: and . For , the atom is associated with the tuple . For , the atom is associated with the tuple and the atom is associated with the tuple . Furthermore, there is an additional tuple to consider, , as the query is false (we do not explicitly include such an atom in the answer sets). Overall, we have . Then, as (the first element of the tuple). After applying the transformation function, we get , as the second element of the tuple (which counts the number of answer sets with the query true) is 1. In the outer layer, we have , so a contribution of 0.24 to both the lower and upper probability.
Similarly, If we consider the atom in the outermost layer, we have only one answer set whose atoms are both associated with the tuple . Then, . We apply the transformation function on this and get . In the outer layer, we have so a contribution to both the lower and upper probability. The considerations for the two remaining selections are analogous.
6.2 Encoding MPE as a 2AMC Task
The 2AMC encoding can be obtained with minimal modifications from the 2AMC encoding for inference. In particular, we can still consider the same inner layer and transformation function. For the outer layer, instead, we need to consider
• as semiring, ;
• as variables ;
• as weight function:
where with
• if , ; else ;
• if , ; else ;
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 27
-
if , ; else if , ; else (if ), , where fixes a total order on ;
-
if , ; else if , ; else (if ), , where fixes a total order on ;
and times. The first two components store, respectively, the value associated with the lower and upper MPE states, while the last two components store the facts selected for such states.
Theorem 17
is commutative.
Proof
As before, we have to prove that both and are commutative. The proof for is easy, as both multiplication and union of sets is commutative. The proof for follows a similar path. This is possible thanks to the total order on the sets of atoms that allows writing , ensuring commutativity.
6.3 Encoding MPE as an ASP(Q) Program
ASP(Q) supports weak constraints (both within each subprogram and on the whole ASP(Q)) to define preferences over quantified answer sets, so it is a natural candidate for modeling MPE in optimal PASP, given its promising results in solving the same task for plain PASP (Azzolini et al. 2025b).
As shown in the proofs of Theorem 7 and 8, the brave and cautious MPE problems can be framed as ASP(Q) having two quantifiers: the first guesses a selection of probabilistic facts, while the second searches over the optimal answer sets of the corresponding world for a set that satisfies or not a given query. In this way, each quantified answer set corresponds to a candidate MPE state. Then, by expressing preferences among quantified answer sets by means of global weak constraints, we can select as optimal quantified answer set the candidate MPE state with the maximum probability, thus obtaining a valid MPE state. This idea is formalized in the following definition.
Definition 8
Let be an optimal PASP of the form and be an atom then:
is an ASP(Q) of the form ;
is an ASP(Q) of the form ; and
where , , and is of the form:
with being fresh atoms not appearing anywhere else.
To illustrate the ASP(Q) encoding, we consider the Optimal Reviewer Assignment problem from Section 4.
Brave MPE. Suppose we want to compute the brave MPE for the query less_than_two. Starting from the optimal PASP presented in Section 4, namely , and applying Definition 8, is of the form shown below:
%@exists P1
reviewer(r1);no_reviewer(r1).
reviewer(r2);no_reviewer(r2).
reviewer(r3);no_reviewer(r3).
reviewer(r4);no_reviewer(r4).
%@exists P2
paper(p1).
paper(p2).
willing(R,P):- reviewer(R), paper(P).
assign(R,P) :- willing(R,P), not skip(R,P).
skip(R,P) :- willing(R,P), not assign(R,P).
reviewed(P):- assign(R,P).
load(R,2):- assign(R,P1), assign(R,P2), P1!=P2.
load(R,1):- assign(R,P), not load(R,2).
load(R,0):- reviewer(R), not load(R,1), not load(R,2).
less_than_two :- load(R,C), C < 2.
delta(R0,R1,D):- load(R0,L0), load(R1,L1), R0 != R1, L0<=L1, D=L1-L0.
~: assign(R1,P), assign(R2,P), assign(R3,P), R1!=R2, R1!=R3, R2!=R3. [1@2,P]
~: paper(P), not reviewed(P). [1@1,P]
~: delta(R0,R1,D). [D@0,R0,R1]
%@constraint C
:- not less_than_two.
%@global C^ω
~: reviewer(r1). [-log(0.8)@1,r1]
~: reviewer(r2). [-log(0.1)@1,r2]
~: reviewer(r3). [-log(0.7)@1,r3]
~: reviewer(r4). [-log(0.2)@1,r4]
~: no_reviewer(r1). [-log(0.2)@1,r1]
~: no_reviewer(r2). [-log(0.9)@1,r2]
~: no_reviewer(r3). [-log(0.3)@1,r3]
~: no_reviewer(r4). [-log(0.8)@1,r4]
Listing 1: Brave MPE in ASP(Q).
According to the coherence of ASP(Q), a quantified answer set of is an optimal answer set of (i.e., ) such that by fixing it in the following program, then remaining ASP(Q) is coherent (i.e., is coherent). The program contains no weak constraints, so each answer set is also optimal. Specifically, an answer set of corresponds to a possible selection of probabilistic facts (i.e., , , , and ) as each rule of the form ; no_reviewer(r) either selects as reviewer or not. Let us first consider the empty selection of reviewers and so . We need to verify the coherence of . We can ob-
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 29
serve that, since no reviewer is fixed by , then no paper can be assigned, and so the only optimal answer set is . Thus, the query is false in and so is such that the program is incoherent. Since is the only optimal answer set of , then cannot be a quantified answer set of . Let us move on to another selection, for instance the one in which the reviewers and accept to serve as a reviewer and so . In this case, if we fix in the program (so we consider optimal answer set of ), then we have three optimal answer sets, namely , , and , where:
-
is such that both papers are assigned to both reviewers;
-
is such that paper (resp. ) is assigned to reviewer (resp. ); and
-
is such that paper (resp. ) is assigned to reviewer (resp. ).
All the papers are covered (i.e., weak constraints at level 1 do not fire) and each reviewer has the same number of papers (i.e., weak constraints at level 0 do not fire either). For we can note that each reviewer has two papers assigned, and so is false in . Here makes the program incoherent and so it cannot be used to prove that is a quantified answer set. Conversely, for (resp. ) both reviewers have less than two paper assigned, and so is true in (resp. ). Thus, is an optimal answer set of that satisfies the constraint in and so is quantified answer set of .
Global weak constraints assign a cost to according to whether the reviewers accepted or not. Since and are true in , whereas and are false in , then the corresponding weak constraints fires, and so the cost of is , with . At the same time, we can observe that admits an optimal answer set where paper is assigned to reviewer and is assigned to reviewer and so the query is bravely entailed. At this point is a brave MPE state if its probability is maximal. Since the cost of is equal to and optimal quantified answer sets are those quantified answer sets with the minimum cost, then optimal quantified answer sets are those who maximize the probability of the corresponding selection. More precisely, an optimal quantified answer set of is , which corresponds to the brave MPE state .
Cautious MPE. Cautious MPE states can be computed in a similar fashion by computing optimal quantified answer set of . Thus, let us assume that we want to compute cautious MPE for , then in this case is of the form where , and are the same as in Listing 1. Let us now compute a quantified answer set of . Consider . From the previous example, we know that by fixing in the program (so we consider optimal answer set of ), we obtain three optimal answer sets, namely , , and , where:
-
is such that both papers are assigned to both reviewers;
-
is such that paper (resp. ) is assigned to reviewer (resp. ); and
-
is such that paper (resp. ) is assigned to reviewer (resp. ).
In this case, program is universally quantified, and therefore the constraint program must be coherent for every answer set , with . This condition is not satisfied, as assigns all papers (i.e., and ) to all selected reviewers (i.e., and ), thereby violating . Hence, makes incoherent, and consequently is not a quantified answer set of .
Conversely, consider the following answer set of
corresponding to the selection of reviewers , and . By fixing in , we obtain six optimal answer set, each assigning one paper to two of the selected reviewers and the other paper to the remaining reviewer. In all these cases, each reviewer is assigned exactly one paper, and thus every optimal answer set satisfies the constraint program . Therefore, is a quantified answer set of , and the corresponding selection of reviewers represents a candidate cautious MPE state.
Finally, global weak constraints, also in this case, assign a cost to corresponding to the negative logarithm of the probability of the corresponding selection , namely . Since no better quantified answer set exists, is also optimal. Note that optimal quantified answer sets are obtained by minimizing the cost associated with quantified answer sets and so we are indeed maximizing the log probability of the corresponding selection, and so is a cautious MPE state.
7 Experimental Evaluation
Implementation. The proposed approaches for the inference and MPE problems in opt-PASP have been implemented on top of existing systems. More precisely, for the inference problem, we propose two implementations: one that leverages a knowledge-compilation (Darwiche and Marquis 2002) based solver, namely aspmc (Eiter et al. 2024), and one based on enumeration. We call the approaches aspmc and enum, respectively. The asmpc tool allows us to specify only the structure of the required semirings, leaving all the remaining parts unchanged. In a nutshell, aspmc converts the input program into an arithmetic circuit, and then the probability of a query can be computed by traversing this graph and applying the corresponding semiring operations at every node. The probability values associated to probabilistic facts do not influence the execution time, as the size of the compiled programs depends only on the structure of the deterministic part. For the enumeration-based approach, we developed a tool which converts the input optPASP into an ASP and, for each possible selection (exponentially many), calls an ASP solver, namely clingo (Gebser et al. 2019) v 5.8.0, to compute the optimal answer
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 31
sets. Whereas, for the MPE problem, we implemented the proposed encoding in ASP(Q) and then use the CASPER¹ system (Cuteri et al. 2026) to evaluate the resulting programs.
Dataset Description. We performed an experimental evaluation on three different datasets, which extend the application scenarios discussed in Section 4. For the viral datasets (which models the viral marketing problem), we generate instances with an increasing number of people involved in the network. Here, the edges (representing friendship relations) are generated according to a Barabási Albert network structure (using the NetworkX library (Hagberg et al. 2008) with parameter set to the number of people involved and set to 2). For the paper dataset (which models the paper assignment problem) we generated instances by iteratively increasing the number of papers and the number of reviewers . Lastly, for the scheduling dataset (which models the scheduling under no show behavior problem), we generated instances by iteratively increasing the number of exams , people , and resources . All probabilistic facts are assigned random probabilities. For all instances, we fixed the seed for reproducibility.
The experiments² were executed on a machine running at 3.7 GHz with 32 GB of RAM and a time limit, for each instance, of 3600 seconds (1 hour). We used the bash command time to extract the execution time and collected the real values.
7.1 Results
Inference. Table 3 shows the results for the paper dataset. Here, the approach based on enumeration (enum) seem to be effective when the number of articles is small, providing better performance w.r.t. aspmc for 2 and 3 papers. Then, for the remaining cases, aspmc can solve significantly more instances. The largest solvable instance for enum is with 6 papers and 5 reviewers while with aspmc it is possible to get up to 10 papers and 7 reviewers.
Table 4 shows the results for the scheduling dataset and reports the cumulative runtime obtained by adding up the execution time of all instances with number of resources and exams ranging from 2 to 10, with a fixed number of people. Here, both approaches can solve all instances. Then, we further increase the size of the instances to better assess aspmc (Table 5). As for the previous dataset, enum is more effective for small instances. However, as the size grows, the benefits of KC-based approaches become evident. The largest number of people that can be handled with aspmc is 15. With 16, it can handle up to 5 resources and 10 exams, requiring approximately 20 minutes.
Lastly, Table 6 shows the results for the viral dataset. Also in this case the approach based on aspmc is much more effective w.r.t. enumeration for larger instances.
For all datasets, enum stops due to timeout, while aspmc due to a knowledge compilation error, possibly due to excessive memory requirements. Overall, enumeration-based approaches are effective for small instances. However, as the size of the dataset increases, enumeration became unfeasible. There is a crucial point to consider: enum computes only optimal answer sets while aspmc computes all answer sets and then only considers
¹ Note that CASPER has been recently extended to handle ASP(Q) program containing weak constraints and is available at https://github.com/ndria00/Casper.git ² Source code and datasets available at: https://drive.google.com/file/d/1NjhLPbD6gqKSI-L9uUHM72QsvHbzLbnc/view?usp=sharing.
Table 3: Results on the paper dataset. The columns include: the number of articles considered (# papers), the number of reviewers associated with the largest solvable instance for a fixed number of papers (n rev max), the runtime associated with the largest solvable instance for a fixed number of papers (runtime largest), and the cumulative runtime (i.e., the sum of all runtime for all instances) for a fixed number of papers (cumulative runtime), for both aspmc and enum. A dash indicates that none of the instances where solved for the fixed number of papers. All times are in seconds.
| # papers | n rev max | runtime largest | cumulative runtime | |||
|---|---|---|---|---|---|---|
| aspmc | enum | aspmc | enum | aspmc | enum | |
| 2 | 11 | 18 | 740 | 2647 | 1117 | 4091 |
| 3 | 9 | 12 | 101 | 1542 | 156 | 1924 |
| 4 | 9 | 8 | 450 | 2506 | 555 | 2723 |
| 5 | 8 | 6 | 203 | 2143 | 223 | 2217 |
| 6 | 8 | 5 | 332 | 3307 | 363 | 3307 |
| 7 | 9 | - | 281 | - | 858 | - |
| 8 | 8 | - | 143 | - | 273 | - |
| 9 | 8 | - | 357 | - | 629 | - |
| 10 | 7 | - | 323 | - | 667 | - |
Table 4: Results on the scheduling dataset. The columns include: the number of considered people (# people) and the cumulative runtime (in seconds) of all instances with a fixed number of people and an increasing number of resources and exams (from 2 to 10). Both solvers can solve all instances.
| # people | aspmc | enum |
|---|---|---|
| 2 | 223.35 | 5.33 |
| 3 | 121.86 | 4.88 |
| 4 | 173.86 | 7.95 |
| 5 | 200.26 | 26.94 |
| 6 | 229.58 | 118.13 |
| 7 | 239.54 | 676.83 |
| 8 | 259.19 | 3383.26 |
| 9 | 278.91 | 13120.06 |
optimal ones. Thus, the number of answer sets considered in aspmc may be much larger than the number considered with enum.
MPE. For MPE, we focus on ASP(Q) only. This is because enum enumerates all answer sets, so the execution time to solve either inference or MPE is the same. Similar considerations apply to aspmc as it consider all answer sets and then filters them according to the semiring operations. Furthermore, ASP(Q) has been already been proven much more effective than aspmc to solve MPE in plain PASP (Azzolini et al. 2025b).
Figures 1, 2 and 3 show the results for computing the MPE with ASP(Q) for the three datasets. For paper and scheduling, the reported results are computed by summing the execution times over all instances with the considered number of reviewers (for paper) and people (for scheduling). For paper, the we note that, once the number of reviewers is fixed, the number of papers does not seem to influence the execution time. Thus, the
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 33
Table 5: Results on the scheduling dataset. The columns include: the number of considered people (# people) and the cumulative runtime (in seconds) of all instances with a fixed number of people and an increasing number of resources and exams (from 2 to 10). Only aspmc can solve these instances (enum always timeouts).
| # people | aspmc |
|---|---|
| 10 | 2101.35 |
| 11 | 6323.06 |
| 12 | 13707.62 |
| 13 | 44601.58 |
| 14 | 110555.42 |
| 15 | 223968.87 |
Table 6: Results on the viral datasets. A dash indicates that the instance cannot be solved.
| # people | enum | aspmc |
|---|---|---|
| 3 | 0.25 | 4.35 |
| 4 | 27.12 | 3.69 |
| 5 | - | 3.71 |
| 6 | - | 3.92 |
| 7 | - | 5.06 |
| 8 | - | 10.84 |
| 9 | - | 48.85 |
| 10 | - | 338.1 |
figure reports only the results with 10 articles, as the other are similar. For scheduling, we considered exam and resources both ranging from 10 to 100 with step 10.
For the paper dataset, computing the lower MPE state is much slower than computing the upper MPE state, as the largest solvable instance within the time limit is the one with 100 reviewers. On the contrary, we can compute the upper MPE state for the instance with 200 reviewers within 800 seconds. For the viral dataset, computing the MPE state is almost instantaneous (less than 0.5 seconds) for all instances. The computation of the lower MPE state, however, requires a bit more time, but still less than 3 minutes. Lastly, we have a different trend for the scheduling dataset, as there the computation of the upper MPE state is slower w.r.t. the computation of the lower MPE state. Still, in both cases, we can handle the instance with 100 people within 100 seconds for the upper and 40 for the lower.
More in details, for lower MPE, CASPER directly applies the CEGAR (Counterexample-Guided Abstraction Refinement) approach without any additional translation, since the ASP(Q) encoding is alternating (i.e., of the form ). In contrast, for upper MPE, CASPER relies on a preprocessing step that eliminates weak constraints via the translation proposed by Mazzotta et al. (2024), as the CEGAR methodology cannot be directly applied to uniform ASP(Q) programs (i.e., ).
These two approaches exhibit different strengths and limitations, which explain the trends observed in the experimental results. On the one hand, the translation required for uniform ASP(Q) programs introduces a duplication of the second program within the first one and enforces optimality checks in the second quantifier. As a consequence, the

Fig. 1: Results of ASP(Q) for computing the lower and upper MPE states for the paper dataset.

Fig. 2: Results of ASP(Q) for computing the lower and upper MPE states for the viral dataset.
search space increases, since candidate quantified answer sets correspond to pairs , where is a selection and is an answer set of . This overhead is particularly evident in the scheduling dataset, where CASPER takes a longer execution time for solving the upper MPE problem compared to lower MPE one.
On the other hand, for lower MPE, no such translation is not required, and CEGAR can be applied directly. The method explores the space of quantified answer sets by iteratively identifying counterexamples (i.e., optimal answer sets of the second program that invalidate candidate quantified answer set) and refining the original program accordingly. This approach proves to be highly effective on the scheduling datasets, while showing some overhead on the paper dataset due to the large number of counterexamples that must be discovered before converging to a quantified answer set.
Overall, the results highlight that both upper and lower MPE in optimal PASP are computationally-hard tasks. Unlike plain PASP, the two problems share the same computational complexity in the optimal PASP setting, in fact both problems are -complete. Despite this inherent complexity, CASPER is very effective in computing the lower and upper MPE state for optimal PASP program, as the majority of the considered instances can still be solved within few minutes. Lastly, if we compare the results obtained with ASP(Q) with aspmc, we note that ASP(Q) is much more efficient.
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 35

Fig. 3: Results of ASP(Q) for computing the lower and upper MPE states for the scheduling dataset.
8 Related Work
Related works mainly follows two different directions: alternative semantics for expressing uncertainty within a logic-based language and tasks that can be considered in PASP/PLP frameworks.
Alternative Semantics. The credal semantics imposes no preference over the distribution of the probability mass of a world over its answer sets, introducing probability bounds (lower and upper) for each query. Here, we specialize this by considering only the optimal answer sets, according to a set of constraints, but we still keep the two bounds. The smProbLog (Totis et al. 2023) semantics is closely related: here, the probability of a world is uniformly distributed over the answer sets. That is, for a world , each of its answer set has a probability of where is computed as in Equation 1. Then, the probability of a query is computed as the sum of the probabilities of the answer sets where the query is true. However, smProbLog only considers plain PASP (without weak constraints) for worlds. Extending this semantics considering weak constraints is an interesting direction for future work.
Both CS and smProbLog require each world to be coherent (i.e., with at least one answer set). If this does not hold, there is a loss of probability mass. The L-credal semantics (Rocha and Cozman 2022) tries to overcome this by introducing a “undefined” truth value. Another possibility is to normalize the probability (Azzolini et al. 2025), i.e., dividing the probability of the query by 1 minus the sum of the probabilities of incoherent worlds. Another possibility is to “repair” the program (Eiter et al. 2016; Ceylan et al. 2016).
Other semantics for PASP include LPMLN (Lee et al. 2017) that extends ASP with weighted rules and atoms. Furthermore, there is the possibility of handling infinite weights that represent hard constraints. In LPMLN, there is no concept of world. Rather, each answer set is associated with a weight, and the probability of a query is the sum of the probabilities (obtained by dividing the weight of an answer set by the total weight) of the answer sets containing the query. Another approach is P-log (Baral et al. 2009), where it is possible to define random attributes and a probability distribution over the answer sets. The relationship between LPMLN and P-log has been extensively explored in (Lee and Yang 2017).
If worlds are plain answer set programs composed of normal rules only and every such program has a unique stable model (which also coincides with the unique well-founded model (Van Gelder et al. 1991)), we fall into the Probabilistic Logic Programming (PLP) field (De Raedt et al. 2007; Riguzzi 2022).
Related Tasks. In this paper, we focus on inference and computation of the MPE state in optPASP. MPE has also been studied for plain PASP and PLP (Shterionov et al. 2015; Azzolini et al. 2025b). In PLP, the task can be solved with a plain ASP, by converting probabilistic facts into choice rules and considering log-probabilities. However, for PASP, saturation (Eiter and Gottlob 1995b; Dantsin et al. 2001) or more advanced approaches such as Answer Set Programming with Quantifiers (Amendola et al. 2019; Mazzotta et al. 2024) are needed. MPE is closely related to Maximum-a-Posteriori, which has been studied for both PLP (Bellodi et al. 2020) and PASP (Azzolini et al. 2025a). In brief, in MAP some probabilistic facts are denoted as query probabilistic facts and the goal is to compute a subset of such facts (called MAP state) such that the probability of the given evidence is maximized. This generalizes MPE, as in MPE all probabilistic facts are considered as query probabilistic facts. Computing the MAP state is harder than solving MPE Mauá and Cozman (2020) and standard approaches are based on knowledge compilation.
Decision theory (DT) tasks can be framed in the PLP and PASP frameworks (Van den Broeck et al. 2010; Azzolini et al. 2025). Here, the PLP/PASP is extended with utility attributes, which specify costs/utilities associated with some of the atoms of the program, and decision atoms, which can be selected or not. Each selection of decision atoms identifies a PLP/PASP which is associated with an expected cost by considering the probability and the utilities of the different literals. The goal is to find the set of decision atoms that maximizes the expected utility. This is different w.r.t. inference in optPASP, as in DT the maximization is on the outer level (over the decision atoms) while in opt-PASP, weak constraints impose an optimality criterion over answer sets (so, in the inner level) and then these are considered for the computation of the probability. Similarly, the MPE also differs, as it aims to find the optimal solution over all probabilistic facts, not only a subset of it (as may happen in DT with decision atoms). Furthermore, the result of DT is a tuple composed of a real number and a set of atoms, while for MPE we have a probability.
Lastly, another related task is abduction in PLP (Azzolini et al. 2022): here, a PLP is extended with abducible facts and integrity constraints. Each selection of abducible facts identifies a PLP. Given a query , the goal is to find the minimal set (where minimality is considered under set-inclusion) of abducible facts that maximizes the probability of . Extending all these tasks to the optPASP framework is also an interesting direction for future work.
The inference, MPE, MAP, and decision theory problems, for both PLP and PASP, have been all formalized in the AMC framework. For PLP, inference and MPE can be effectively encoded with AMC (Kimmig et al. 2017; Azzolini et al. 2025b), while MAP and decision theory with 2AMC (Kiesel et al. 2022). For PASP, inference and MPE can be effectively encoded with 2AMC (Azzolini et al. 2025b) while MAP and decision theory
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 37
with 3AMC (Azzolini et al. 2025;a). Overall, in this paper we frame inference in optPASP within the AMC spectrum, thus providing a connection with existing works.
9 Conclusion
In this paper, we propose optimal Probabilistic Answer Set Programming (optPASP), an extension of Probabilistic Answer Set Programming that incorporates weak constraints, a standard and powerful ASP construct for modeling preferences. After presenting the syntax and semantics of optPASP, we illustrated its modeling capabilities through three real-world-inspired applications: the paper assignment problem, the viral marketing problem, and scheduling under no-show behavior. These case studies demonstrate the expressiveness and practical potential of our framework. On the theoretical side, we studied the computational complexity of the main task associated with optASP: inference and most probable explanation (MPE). On the practical side, we encoded these tasks as instances of Algebraic Model Counting, and we also proposed an implementation in Answer Set Programming with Quantifiers. We evaluated the resulting implementations on real-world-inspired benchmark problems, demonstrating the practical viability of our approach.
Several directions for future work can be envisaged. On the one hand, it would be interesting to extend other semantics for PASP to accommodate weak constraints, thereby broadening the applicability of optimization in probabilistic settings. On the other hand, further investigation of additional reasoning tasks in optPASP, such as Maximum-a-Posteriori (MAP) inference, represents a natural and promising direction.
Competing Interests
Competing interests: The authors declare none.
References
ABSEHER, M., GEBSER, M., MUSLIU, N., SCHAUB, T., AND WOLTRAN, S. 2016. Shift design with answer set programming. Fundamenta Informaticae 147, 1, 1–25.
ALAEDDINI, A., YANG, K., REDDY, C., AND YU, S. 2011. A probabilistic model for predicting the probability of no-show in hospital appointments. Health care management science 14, 146–157.
ALVIANO, M. AND DODARO, C. 2016. Anytime answer set optimization via unsatisfiable core shrinking. Theory and Practice of Logic Programming 16, 5-6, 533–551.
ALVIANO, M., FABER, W., AND GEBSER, M. 2023. Aggregate semantics for propositional answer set programs. Theory and Practice of Logic Programming 23, 1, 157–194.
AMENDOLA, G., DODARO, C., LEONE, N., AND RICCA, F. 2016. On the application of answer set programming to the conference paper assignment problem. In AIIA. Lecture Notes in Computer Science, vol. 10037. Springer, 164–178.
AMENDOLA, G., RICCA, F., AND TRUSZCZYNSKI, M. 2019. Beyond NP: quantifying over answer sets. Theory and Practice of Logic Programming 19, 5-6, 705–721.
AUGUSTIN, T., COOLEN, F. P., DE COOMAN, G., AND TROFFAES, M. C. 2014. Introduction to imprecise probabilities. John Wiley & Sons.
AZZOLINI, D., BELLODI, E., FERILLI, S., RIGUZZI, F., AND ZESE, R. 2022. Abduction with probabilistic logic programming under the distribution semantics. International Journal of Approximate Reasoning 142, 41–63.
AZZOLINI, D., BELLODI, E., KIESEL, R., AND RIGUZZI, F. 2025. Solving decision theory problems with probabilistic answer set programming. Theory and Practice of Logic Programming 25, 1, 33–63.
AZZOLINI, D., FORTI, S., AND IELO, A. 2025. Continuous reasoning for adaptive container image distribution in the cloud-edge continuum. Cluster Computing 28, 7, 461.
AZZOLINI, D., MAZZOTTA, G., RICCA, F., AND RIGUZZI, F. 2025a. An algebraic view of MAP inference in probabilistic answer set programs. In ECAI 2025. IOS Press, 1495–1502.
AZZOLINI, D., MAZZOTTA, G., RICCA, F., AND RIGUZZI, F. 2025b. Most probable explanation in probabilistic answer set programming. In Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence, IJCAI 2025, Montreal, Canada, August 16-22, 2025. ijcai.org, 9049-9057.
AZZOLINI, D., MAZZOTTA, G., RICCA, F., AND RIGUZZI, F. 2025c. A novel framework for reasoning over optimization problems in probabilistic answer set programming. In Proceedings of the 22nd International Conference on Principles of Knowledge Representation and Reasoning. 67–77.
BARAL, C., GELFOND, M., AND RUSHTON, N. 2009. Probabilistic reasoning with answer sets. Theory and Practice of Logic Programming 9, 1, 57–144.
BAUMEISTER, J., HERUD, K., OSTROWSKI, M., REUTELSHÖFER, J., RÜHLING, N., SCHAUB, T., AND WANKO, P. 2024. Towards industrial-scale product configuration. In LPNMR. Lecture Notes in Computer Science, vol. 15245. Springer, 71–84.
BELLODI, E., ALBERTI, M., RIGUZZI, F., AND ZESE, R. 2020. MAP inference for probabilistic logic programming. Theoret and Practice of Logic Programming 20, 5, 641–655.
BHAISARE, B. AND BHARATI, R. 2025. Advancing peer review integrity: Automated reviewer assignment techniques with a focus on deep learning applications. In Computation of Artificial Intelligence and Machine Learning, A. K. Bairwa, V. Tiwari, S. K. Vishwakarma, M. Tuba, and T. Ganokratanaa, Eds. Springer Nature Switzerland, Cham, 312–327.
BUCCAFURRI, F., LEONE, N., AND RULLO, P. 2000. Enhancing disjunctive datalog by constraints. IEEE Transactions on Knowledge and Data Engineering 12, 5, 845–860.
CALIMERI, F., GEBSER, M., MARATEA, M., AND RICCA, F. 2016. Design and results of the fifth answer set programming competition. Artificial Intelligence 231, 151–181.
CAPPANERA, P., GAVANELLI, M., NONATO, M., AND ROMA, M. 2023. Logic-based benders decomposition in answer set programming for chronic outpatients scheduling. Theory and Practice of Logic Programming 23, 4, 848–864.
CAYIRLI, T., YANG, K., AND QUEK, S. 2012. A universal appointment rule in the presence of no-shows and walk-ins. Production and Operations Management 21.
CEYLAN, I., LUKASIEWICZ, T., AND PENALOZA, R. 2016. Complexity results for probabilistic datalog±. In 2nd European Conference on Artificial Intelligence. IOS Press.
COZMAN, F. G. AND MAUÁ, D. D. 2017. On the semantics and complexity of probabilistic logic programs. Journal of Artificial Intelligence Research. 60, 221–262.
COZMAN, F. G. AND MAUÁ, D. D. 2020. The joy of probabilistic answer set programming: Semantics, complexity, expressivity, inference. International Journal of Approximate Reasoning 125, 218–239.
CUTERI, A., MAZZOTTA, G., AND RICCA, F. 2026. 2-ASP(Q) solving based on CEGAR. In Fortieth AAAI Conference on Artificial Intelligence, Thirty-Eighth Conference on Innovative Applications of Artificial Intelligence, Sixteenth Symposium on Educational Advances in Artificial Intelligence, AAAI 2026, Singapore, January 20-27, 2026, S. Koenig, C. Jenkins, and M. E. Taylor, Eds. AAAI Press, 19030–19038.
Optimal Probabilistic Answer Set Programming: Complexity and Implementations 39
DANTSIN, E., EITER, T., GOTTLOB, G., AND VORONKOV, A. 2001. Complexity and expressive power of logic programming. ACM Computing Surveys 33, 3, 374–425.
DARWICHE, A. AND MARQUIS, P. 2002. A knowledge compilation map. Journal of Artificial Intelligence Research 17, 229–264.
DE RAEDT, L., KERSTING, K., NATARAJAN, S., AND POOLE, D. 2016. Statistical relational artificial intelligence: Logic, probability, and computation. Synthesis Lectures on Artificial Intelligence and Machine Learning 10, 2, 1–189.
DE RAEDT, L., KIMMIG, A., AND TOIVONEN, H. 2007. ProbLog: A probabilistic Prolog and its application in link discovery. In 20th International Joint Conference on Artificial Intelligence (IJCAI 2007), M. M. Veloso, Ed. Vol. 7. AAAI Press, 2462–2467.
DI PERRO, D., BERNASCONI, E., AND FERILLI, S. 2025. Automatic reviews’ assignments through ananswer set programming. In IRCDL 2025: 21st Conference on Information and Research Science Connecting to Digital and Library Science, February 20-21 2025, Udine, Italy.
DODARO, C., GALATA, G., GRIONI, A., MARATEA, M., MOCHI, M., AND PORRO, I. 2021. An ASP-based solution to the chemotherapy treatment scheduling problem. Theory and Practice of Logic Programming 21, 6, 835–851.
DODARO, C., GALATÀ, G., MARATEA, M., MARTE, C., AND MOCHI, M. 2026. ASP-based approaches for solving the nuclear medicine scheduling problem. Journal of Logic and Computation 36, 2.
DODARO, C. AND MARATEA, M. 2017. Nurse scheduling via ananswer set programming. In International Conference on Logic Programming and Nonmonotonic Reasoning. Springer, 301–307.
DOMINGOS, P. AND RICHARDSON, M. 2001. Mining the network value of customers. In Proceedings of the Seventh ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. Association for Computing Machinery, New York, NY, USA, 57–66.
EITER, T. AND GOTTLOB, G. 1995a. The complexity of logic-based abduction. Journal of the ACM 42, 1, 3–42.
EITER, T. AND GOTTLOB, G. 1995b. On the computational cost of disjunctive logic programming: Propositional case. Annals of Mathematics and Artificial Intelligence 15, 3-4, 289–323.
EITER, T., HECHER, M., AND KIESEL, R. 2024. aspmc: New frontiers of algebraic answer set counting. Artificial Intelligence 330, 104109.
EITER, T., LUKASIEWICZ, T., AND PREDOIU, L. 2016. Generalized consistent query answering under existential rules. In Proceedings of the International Conference on Principles of Knowledge Representation and Reasoning. 359–368.
ERDEM, E., GELFOND, M., AND LEONE, N. 2016. Applications of answer set programming. AI Magazine 37, 3, 53–68.
FABER, W., PFEIFER, G., AND LEONE, N. 2011. Semantics and complexity of recursive aggregates in answer set programming. Artificial Intelligence 175, 1, 278–298.
FALKNER, A. A., FRIEDRICH, G., SCHEKOTIHIN, K., TAUPE, R., AND TEPPAN, E. C. 2018. Industrial applications of answer set programming. Künstliche Intelligenz 32, 2-3, 165–176.
GAMBLIN, T., CULPO, M., BECKER, G., AND SHUDLER, S. 2022. Using answer set programming for HPC dependency solving. In SC. IEEE, 35:1–35:15.
GEBSER, M., KAMINSKI, R., KAUFMANN, B., AND SCHAUB, T. 2019. Multi-shot ASP solving with clingo. Theory and Practice of Logic Programming 19, 1, 27–82.
GONDRAN, M. AND MINOUX, M. 2008. Graphs, Dioids and Semirings: New Models and Algorithms (Operations Research/Computer Science Interfaces Series), 1 ed. Springer Publishing Company, Incorporated.
HAGBERG, A. A., SCHULT, D. A., AND SWART, P. J. 2008. Exploring network structure, dynamics, and function using NetworkX. In Proceedings of the 7th Python in Science Conference, G. Varoquaux, T. Vaught, and J. Millman, Eds. Pasadena, CA USA, 11 – 15.
KALMUKOV, Y. 2020. An algorithm for automatic assignment of reviewers to papers. Scientometrics 124, 3, 1811–1850.
KAMINSKI, R., SCHAUB, T., ROMERO, J., AND RAZZAQ, M. 2024. Explaining artificial neural networks using answer set programming. In Advances in Interpretable Machine Learning and Artificial Intelligence (AIMLAI), ECML/PKDD 2024.
KIESEL, R., TOTIS, P., AND KIMMIG, A. 2022. Efficient knowledge compilation beyond weighted model counting. Theory and Practice of Logic Programming 22, 4, 505–522.
KIMMIG, A., VAN DEN BROECK, G., AND DE RAEDT, L. 2017. Algebraic model counting. Journal of Applied Logic 22, C, 46–62.
KÜCHENMEISTER, N., IVLIEV, A., AND KRÖTZSCH, M. 2026. Towards mass spectrum analysis with ASP. Theory and Practice of Logic Programming, 1–23.
LEE, J., TALSANIA, S., AND WANG, Y. 2017. Computing LPMLN using ASP and MLN solvers. Theory and Practice of Logic Programming 17, 5-6, 942–960.
LEE, J. AND YANG, Z. 2017. LPMLN, weak constraints, and P-log. In Proceedings of the AAAI Conference on Artificial Intelligence. Vol. 31.
MAUÁ, D. D. AND COZMAN, F. G. 2020. Complexity results for probabilistic answer set programming. International Journal of Approximate Reasoning 118, 133–154.
MAZZOTTA, G., RICCA, F., AND TRUSZCZYNSKI, M. 2024. Quantifying over optimum answer sets. Theory and Practice of Logic Programming 24, 4, 716–736.
RIGUZZI, F. 2022. Foundations of Probabilistic Logic Programming Languages, Semantics, Inference and Learning, Second Edition. River Publishers, Gistrup, Denmark.
ROCHA, V. H. N. AND COZMAN, F. G. 2022. A credal least undefined stable semantics for probabilistic logic programs and probabilistic argumentation. In Proceedings of the 19th International Conference on Principles of Knowledge Representation and Reasoning, KR 2022, G. Kern-Isberner, G. Lakemeyer, and T. Meyer, Eds. 309–319.
SHTERIONOV, D. S., RENKENS, J., VLASSELAER, J., KIMMIG, A., MEERT, W., AND JANSSENS, G. 2015. The most probable explanation for probabilistic logic programs with annotated disjunctions. In Inductive Logic Programming, J. Davis and J. Ramon, Eds. Lecture Notes in Computer Science, vol. 9046. Springer, Berlin, Heidelberg, 139–153.
TOPUZ, K., URBAN, T. L., RUSSELL, R. A., AND YILDIRIM, M. B. 2024. Decision support system for appointment scheduling and overbooking under patient no-show behavior. Annals of Operations Research 342, 1 (Nov), 845–873.
TOTIS, P., DE RAEDT, L., AND KIMMIG, A. 2023. smProbLog: Stable model semantics in problog for probabilistic argumentation. Theory and Practice of Logic Programming, 1–50.
VAN DEN BROECK, G., THON, I., VAN OTTERLO, M., AND DE RAEDT, L. 2010. DTProbLog: A decision-theoretic probabilistic Prolog. In Proceedings of the Twenty-Fourth AAAI Conference on Artificial Intelligence, M. Fox and D. Poole, Eds. AAAI Press, 1217–1222.
VAN GELDER, A., ROSS, K. A., AND SCHLIPF, J. S. 1991. The well-founded semantics for general logic programs. Journal of the ACM (JACM) 38, 3, 619–649.