ASP Paper
ASP Paper
1
Lalit Kumar*, 2Praveen Ailawalia
1
Department of Computer Science and Engineering
Chandigarh University, Gharuan-Mohali, Punjab, India
[email protected]
2
Department of Mathematics
Chandigarh University, Gharuan-Mohali, Punjab, India
[email protected]
Abstract: -
The abstract presents a novel approach called extraction of Answer Set Programming for
tackling the challenging problem of nondeterministic polynomial problem. Traditionally,
such tasks rely heavily on manual data annotation, which is both time-consuming and error-
prone. Answer Set Programming (ASP) to bridge the gap between data-driven induction and
deductive reasoning. This unique approach incorporates factual knowledge and rules within
the ASP framework into the learning process of neural network models. By integrating both
data and domain knowledge, promising solution to the complex problem of joint entity-
relation extraction, potentially reducing the burden of manual annotation and advancing the
field of natural language processing.
In the present article the authors introduce procedures to generate multiple alternative
encodings, identical to the original encoding, to enhance encoding diversity. The procedures
to generate multiple alternative encodings, identical to the original encoding, to enhance
encoding diversity. System capable of taking a set of problem encodings, problem instances,
and an ASP grounding solving system as inputs, automatically generating equivalent
encodings. These models estimate the time required for the grounding/solving system to
complete an instance based on its encoding. As new instances arise, the system selects the
encoding expected to perform best for each instance, enabling more efficient ASP solving.
The system supports both planned and interleaved execution of encodings, complementing
machine learning methods.
1. Introduction:
Modeling and resolving complex research problems using Answer Set Programming (ASP) is
a well-established practice. ASP represents these problems as encodings, which consist of
sets of rules that define the problem's logic without providing solutions. Gerhard Brewka,
et.al., (2011) introduces the foundational principles of Answer Set Programming (ASP),
shedding light on its role as a promising declarative problem-solving approach. A concise and
informative overview of ASP's key concepts and motivations.
Guyet, et.al., (2018) discusses the application of Answer Set Programming (ASP) for the
purpose of discovering sequential patterns. ASP is a declarative logic programming paradigm
known for its effectiveness in encoding combinatorial and optimization problems, as well as
for facilitating knowledge representation and reasoning. Consequently, ASP stands as a
promising choice for implementing pattern mining, particularly when it involves
incorporating background knowledge. This integration of background knowledge into pattern
mining has been a long-standing concern within the field of data mining
Liu et. al., (2019) numerous equivalent encodings exist in Answer Set Programming (ASP)
for various search and optimization tasks. These encodings do not exhibit consistent
performance superiority when evaluated across a large number of problem instances. The
authors suggest that leveraging machine learning techniques to identify encodings likely to
perform well on specific instances can potentially enhance ASP's problem-solving
capabilities. Their research on the Hamiltonian cycle problem provides empirical support for
this assertion.
Bichler et.al., (2020) introduces decomposing large logic programming rules in ASP, aimed
at improving solver performance. The paper includes an algorithm, theoretical foundations,
and experimental results supporting its efficacy. A valuable contribution to ASP
optimization.
Thomas Eiter et al., (2022) Although Answer-Set Programming (ASP) has gained popularity
as a declarative method for addressing problems, it is not without its limitations when it
comes to optimisation issues. High yet unrealized potential exists in the use of the
optimization metaheuristic known as Large-Neighbourhood Search (LNS) for resolving
ASPs. In this paper, we provide a framework for LNS optimization in solving answer sets,
where neighbourhoods may be defined either declaratively as part of the ASP encoding or
created programmatically. We concentrate on multi-shot solutions, which helps us to prevent
program re-grounding and successfully probe a variety of nearby neighbourhoods.
Geibinger et.al., (2023) discussed growing importance of AI explainability stems from its
widespread integration into our lives and increasingly complex systems. This project aims to
enhance explanation capabilities in Answer-Set Programming (ASP), addressing gaps in
existing approaches and introducing novel formalisms like contrastive explanations for ASP
solutions.
It is common in ASP to have multiple equivalent encodings for the same problem. Recent
studies have shown that the performance of different ASP encodings varies significantly
when processed by modern ASP grounding and solving systems. It is rare for a single
encoding to outperform all others consistently. The choice of an appropriate encoding plays a
crucial role in the effectiveness of ASP solutions.
2. Findings:
Answer Set Programming (ASP) has found application in various theoretical and practical
domains due to its versatile high-level modelling capabilities and the ongoing enhancements
in solver performance. However, despite its simplicity in modelling, ASP poses challenges in
implementation. The grounding and solution procedures encounter substantial hurdles.
Particularly, when dealing with complex rule systems, solving can become time-consuming.
The auxiliary predicate reach is defined in this set of rules by use of the three variables X, Y,
and Z. Approximately 11 million lines are produced in the grounded output when the
program is run on a random graph instance with 1000 nodes and 10000 edges. Assuming an
additional 31.30 seconds for grounding, the total solution time is 318.63 seconds.
Encoding rewriting techniques may be used to use projection to minimize the number of
variables in rules, thereby solving the "grounding" issue. Another strategy is to discover a
model for the restriction that results in a rule encoding with fewer variables. To represent the
reachability constraint, for instance, it is necessary to first choose a node (either statically or
according to a set of constraints). Take s to be a chosen node. Clearly, candidates are
collections of disjoint cycles spanning all vertices and cycles constitute really a single cycle
due to the reachability condition that demands that each vertex be accessible from s by a
route of chosen edges. This limitation may be phrased as such (recall that we retain the same
name for the reachability predicate and that we have fixed the "start" node to be 1), so that the
program will only function for graphs in which 1 is a vertex.
The second difficulty is finding a solution. The intrinsic difficulty of the issue it addresses
causes the solution process to bog down. The issue of determining whether a given
propositional program has an answer set is NP-complete (and even P-complete for certain
implementations of the language). It is commonly believed that there is no way to solve such
issues in a way that would ensure optimal performance. Therefore, when evaluated on a large
set of examples, even the most cutting-edge solvers will only be able to solve a subset of the
issues. Interestingly, a large body of experimental data accumulated over the years
demonstrates that excellent solvers thrive in a certain domain or class of examples but
inevitably underperform on many other sorts of instances. The strong points of many solvers
tend not to overlap. As a result, the emergence of a single solver that is superior than the
others is quite improbable. That gives us a chance to enhance solution with ASP solvers by
choosing the best solver for each individual case.
Current state-of-the-art solvers are built with tens or even hundreds of control parameters
(settings), which impact the choices made throughout the searching process; this presents
both a difficulty and an opportunity for the solution phase. The number of conflicts that will
force a restart, the counting strategy for those conflicts (local vs. global), the number of
learned causes that will be stored, the number of learned causes that will be deleted after a
restart, and the number of restarts that will occur before rearranging internal data are all
examples. The performance of solution may be improved by many orders of magnitude with
a well-chosen parameter configuration, as shown in previous research. Modern solvers often
provide a default parameter configuration that is effective in many situations; but, for some
sorts of instances, the optimized settings perform better. Another option is to stop looking for
the optimal parameter values, it is possible to build a library of solvers from a single one by
picking several parameter settings and then executing many of them in parallel or in
succession. Portfolio solution is the term for this kind of analysis.
160
140
120
100
80
60
40
20
0
Encoding 1 Encoding 2 Encoding 3 Encoding 4 Encoding 5 Encoding 6 Oracle
As may be expected, the topics of solver selection, portfolio solving, and automated
parameter con- figuration have all been the subject of substantial research in ASP.
Researchers advocated doing solver selection on a per-instance basis, i.e., using machine
learning approaches to develop performance models for particular solvers, to take advantage
of the variable performance on various problems. These models, when presented with a new
instance, predict how well the relevant choices (solvers, parameter configurations) will
perform on that instance. Based on these forecasts, a suitable solution or set of parameters for
the case in question may be chosen.
There is much more that can be done to boost ASP's efficiency. It is also generally
known that search problems often accept several comparable encodings, as we pointed out
before. While theoretically equal, the performance of these encodings tends to vary among
instances. Over the previous two decades of experimentation, data has gathered suggesting
that multiple AS encodings for a particular task may exhibit notably differing performance. In
particular, it is unusual for the same encoding to be optimal (with a chosen grounder-solver
tool) for all issue data instances.
3. Pythagorean Triplet
The three numbers a, b, and c must satisfy the equation a 2+ b2=c 2. 1 to be considered a
Pythagorean Triplet. To solve the Pythagorean Triplet issue in ASP, one must determine the
biggest n such that no partition of the integers from 1 to n has the three positive integers a, b,
and c such that a 2+ b2=c 2. When n is larger than 7825, there is no model for this issue.
Constraints are a natural fit for modeling the Pythagorean Triplet issue. To ensure that no
component includes the square sum relation, we may create a constraint and iteratively tweak
n until we reach the ultimate answer, the first n that makes the issue unsatisfiable. The
following is a paradigm for an encoding of the Pythagorean Triplet.
First, we use the interval operation.. to provide the range of integers (1, 2, 3,...) that will be
used for the partition. According to the second guideline, the totals must be divided in half.
Using the choice rule, the third rule specifies that each number belongs to exactly one of the
subparts. Any given section must not have the three values X, Y, and Z such that a 2+ b2=c 2.
This final criterion is a constraint.
If the above encoding is satisfiable, then the numbers may be correctly divided into two
halves, one of which does not include a Pythagorean Triplet. If it is not satisfiable, then the
biggest number n that can be divided is determined.
Using the aforementioned encoding to solve Pythagorean Triplet problems, the authors
observed that the runtime (grounding + solution) climbs exponentially with the amount of
input. After digging further, grounding step accounted for the vast majority of the total time.
Figure 1 shows that the overall runtime is very close to the grounding time, indicating that
once an issue has been identified and isolated, it may be readily resolved. The question of
how to maximize productivity without sacrificing safety by increasing the amount of time
spent grounding emerges. We need information on the grounding step to help us solve the
issue. In the grounding step, the grounder executes a square sum operation, which involves
instantiating X, Y, and Z with all conceivable values. In addition, it preserves just the
instantiations that meet the square sum relation X 2 +Y 2 =Z 2, while discarding the others.
When n = 10, for instance, the grounding output is
300
250
200
150
100
50
0
200 400 600 800 1000 1200
1200 400
100
1000 600
800
Original Total
The grounded program is shown to only save instances when X 2 +Y 2 =Z 2. Therefore, in the
grounding phase, once square calculations and equation evaluations are performed, the
majority of the created instantiations are discarded.
One approach is to perform the necessary computations outside of the ASP program (for
example, all Pythagorean Triplets over integers in 1, 2,..., n) and compile them into a list of
facts over a new predicate; then, by using these facts, the program can be expanded and the
arithmetic atom in appropriate rules can be replaced. That manner, we avoid creating any
unnecessary instantiations during grounding. Therefore, we employ the predicate
introduction, where the list of Triplets (a, b, c) outside of the grounder where c 2=a2+ b2, and
then integrate that result using a suitably adjusted AS program representing the issue. In the
aforementioned example, I am able to predict the expansion of the predicate sqsum(a, b, c),
which includes any integer Triplets (a, b, c) matching the formula a 2+ b2=c 2. The original
occurrence of the arithmetic equality atom is then replaced by the precomputed predicate
sqsum, and the facts sqsum(a, b, c) are added to the program.
4. Conclusion:
Rewriting answer-set programs in both the grounding and solution stages may increase ASP's
performance. A rewriting technique wherein mathematical particles are removed manually
during the grounding phase is developed. This strategy replaces the arithmetic atoms with
new ones and utilizes procedural programming to calculate their extensions in advance.
The tests on the Pythagorean Triplet and the Schur number issues indicated that this strategy
has the potential to significantly shorten the initialization time.
In the solution phase, strategies for enhancing ASP's functionality through encoding rewriting
and encoding selection. Based on the aggregate introduction, aggregate removal is built an
automatic encoding rewriting tool called AAgg is provided contributions to AAgg made it
possible to convert aggregate rules to regular rules and widened the application domain for
adding aggregates. The research and proposals also include rewriting ASP encodings through
rule replication using alternative atoms.
When it comes to choosing an encoding, several strategies for building sets of encodings that
exhibit complimentary behavior given a collection of issue cases have been covered. A
method to employ machine learning to construct performance models to facilitate encoding
selection on an instance-by-instance basis when such a set of encodings is available. A
technique to build execution plans for a problem as an alternate processing method is
developed.
The platform utilizes the latest version of AAgg to provide automated encoding rewriting.
Both sequential execution of encodings according to some fixed time allocations and
interleaved execution were taken into account when planning the scheduling of encodings.
Performance data collection, candidate encoding selection, feature extraction, feature
selection, machine learning modeling, and encoding scheduling were also incorporated.
References
Gebser, Martin, Roland Kaminski, Benjamin Kaufmann, and Torsten Schaub (2022) “Answer
set solving in practice.” Springer Nature.
Liu, Liu. (2022) "The Performance Optimization of ASP Solving Based on Encoding
Rewriting and Encoding Selection." PhD diss., University of Kentucky Libraries.
De Cat, B., Bogaerts, B., Bruynooghe, M., Janssens, G., & Denecker, M. (2018). Predicate
logic as a modeling language: the IDP system. In Declarative Logic Programming: Theory,
Systems, and Applications, pp. 279-323.
Morak, Michael, Manuel Bichler, and Stefan Woltran. (2017) "lpopt: A Rule Optimization
Tool for Answer Set Programming." In Logic-Based Program Synthesis and Transformation,
pp. 114-130.
Erdem, E., & Oztok, U. (2015). Generating explanations for biomedical queries. Theory and
Practice of Logic Programming, 15(1), pp. 35-78.
Erdem, E., Aker, E., & Patoglu, V. (2012). Answer set programming for collaborative
housekeeping robotics: representation, reasoning, and execution. Intelligent Service
Robotics, 5, 275-291.
Clocksin, William F., and Christopher S. Mellish. Programming (2003) PROLOG. Springer
Science & Business Media.
Cheeseman, P. C., Kanefsky, B., & Taylor, W. M. (1991). Where the really hard problems
are. In Ijcai, Vol. 91, pp. 331-337.