Intro: The Problem
My problem relates to solving a system of equations that find the fixpoint of a studied boolean system ($F(X)=X$).
A Simple Example
Let $\bar{x}=\{x_1,x_2,x_3\} \in \{0,1\}$ be some boolean variables of interest. Let $F=\{f_1,f_2,f_3\}$ be the update functions for these variables (i.e. $x_i(t+1) = f_i(x(t))$), defined as the follow condition functions (they are based on the inputs of each variable - node in the corresponding graph conceptualization):
$f_1 = \begin{cases} 1, -x_2 \ge 0 \\ 0, \text{otherwise} \end{cases}$, $f_2 = \begin{cases} 1, x_1-x_3 \ge 0 \\ 0, \text{otherwise} \end{cases}$, $f_3 = \begin{cases} 1, x_1+x_3 \ge 0 \\ 0, \text{otherwise} \end{cases}$
These functions are inspired by this question.
The goal is to to find answer sets $\bar{x}$ (could be zero, one or many per se) for which $F(\bar{x})=\bar{x}$.
The above example is of course a very simple case. In the end I would like to solve such system of equations with hundreds of variables. Note that the condition functions will always be linear combinations of each variable's inputs and the variables always boolean.
The Question
I need an efficient solver for this kind of problem (which is known to be NP-hard btw!). E.g. can this problem formulated as constraint programming and solved using Answer Set Programming (ASP) techniques?
So it turns out that ASP can be used to solve this problem! Here I provide a possible encoding of the problem in a file named
fp.lp:Using
clingo(version5.4.0) from the command line:clingo fp.lpwe get UNSATISFIABLE for this particular instance.Commenting the fact
%f(2,1,1).and running again theclingosolver we get:Variables that are returned both in the
init/1andnext/1predicates are translated to active boolean variables (1) and those that are missing to inactive values (0). The returned result is thus the boolean vector $\bar{x}=\{x_1=1,x_2=0,x_3=1\}$.Credits for this answer go to Roland Kaminski. Various other members of the ASP potassco community provided helpful comments and solutions. For more info on ASP, check: https://potassco.org/