<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Constraints | DTAI Stories</title><link>https://dtai.cs.kuleuven.be/stories/categories/constraints/</link><atom:link href="https://dtai.cs.kuleuven.be/stories/categories/constraints/index.xml" rel="self" type="application/rss+xml"/><description>Constraints</description><generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><lastBuildDate>Thu, 30 Jul 2026 17:14:00 +0200</lastBuildDate><image><url>img/map[gravatar:%!s(bool=false) shape:circle]</url><title>Constraints</title><link>https://dtai.cs.kuleuven.be/stories/categories/constraints/</link></image><item><title>CPMpy release and celebrations at FLOC26</title><link>https://dtai.cs.kuleuven.be/stories/post/tias-guns/cpmpy_release/</link><pubDate>Thu, 30 Jul 2026 17:14:00 +0200</pubDate><guid>https://dtai.cs.kuleuven.be/stories/post/tias-guns/cpmpy_release/</guid><description>&lt;p>CPMpy made its v1.0 release a week ago, and won multiple medals in the
&lt;a href="https://www.floc26.org/olympics" target="_blank" rel="noopener">FLoC Olympic Games&lt;/a> competitions.&lt;/p>
&lt;div style="text-align: center;">
&lt;figure id="figure-constraint-programming-and-modeling-in-python">
&lt;a href="https://github.com/CPMpy/cpmpy" target="_blank">
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/tias-guns/cpmpy_release/cpmpy_logo_hu2128660dda9467f2b93c849ddbdb802f_226482_2000x2000_fit_lanczos_3.png" class="lazyload" alt="CPMpy logo" width="55%" height="600">
&lt;/a>
&lt;figcaption>
Constraint Programming and Modeling in Python
&lt;/figcaption>
&lt;/figure>
&lt;p>
&lt;a href="https://github.com/CPMpy/cpmpy" target="_blank" rel="noopener">Code&lt;/a>
&lt;i class="fab fa-github pr-1 fa-fw">&lt;/i> ·
&lt;a href="https://cpmpy.readthedocs.io/" target="_blank" rel="noopener">Documentation&lt;/a>
&lt;i class="fas fa-book pr-1 fa-fw">&lt;/i> ·
&lt;a href="https://pypi.org/project/cpmpy/" target="_blank" rel="noopener">PyPI&lt;/a>
&lt;i class="fab fa-python pr-1 fa-fw">&lt;/i>&lt;/p>
&lt;/div>
&lt;!-- &lt;div class="alert alert-tip">
&lt;div>
&lt;strong>v1.0.0 is out!&lt;/strong> Install with &lt;code>pip install cpmpy&lt;/code>, or browse the
&lt;a href="https://github.com/CPMpy/cpmpy/releases" target="_blank" rel="noopener">release on GitHub&lt;/a>.
&lt;/div>
&lt;/div>
-->
&lt;p>Last week we were in Lisbon, Portugal for
&lt;a href="https://www.floc26.org/" target="_blank" rel="noopener">FLoC&lt;/a>, a co-located conference that included CP, SAT, KR, and seven other logic-based conferences.&lt;/p>
&lt;p>Just before the conference, the team managed to finish the v1.0.0 release of our
&lt;a href="https://github.com/CPMpy/cpmpy" target="_blank" rel="noopener">CPMpy&lt;/a> library for combinatorial optimisation. This library has been the foundation of my
&lt;a href="https://people.cs.kuleuven.be/~tias.guns/chat-opt.html" target="_blank" rel="noopener">ERC CHAT-Opt&lt;/a> project. We should have released a version 1 over 3 years ago, but we were too occupied with wanting to make it better and better&amp;hellip;&lt;/p>
&lt;p>As the CHAT-Opt project came to an end, it felt like the right moment to mark it with a 1.0.0 release (we still have plans to make it even better though). We celebrated the release with an official logo, and nice T-shirts featuring the logo that the team members were wearing. We were happy with the many encouraging words and conversations that followed!&lt;/p>
&lt;p>We were also honoured to receive a FLOC Olympic Games medal for our submission with
&lt;a href="https://developers.google.com/optimization" target="_blank" rel="noopener">OR-Tools CP-SAT&lt;/a> to the
&lt;a href="https://www.xcsp.org/competitions/" target="_blank" rel="noopener">XCSP3 competition&lt;/a>. We actually submitted eight different solvers to that competition. The role of CPMpy in such a submission is to efficiently take any instance, minimally modify it to match the solver API, and quickly pass that on to the solver. While this requires careful engineering, it is the solver itself that makes the biggest difference here. Hence, we were happy to take the medal, with no modifications needed, and pass it on to
&lt;a href="https://research.google/people/105821/?&amp;amp;type=google" target="_blank" rel="noopener">Laurent Perron&lt;/a> of the OR-Tools CP-SAT team : )&lt;/p>
&lt;p>Thanks to our team member &lt;a href="https://dtai.cs.kuleuven.be/stories/stories/authors/thomas-sergeys/">Thomas Sergeys&lt;/a>, we not only submitted multiple solvers to the XCSP3 competition, but we also submitted multiple solvers to the
&lt;a href="https://www.cril.univ-artois.fr/PB26/" target="_blank" rel="noopener">Pseudo-Boolean Competition&lt;/a> and to
&lt;a href="https://maxsat-evaluations.github.io/2026/" target="_blank" rel="noopener">MaxSAT Evaluation&lt;/a>. Here too, our submission with OR-Tools tended to perform best among our submissions, even resulting in 2 bronze medals in the XCSP3 COP track and 2 gold medals in the PseudoBoolean parallel DEC_LIN and OPT_LIN tracks!&lt;/p>
&lt;p>(The attentive reader might wonder why we &amp;lsquo;only&amp;rsquo; achieved bronze with cpmpy_ortools on XCSP3 COP, a track in which we achieved gold the past 2 years. The answer is as subtle as it is unfortunate: the competition awards solvers for how quickly they find intermediate solutions. However our submission accidentally buffered all these intermediate solutions throughout the entire solver&amp;rsquo;s runtime, only appearing all at once at the complete end. A simple mistake which we forgot to change during maintenance work&amp;hellip;)&lt;/p>
&lt;p>Finally, this year we not only submitted solvers, but we also used our new CPMpy tools &amp;lsquo;datasets&amp;rsquo; and &amp;lsquo;io&amp;rsquo; to submit instances from public benchmarks to different competitions, translated by CPMpy. If you want to read more about how we did that, check out our SAT Tool paper
&lt;a href="https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.SAT.2026.42" target="_blank" rel="noopener">Unified Programmatic Access to CO Benchmarks, to Connect Constraint Solving Communities&lt;/a>. We also submitted the real-world problem instances of our
&lt;a href="https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.CP.2025.6" target="_blank" rel="noopener">CP26 Best Application Paper&lt;/a> and a benchmark set derived from the
&lt;a href="https://aics.aau.at/saeling/" target="_blank" rel="noopener">SAELING&lt;/a> project in the metalworking industry to the
&lt;a href="https://www.minizinc.org/challenge/2026/" target="_blank" rel="noopener">MiniZinc Challenge&lt;/a>.&lt;/p>
&lt;p>All in all, it should be clear that I am immensely proud of what we have achieved with CPMpy over these past years. The release, the feedback and the awards are great recognition of that effort, and I want to wholeheartedly thank all the researchers that helped build CPMpy along the way.&lt;/p>
&lt;!--
&lt;div class="card relpub">
&lt;div class="card-body">
&lt;small>
&lt;p>This post is based on the following publications:&lt;/p>
&lt;ul>
&lt;li>
&lt;a href="https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.CP.2025.6" target="_blank" rel="noopener">Modeling and Explaining an Industrial Workforce Allocation and Scheduling Problem&lt;/a>. Bleukx, Ignace, Boumazouza, Ryma, Guns, Tias, Laage, Nadine, and Poveda, Guillaume, CP 2025 (Best Application Paper Award).&lt;/li>
&lt;li>
&lt;a href="https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.SAT.2026.42" target="_blank" rel="noopener">Unified Programmatic Access to CO Benchmarks, to Connect Constraint Solving Communities&lt;/a>. Sergeys, Thomas, Bleukx, Ignace, Guns, Tias, SAT 2026 (Tool paper).&lt;/li>
&lt;/ul>
&lt;/small>
&lt;/div>
&lt;/div>
--></description></item><item><title>Modelling and Explaining Workforce Allocation at Airbus with CPMpy</title><link>https://dtai.cs.kuleuven.be/stories/post/ignace-bleukx/modelling-and-explaining-workforce-allocation-at-airbus-with-cpmpy/</link><pubDate>Mon, 27 Apr 2026 16:31:21 +0200</pubDate><guid>https://dtai.cs.kuleuven.be/stories/post/ignace-bleukx/modelling-and-explaining-workforce-allocation-at-airbus-with-cpmpy/</guid><description>&lt;p>As part the EU project Tuples [1] we had the opportunity of collaborating with Airbus Toulouse on a challenging workforce allocation and scheduling problem. Everyday, planners at Airbus factories need to schedule and allocate logistical tasks to worker teams. These tasks are incredibly diverse and range from the transportation of aircraft components from one hangar to another to the loading and unloading of Beluga® cargo planes.&lt;/p>
&lt;div style="display:flex; justify-content:centerl; gap:16px; width:80%; margin:0 auto 1em auto;">
&lt;figure style="flex:1; margin:0;">
&lt;img src="beluga.jpg" alt="Beluga cargo plane" style="width:100%; height:200px; object-fit:cover; display:block;">
&lt;/figure>
&lt;figure style="flex:1; margin:0;">
&lt;img src="factory.jpg" alt="Airbus factory" style="width:100%; height:200px; object-fit:cover; display:block;">
&lt;/figure>
&lt;/div>
&lt;p>Timely execution of these tasks is essential for the operational efficiency of the factory. Indeed, any missed deadlines can cascade throughout the assembly lines and cause significant delays during production of the aircraft. The planning and allocation of these transportation tasks is mostly done by hand by an expert team of planners. They ensure that each task is executed on time, and by a worker team that has the required training for executing that task.&lt;/p>
&lt;p>Using our expertise in constraint optimization, we collaborated with the research team at Airbus to develop a reliable, trustworthy and explainable decision support system for the planners. More specifically, we developed algorithms that can (1) propose an efficient and fair initial schedule that satisfies all operational constraints and (2) can help in resolving operational disruptions throughout the day.&lt;/p>
&lt;h2 id="fair-and-efficient-schedules">Fair and Efficient Schedules&lt;/h2>
&lt;p>Using the open-source CPMpy constraint modelling library, we developed a Constraint Programming (CP) model to solve this large workforce-allocation and scheduling problem.
CP is a declarative approach for solving combinatorial problems, where the user models their problem using integer variables and constraints; after which a general-purpose constraint solver is used to find an optimal solution to the problem. This technology is perfectly suited for this problem as any solution computed by the solver is guaranteed to satisfy all operational constraints.&lt;/p>
&lt;p>Our model shares similarity with state-of the-art CP-models for flexible job-shop problems where the goal is to schedule a set of tasks onto a set of machines, where tasks cannot overlap. We used scheduling-specific global constraints, symmetry breaking techniques and a problem relaxation to efficiently find optimal solutions to the allocation and scheduling problem.
Unique to this use-case of workforce allocation are the objectives we aim to optimize. In traditional scheduling problems, it is common to minimize the makespan. However, for our problem, we construct a bi-objective optimization problem with the following objectives:&lt;/p>
&lt;ol>
&lt;li>Minimize the number of worker-teams used to execute the schedule&lt;/li>
&lt;li>Optimize fairness of the schedule, such that no team is needlessly overused or underused. The fairness is formulated as the “time-dispersion”, which is expressed formally as $max_{t \in Teams} (time_worked_t) - min_{t \in Teams} (time_worked_t)$&lt;/li>
&lt;/ol>
&lt;p>We experiment with two variants of the problem: a pure-allocation and an allocation+scheduling setting. In the pure allocation setting, planners first determine the start-times of each task, and use the CP-model to allocate the tasks to a team. This reflects their current workflow as tasks are scheduled given an order book for the coming planning period. In the allocation+scheduling setting, the solver is free to chose the start-time of each task, given its earliest start-time and deadline.&lt;/p>
&lt;p>Our experiments showed that using clever modelling techniques such as symmetry breaking constraints, most solvers can find optimal solutions for the pure-allocation setting when minimizing the number of teams in the schedule; and ILP solver Gurobi and Pseudo-Boolean solver Exact perform best among the solvers we tested.&lt;/p>
&lt;div style="display:flex; justify-content:center; align-items:stretch; gap:16px; width:100%;">
&lt;figure style="flex:1; margin:0;">
&lt;img src="allocation.svg" alt="Allocation results" style="width:100%; height:300px; object-fit:contain; display:block;">
&lt;/figure>
&lt;figure style="flex:1; margin:0;">
&lt;img src="scheduling_objective.svg" alt="Scheduling objective over time" style="width:100%; height:320px; object-fit:contain; display:block;">
&lt;/figure>
&lt;/div>
&lt;p>While truly optimal solutions with respect to the fairness objective are rarely found, experiments showed that fair schedules can be found within a couple of seconds using modern solvers. Indeed, the right plot shows the how the objectives change over time for the allocation+scheduling problem (the most difficult variant). Here we clearly see the objective decreases rapidly at the start of the solving process.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/ignace-bleukx/modelling-and-explaining-workforce-allocation-at-airbus-with-cpmpy/repair_hu00445bf75aacd3445091330222c180e6_201226_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/ignace-bleukx/modelling-and-explaining-workforce-allocation-at-airbus-with-cpmpy/repair_hu00445bf75aacd3445091330222c180e6_201226_2000x2000_fit_lanczos_3.png" class="lazyload" alt="" width="80%" height="1496">
&lt;/a>
&lt;/figure>
&lt;h2 id="explaining-and-resolving-disruptions">Explaining and Resolving Disruptions&lt;/h2>
&lt;p>In our research lab, we have been working on explainable constraint solving: we have studied methods not just for efficiently finding solutions, but also for explaining the answer of a constraint solver to a user.&lt;/p>
&lt;p>For this project, a big hurdle for the planners is to understand the consequences of a disruption and how to resolve them. Examples of disruptions are technical malfunctions or unexpectedly adverse weather conditions that cause a resource or worker team to be unavailable for a certain amount of time. Such disruptions are common and almost unavoidable.&lt;/p>
&lt;p>In collaboration with Airbus, we proposed a method to help the planners resolve disruptions by computing a new schedule which is as similar as possible to the initial schedule. More precisely, we compute a new schedule which (1) does not call in any extra teams; (2) minimizes the number of reallocated tasks and (3) minimizes the delay of tasks compared to the initial schedule.&lt;/p>
&lt;p>This ensures the repaired schedule impacts the least number of teams operating on the plant and reduces the cognitive load on the planners to interpret the newly computed schedule. Moreover, as the new schedule uses the original CP-model, the new schedule is guaranteed to satisfy all operational side-constraints as well.&lt;/p>
&lt;h2 id="acknowledgements">Acknowledgements&lt;/h2>
&lt;p>We are honoured that are work was recognized by the CP 2025 Best Application Award, and thank our collaborators at Airbus for this inspiring and fruitful collaboration.&lt;/p>
&lt;h2 id="references">References&lt;/h2>
&lt;ol>
&lt;li>Tuples | Trustworthy AI, Tuples.ai. (2023).
&lt;a href="https://tuples.ai/" target="_blank" rel="noopener">https://tuples.ai/&lt;/a>&lt;/li>
&lt;li>Bleukx, Ignace, Ryma Boumazouza, Tias Guns, Nadine Laage, and Guillaume Poveda. &amp;ldquo;Modeling and explaining an industrial workforce allocation and scheduling problem.&amp;rdquo; Leibniz International Proceedings in Informatics 340 (2025).‌&lt;/li>
&lt;/ol></description></item><item><title>Sudoku Assistant – An AI Assistant Combining Machine Learning and Reasoning</title><link>https://dtai.cs.kuleuven.be/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/</link><pubDate>Tue, 11 Jun 2024 15:51:11 +0200</pubDate><guid>https://dtai.cs.kuleuven.be/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/</guid><description>&lt;p>&lt;em>This story was originally published via
&lt;a href="https://ai.kuleuven.be/stories/" target="_blank" rel="noopener">Leuven.AI Stories&lt;/a>.&lt;/em>&lt;/p>
&lt;p>
&lt;a href="https://en.wikipedia.org/wiki/Sudoku" target="_blank" rel="noopener">Sudoku&lt;/a> is a popular pen-and-paper puzzle game that involves completing a partially filled-in 9x9 grid such that each row, column, and 3x3 box contains all of the digits from 1 to 9. It is commonly included in the puzzle section of newspapers and magazines, and is even sold in the form of dedicated Sudoku puzzle books. It comes in many variants and even has its own annual
&lt;a href="https://www.wspc2022.com/" target="_blank" rel="noopener">world championship&lt;/a>.&lt;/p>
&lt;p>It is also often included in introductory artificial intelligence (AI) courses as a nice way to introduce students to the area of &lt;em>
&lt;a href="https://en.wikipedia.org/wiki/Constraint_programming" target="_blank" rel="noopener">constraint programming&lt;/a>&lt;/em> (CP), a research field that focuses on solving problems that are expressed as constraints over decision variables. With some basic constraint programming knowledge, it is surprisingly easy to write the Sudoku rules as constraints, and have a generic solver compute the solution in milliseconds.&lt;/p>
&lt;p>However, using these highly effective constraint reasoning techniques requires that the Sudoku is provided in a symbolic way, meaning that the 9x9 grid and the given digits are provided to the system as a matrix of numbers. If the Sudoku were given in the form of an image (taken with a smartphone, for example), then this image could not be given as input to a constraint solver. One first has to recognize the given digits and the empty cells, a task best tackled using computer vision techniques involving (convolutional)
&lt;a href="https://en.wikipedia.org/wiki/Artificial_neural_network" target="_blank" rel="noopener">neural networks&lt;/a>, which are machine learning models that can learn to recognize objects, translate text, generate images and so much more.&lt;/p>
&lt;p>Machine learning (e.g., neural networks) and reasoning (e.g., constraint programming) are subfields of AI that have historically been developed mostly independently from one another. However, nowadays there is a growing research interest in &lt;strong>combining these subfields&lt;/strong>. We have developed the &lt;em>Sudoku Assistant&lt;/em> app,
&lt;a href="https://play.google.com/store/apps/details?id=be.kuleuven.cs.visualsudoku&amp;amp;pli=1" target="_blank" rel="noopener">available on the Google Play store&lt;/a>, as a demonstration of such a combination.&lt;/p>
&lt;h2 id="sudoku-assistant--a-demonstrator-of-three-ai-trends">Sudoku Assistant – a demonstrator of three AI trends&lt;/h2>
&lt;p>The
&lt;a href="https://sudoku-assistant.cs.kuleuven.be/index.html" target="_blank" rel="noopener">Sudoku Assistant&lt;/a> is an AI assistant that can interpret, solve and explain pen-and-paper Sudokus scanned with a smartphone. It uses techniques from both machine learning and constraint programming, but goes one step further: it employs &lt;strong>a new way of integrating the digit recognition and the reasoning more deeply&lt;/strong>, allowing it to solve significantly more scanned Sudokus correctly than previous approaches were able to.&lt;/p>
&lt;p>Furthermore, it isn&amp;rsquo;t limited to merely &lt;em>solving&lt;/em> Sudokus: through the use of our state-of-the-art research on step-wise explanations to constraint satisfaction problems, it is able to &lt;strong>guide the user through the solving process by giving small hints&lt;/strong>. This ensures that the AI system doesn&amp;rsquo;t ruin the fun by doing the solving for you, but is able to assist you when you are stuck.&lt;/p>
&lt;p>The Sudoku Assistant hence demonstrates three concepts that are becoming increasingly important in AI research: &lt;strong>the integration of learning and reasoning, explainable AI&lt;/strong> and &lt;strong>human-centered AI&lt;/strong>. And although the assistant is focused on Sudoku, the underlying techniques are equally applicable to other constraint solving problems like timetabling, scheduling and vehicle routing.&lt;/p>
&lt;h2 id="solving-scanned-sudokus-with-integrated-prediction-and-reasoning">Solving Scanned Sudokus with integrated prediction and reasoning&lt;/h2>
&lt;p>One of the Sudoku Assistant&amp;rsquo;s main features is the ability to solve pen-and-paper Sudokus scanned with a smartphone. To do this, the user starts by taking a picture of a Sudoku puzzle. After a picture is taken, the image is segmented into 81 cells. A pre-trained neural network – more specifically a
&lt;a href="https://en.wikipedia.org/wiki/Convolutional_neural_network" target="_blank" rel="noopener">convolutional neural network&lt;/a> (CNN), which is commonly used for image recognition tasks – is then applied to each cell in order to make a digit prediction.&lt;/p>
&lt;p>For each cell, the output of the CNN is a probability distribution over the 10 possible values: digits 1-9 and the empty cell value. Once a probability distribution has been predicted for each cell, the distributions should be used somehow in order to obtain a solution, i.e., a fully filled-in Sudoku. There are two ways of doing this: a naive way in which the digit prediction and the constraint reasoning are clearly separated, and a more effective way in which they are integrated.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/segmented_sudoku_new_huc9cbef85045ad7b7c59bbb88e0eb6d62_927916_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/segmented_sudoku_new_huc9cbef85045ad7b7c59bbb88e0eb6d62_927916_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Figure 1: Cropped and aligned picture of a Sudoku grid taken with a smartphone camera." width="40%" height="1098">
&lt;/a>
&lt;/figure>
&lt;div style="text-align: center;">
&lt;p>&lt;em>&lt;strong>Figure 1: Cropped and aligned picture of a Sudoku grid taken with a smartphone camera.&lt;/strong>&lt;/em>&lt;/p>
&lt;/div>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/predicted_values_new_hu1241ea1aa8b7e7171c7d9fdd1e5e9852_250744_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/predicted_values_new_hu1241ea1aa8b7e7171c7d9fdd1e5e9852_250744_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Figure 2: In each cell, the predicted probability distribution is visualized using a bar chart. The blue bar represents the probability of the cell being empty, while the other 9 bars represent the probabilities of the digits 1 to 9. Bars associated with very small probabilities are omitted." width="40%" height="1101">
&lt;/a>
&lt;/figure>
&lt;div style="text-align: center;">
&lt;p>&lt;em>&lt;strong>Figure 2: In each cell, the predicted probability distribution is visualized using a bar chart. The blue bar represents the probability of the cell being empty, while the other 9 bars represent the probabilities of the digits 1 to 9. Bars associated with very small probabilities are omitted&lt;/strong>&lt;/em>&lt;/p>
&lt;/div>
&lt;h4 id="a-naive-separated-approach">A naive, separated, approach&lt;/h4>
&lt;p>A naive way of using the probability distributions to solve the Sudoku involves assigning to each cell the value that is given the largest probability by the CNN classifier (i.e., the argmax, the most likely prediction). The resulting partial Sudoku can then be modeled as a
&lt;a href="https://en.wikipedia.org/wiki/Constraint_satisfaction_problem" target="_blank" rel="noopener">constraint satisfaction problem&lt;/a> (CSP), which is a problem that consists solely of constraints, and thus does not contain a criterion to be optimized. The CSP can be given to a generic constraint solver in order to obtain the full solution. This approach is schematically shown in Figure 3.&lt;/p>
&lt;p>One large disadvantage of this approach results from the fact that even a single misclassification almost always leads to a wrong solution, or no solution at all. For this reason, even if the digit classifier would have an accuracy of 99%, the naive approach would lead to a correct solution only approximately 0.9981 = 44% of the time (since 81 cells must be classified). To improve on this weakness, a deeper integration of the digit recognition and the reasoning is needed.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/architecture_1_hu164beb1c87dcc395d31fefdf80d93091_2324848_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/architecture_1_hu164beb1c87dcc395d31fefdf80d93091_2324848_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Figure 3: The naive approach. First, a CNN classifier predicts a probability distribution over all 10 possible values for each cell. Then, for each cell, the value with the largest assigned probability is taken and given to a CSP solver, which then computes and outputs the solution." width="3262" height="709">
&lt;/a>
&lt;/figure>
&lt;div style="text-align: center;">
&lt;p>&lt;em>&lt;strong>Figure 3: The naive approach. First, a CNN classifier predicts a probability distribution over all 10 possible values for each cell. Then, for each cell, the value with the largest assigned probability is taken and given to a CSP solver, which then computes and outputs the solution.&lt;/strong>&lt;/em>&lt;/p>
&lt;/div>
&lt;h4 id="an-integrated-approach">An integrated approach&lt;/h4>
&lt;p>To avoid finding no solution or a wrong solution,
&lt;a href="https://arxiv.org/pdf/2003.11001.pdf" target="_blank" rel="noopener">we proposed an alternative approach&lt;/a>, which features a deeper integration of the digit classification and the reasoning required to solve the Sudoku puzzle. This approach is schematically shown in Figure 4.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/architecture_2_hu232a6aab97fdf676e1fc65193fcac6c9_125929_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/architecture_2_hu232a6aab97fdf676e1fc65193fcac6c9_125929_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Figure 4: An integrated approach. The difference with Figure 3 can be seen in the input to the CP solver: here, the full probability distributions produced by the CNN classifier – rather than just the most likely predictions – are used by the CP solver to compute the assignment with the maximum likelihood that respects the Sudoku constraints. This integrated approach can successfully solve considerably more Sudoku puzzles than the naive approach." width="3198" height="642">
&lt;/a>
&lt;/figure>
&lt;div style="text-align: center;">
&lt;p>&lt;em>&lt;strong>Figure 4: An integrated approach. The difference with Figure 3 can be seen in the input to the CP solver: here, the full probability distributions produced by the CNN classifier – rather than just the most likely predictions – are used by the CP solver to compute the assignment with the maximum likelihood that respects the Sudoku constraints. This integrated approach can successfully solve considerably more Sudoku puzzles than the naive approach.&lt;/strong>&lt;/em>&lt;/p>
&lt;/div>
&lt;p>The main idea is to not provide the constraint solver with merely the most likely digit – as predicted by the neural network – for each of the Sudoku’s cells, but rather with the full distributions outputted by the network. In other words, for each of the 81 cells, the solver is given the class probabilities of all 10 possible classes. The solver is then tasked to solve a
&lt;a href="https://en.wikipedia.org/wiki/Constrained_optimization" target="_blank" rel="noopener">constrained optimization problem&lt;/a> (COP), rather than a CSP. This means that it does not merely look for a solution that satisfies certain constraints anymore. It now prefers certain constraint-satisfying solutions over others.&lt;/p>
&lt;p>Concretely, the solver now searches for a solution in which the product of the probabilities associated with all the chosen digits is maximal (i.e., the maximum likelihood solution, given the class probabilities), whilst satisfying the rules of Sudoku. Effectively, this integrated approach allows the reasoning to &lt;strong>correct&lt;/strong> some of the mistakes made by the CNN classifier, by subjecting the classifications to the Sudoku constraints.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/corrected_value_new_huc2942eceac0cd0a4922ae3cef7e5f8b3_107628_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/corrected_value_new_huc2942eceac0cd0a4922ae3cef7e5f8b3_107628_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Figure 5: Wrongly predicted digits corrected by the joint prediction-and-reasoning approach shown in Figure 4." width="40%" height="1104">
&lt;/a>
&lt;/figure>
&lt;div style="text-align: center;">
&lt;p>&lt;em>&lt;strong>Figure 5: Wrongly predicted digits corrected by the joint prediction-and-reasoning approach shown in Figure 4.&lt;/strong>&lt;/em>&lt;/p>
&lt;/div>
&lt;p>Consider, for example, the Sudoku puzzle shown in Figure 5. The naive approach would assign value 2 to the cell highlighted in red, as well as to the cell above it, highlighted in blue, based on the predicted probability distributions (which were shown in Figure 2). However, since two cells in the same column would contain a 2, the CSP solver would not be able to find a valid solution to the problem.&lt;/p>
&lt;p>Instead, our integrated approach recognizes that if the value 2 would occur twice in the same column, a Sudoku constraint would be violated. To correct this conflict, it considers the other probabilities in the predicted distributions. In this case the correction is quite easy: the second largest probability of the cell in red (associated with the value 3) is larger than the second largest probability of the cell in blue, and assigning the value 3 to the cell in red does not conflict with any of the other value assignments. Thus, the value 3 is assigned to the cell in red.&lt;/p>
&lt;p>If, instead, the value 3 &lt;em>did&lt;/em> conflict with another assignment, then either that other assignment would also be corrected, or a value with an even lower probability would be assigned to the cell in red, depending on which option leads to the largest joint probability (the product of the probabilities associated with the assigned values). In this way, the corrections can become quite complex, as is demonstrated in Figure 6, where the cells in red represent the corrections (i.e., value assignments that do not have the largest probability according to the digit recognition model).&lt;/p>
&lt;p>Our approach might even make a correction when there is no direct conflict between any of the most probable values of the different cells. This happens when those values constitute a Sudoku that has no solution, or one that has multiple solutions. Even in these cases the integrated approach knows that the digit recognition model must have made a mistake, since a valid Sudoku must have a unique solution.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/more_complex_correction_hu1efa411539d1591217fa7ce3f92ae165_15146097_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/more_complex_correction_hu1efa411539d1591217fa7ce3f92ae165_15146097_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Figure 6: The corrections made by the novel integrated approach can become quite complex." width="3500" height="1080">
&lt;/a>
&lt;/figure>
&lt;div style="text-align: center;">
&lt;p>&lt;em>&lt;strong>Figure 6: The corrections made by the novel integrated approach can become quite complex.&lt;/strong>&lt;/em>&lt;/p>
&lt;/div>
&lt;div class="card relpub">
&lt;div class="card-body">
&lt;small>
Our approach performs a form of &lt;strong>joint inference&lt;/strong>, taking into account the constraints of the Sudoku problem. The integrated prediction-and-reasoning approach &lt;strong>solves significantly more Sudoku problems correctly&lt;/strong> compared to the naive approach.
&lt;/small>
&lt;/div>
&lt;/div>
&lt;h2 id="guiding-the-user-by-generating-hints">Guiding the user by generating hints&lt;/h2>
&lt;p>We want the Sudoku Assistant to do more than just show the solution and ruin all the fun for the user. We also want it to be able to &lt;em>guide&lt;/em> the user to finding the solution, and to make them learn some solving strategies along the way. For this purpose, we integrated our state-of-the-art research on &lt;em>
&lt;a href="https://www.ijcai.org/proceedings/2021/0191.pdf" target="_blank" rel="noopener">step-wise explaining constraint satisfaction problems&lt;/a>&lt;/em> into the assistant.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/hint_new_huc9b0472bedb13a4175b54bdb7dac5cbe_4817144_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/senne-berden-tias-guns/sudoku-assistant-an-ai-assistant-combining-machine-learning-and-reasoning/img/hint_new_huc9b0472bedb13a4175b54bdb7dac5cbe_4817144_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Figure 7: A generated hint." width="40%" height="1094">
&lt;/a>
&lt;/figure>
&lt;div style="text-align: center;">
&lt;p>&lt;em>&lt;em>&lt;strong>Figure 7: A generated hint.&lt;/strong>&lt;/em>&lt;/em>&lt;/p>
&lt;/div>
&lt;p>As a result, the Sudoku Assistant has a hint mechanism that provides the &lt;strong>easiest next move&lt;/strong> among all empty cells. The provided hint highlights only the existing digits and constraints necessary to derive that cell&amp;rsquo;s value.&lt;/p>
&lt;p>In Figure 6, the green cell containing a white puzzle piece represents a derived digit, which is currently hidden to the user in order to give them the chance to derive it by themselves. The cells highlighted in yellow contain the values that are needed in the derivation, and the blue column and row represent the constraints involved. These values and constraints are sufficient to derive that the green cell should contain the digit&amp;hellip; 7!&lt;/p>
&lt;p>We stated above that the Sudoku Assistant always provides the &lt;em>easiest&lt;/em> possible explanation step. We achieve this by using a cost function that expresses an explanation step&amp;rsquo;s difficulty, namely the number of constraints involved in it. This reflects the intuition that explanation steps involving many constraints are more difficult to understand than steps with less constraints.&lt;/p>
&lt;p>Of course, the &amp;lsquo;real&amp;rsquo; cost function that captures the actual difficulty of an explanation step from the perspective of a human is likely much more complex and nuanced, and probably domain dependent. The development of a cost function that better reflects this human perspective is definitely a promising direction for future work.&lt;/p>
&lt;h2 id="a-broader-perspective">A broader perspective&lt;/h2>
&lt;p>The approaches detailed in this article are by no means limited to Sudoku. The integrated approach is applicable to any problem consisting of a classification step followed by a constraint programming step. This means that it can easily be used on the many variants of Sudoku, or other puzzle games like
&lt;a href="https://en.wikipedia.org/wiki/Numberlink" target="_blank" rel="noopener">Numberlink&lt;/a>,
&lt;a href="https://en.wikipedia.org/wiki/Kakuro" target="_blank" rel="noopener">Kakuro&lt;/a> and
&lt;a href="https://en.wikipedia.org/wiki/Hidato" target="_blank" rel="noopener">Hidato&lt;/a>.&lt;/p>
&lt;p>There are also a range of real-world problems that require the scanning and interpreting of documents, where the required structure of the document is known (e.g., tax forms) or where the information provided has to be verified or completed (e.g., subsidy request forms). Even archaeological reconstruction of pieces into statues or paintings
&lt;a href="https://arxiv.org/abs/2005.12548" target="_blank" rel="noopener">requires perception and reasoning&lt;/a>. Just like in the Sudoku setting, knowledge of the requirements and constraints can be used to (re)construct the desired input, even when the machine learning models used for scanning make mistakes.&lt;/p>
&lt;p>Also our approach to step-wise explanations can easily be used on other constraint satisfaction problems, such as other logic puzzles and real-world problems like scheduling, timetabling and routing problems. For example, a company may need to find a schedule ensuring that each employee works a certain number of hours per week, that no two employees are scheduled to do the same job at the same time, and that all shifts are covered. The ability to generate a step-wise explanation of such a schedule can help employees understand why they have to work in certain shifts, and can help increase overall trust in the scheduling system.&lt;/p>
&lt;div class="card relpub">
&lt;div class="card-body">
&lt;small>
&lt;p>The Sudoku Assistant was built using our Python-based
&lt;a href="https://github.com/CPMpy/cpmpy" target="_blank" rel="noopener">CPMpy Constraint Programming and Modeling library&lt;/a>. We started building this library 2 years ago to facilitate the integration of constraint solving and machine learning, and to ease the development of explanation algorithms and other algorithms that involve repeatedly calling constraint solvers. The library, and the Sudoku Assistant, are part of Professor Tias Guns&amp;rsquo; prestigious 5-year ERC funded project on
&lt;a href="https://people.cs.kuleuven.be/~tias.guns/chat-opt.html" target="_blank" rel="noopener">Conversational Human-Aware Technologies for Optimisation&lt;/a>.&lt;/p>
&lt;p>The assistant is based on the following publications:&lt;/p>
&lt;ul>
&lt;li>
&lt;a href="https://link.springer.com/chapter/10.1007/978-3-030-58942-4_24" target="_blank" rel="noopener">Hybrid classification and reasoning for image-based constraint solving&lt;/a>. Maxime Mulamba, Jayanta Mandi, Rocsildes Canoy, and Tias Guns, In International Conference on Integration of Constraint Programming, Artificial Intelligence, and Operations Research, pages 364–380. Springer, 2020.&lt;/li>
&lt;li>
&lt;a href="https://www.ijcai.org/proceedings/2021/0191.pdf" target="_blank" rel="noopener">Efficiently Explaining CSPs with Unsatisfiable Subset Optimization&lt;/a> Emilio Gamba, Bart Bogaerts, and Tias Guns. In International Joint Conference on Artificial Intelligence, 1381-1388, 2021.&lt;/li>
&lt;/ul>
&lt;/small>
&lt;/div>
&lt;/div>
&lt;h2 id="system-overview">System Overview&lt;/h2>
&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
&lt;iframe src="https://www.youtube.com/embed/aTTjLSrG-l4" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" allowfullscreen title="Sudoku Assistant">&lt;/iframe>
&lt;/div>
&lt;h2 id="try-it-for-yourself">Try it for yourself&lt;/h2>
&lt;div class="play-badge">
You can download the Sudoku Assistant on an Android smartphone or tablet by following the link below.
&lt;a href="https://play.google.com/store/apps/details?id=be.kuleuven.cs.visualsudoku">
&lt;img src="img/google_play_badge.png" width="200px">
&lt;/a>
&lt;/div></description></item><item><title>The Role of Counting in Probabilistic Reasoning</title><link>https://dtai.cs.kuleuven.be/stories/post/vincent-derkinderen/role-of-counting-in-probabilistic-reasoning/</link><pubDate>Sun, 17 Sep 2023 15:31:04 +0200</pubDate><guid>https://dtai.cs.kuleuven.be/stories/post/vincent-derkinderen/role-of-counting-in-probabilistic-reasoning/</guid><description>&lt;p>Will it rain today given that we see clouds? You likely know how to count apples or coins, but how do you count over the &lt;em>possible worlds&lt;/em> where it is cloudy and raining?
That is exactly the task of &lt;strong>model counting&lt;/strong>, which forms a simple but powerful approach to reason over uncertain outcomes and compute probabilities such as whether it will rain.&lt;/p>
&lt;p>In this post we provide the intuition to understand the fascinating world of model counting: what is it, why is it so important (state-of-the-art probabilistic reasoning algorithms!), and what is the relation with &lt;em>knowledge compilation&lt;/em>.&lt;/p>
&lt;h1 id="what-is-model-counting">What is model counting?&lt;/h1>
&lt;p>Consider the following example: there are two variables $A$ and $B$, that are both Boolean (meaning, they can be either true or false). As a consequence, there are four possible truth assignments, listed below.&lt;/p>
&lt;ol>
&lt;li>A is true, B is true&lt;/li>
&lt;li>A is true, B is false&lt;/li>
&lt;li>A is false, B is true.&lt;/li>
&lt;li>A is false, B is false.&lt;/li>
&lt;/ol>
&lt;p>How many of these assignments satisfy the constraint &amp;ldquo;A is true or B is true&amp;rdquo;? This is a model counting question, and the answer is three.&lt;/p>
&lt;p>More formally, model counting is a computational problem where we are given a set of constraints and need to determine the number of assignments satisfying those constraints.
Typically, the constraints are defined using logic formulas. For example, $A \lor (\neg A \land B)$ means that &amp;ldquo;A is true, or A is false and B is true&amp;rdquo;. In logic, when an assignment satisfies the constraints we call it a model, hence the name model counting.&lt;/p>
&lt;p>&lt;strong>Example&lt;/strong>
Let us consider a larger example with the following constraints:&lt;/p>
&lt;ul>
&lt;li>It rains if and only if it is cloudy and humid.&lt;/li>
&lt;li>You get wet if and only if it rains or the sprinklers are on.&lt;/li>
&lt;/ul>
&lt;p>This can be encoded into a logic formula
$ (rain \iff cloudy \land humid) \land (wet \iff rain \lor sprinkler)$&lt;/p>
&lt;p>The model count of this example is $2^3$. We list the models in the image below; we will call these &amp;lsquo;&lt;em>possible worlds&lt;/em>&amp;rsquo;.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/vincent-derkinderen/role-of-counting-in-probabilistic-reasoning/models1_hu946aaf7837ff352732d3e331d8a61a03_28969_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/vincent-derkinderen/role-of-counting-in-probabilistic-reasoning/models1_hu946aaf7837ff352732d3e331d8a61a03_28969_2000x2000_fit_lanczos_3.png" class="lazyload" alt="A list of models of the given example." width="400px" height="340">
&lt;/a>
&lt;/figure>
&lt;p>Suppose that we wish to only count those models where $wet$ (the last column) is true, that is, we extend the logic formula with $\land wet$. The total model count is then 5.&lt;/p>
&lt;p>Note that model counting is a direct extension of the well known &lt;em>satisfiability problem&lt;/em>, which is merely concerned with determining whether there exists at least one satisfying assignment, as opposed to determining the exact count (cf. the
&lt;a href="https://www.cril.univ-artois.fr/~roussel/satgame/satgame.php?lang=eng" target="_blank" rel="noopener">SAT Game&lt;/a>).&lt;/p>
&lt;h1 id="why-do-we-care-probabilistic-reasoning">Why do we care? Probabilistic reasoning!&lt;/h1>
&lt;p>Suppose furthermore that each of the possible worlds (models) in the previous example have a probability. By counting only those where $wet$ is true, we are then essentially computing the probability that $wet$ is true. That is, model counting can be used to perform probabilistic reasoning!&lt;/p>
&lt;p>While the above example uses probabilities, a weighted model counting problem supports any numerical weight. Usually, rather than directly defining a weight for each model, we instead use a weight function $w$ that defines a weight for when a variable is true, and for when it is false. The weight of a model $m$ is then obtained by multiplying the relevant weights: $\prod_{l\in m} w(l)$.&lt;/p>
&lt;p>&lt;strong>Example&lt;/strong>
Consider the previous example. We could associate a probability with $cloudy$, $humid$ and $sprinkler$. For instance:&lt;/p>
&lt;ul>
&lt;li>$w(cloudy) = 0.1$, $w(humid) = 0.2$, $w(sprinkler) = 0.3$,&lt;/li>
&lt;li>$w(\neg cloudy) = 0.9$, $w(\neg humid) = 0.8$, $w(\neg sprinkler) = 0.7$&lt;/li>
&lt;/ul>
&lt;p>Since the truth values of $wet$ and $rain$ are completely defined by the other three variables, we set their weights to $1.0$:&lt;/p>
&lt;ul>
&lt;li>$w(rain) = 1.0$, $w(wet) = 1.0$,&lt;/li>
&lt;li>$w(\neg rain) = 1.0$, $w(\neg rain) = 1.0$&lt;/li>
&lt;/ul>
&lt;p>In this way, the total weight of a model is exactly the probability of the possible world that it represents. This is illustrated in the figure below, where the probability of the possible world is $0.024$. Since $humid$ is false in the possible world, the equation uses $w(\neg humid) = 0.8$.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/vincent-derkinderen/role-of-counting-in-probabilistic-reasoning/weighted_model_hu647d58c2f447df358c313de2f59329be_18342_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/vincent-derkinderen/role-of-counting-in-probabilistic-reasoning/weighted_model_hu647d58c2f447df358c313de2f59329be_18342_2000x2000_fit_lanczos_3.png" class="lazyload" alt="An example of a weighted model." width="400px" height="180">
&lt;/a>
&lt;/figure>
&lt;p>&lt;strong>Weighted model counting&lt;/strong>
More formally, the weighted model count (WMC) of logic formula $T$ with weight function $w$ is defined as the equation below, where $M(T)$ denotes the set of models of $T$ (that is, the possible worlds).&lt;/p>
&lt;p>$WMC(T) = \sum_{m \in M(T)} \prod_{l \in m} w(l)$&lt;/p>
&lt;p>In this equation, we compute the weight for each model $m$ (the product operation), and sum the results to obtain the weighted model count.&lt;/p>
&lt;p>&lt;strong>Example&lt;/strong>
Continuing the previous larger example with the aforementioned weights, the total weighted model count is $1.0$ (try it yourself!). If we additionally add $\land wet$, that is, consider only those models where $wet$ is true, then the weighted model count becomes $0.314$, exactly the probability that $wet$ is true (try it yourself!).&lt;/p>
&lt;p>We can also compute conditional probabilities. For example, imagine that we observe the sprinkler to be off and want to know the probability that we get $wet$. Using probability theory, this is computable via two weighted model counts:&lt;/p>
&lt;p>$Prob(wet | \neg sprinkler) = Prob(wet \land \neg sprinkler) / Prob(\neg sprinkler)$
$Prob(wet | \neg sprinkler) = WMC(T \land \neg sprinkler \land wet) / WMC(T \land \neg sprinkler)$&lt;/p>
&lt;h1 id="efficient-counting-via-knowledge-compilation">Efficient counting via knowledge compilation&lt;/h1>
&lt;p>Variables are true or false, so in the worst case there are $2^N$ models with $N$ the number of variables. Since this is exponential, naively counting models one by one quickly becomes infeasible as the number of variables increases. Fortunately we can often do much better in practice!&lt;/p>
&lt;p>&lt;strong>Example&lt;/strong>
Consider computing the weighted model count of the previous example while including $\land wet$. Naively iterating over the 5 models and computing the weighted model count involves 20 multiplications and 4 additions. In the image below we show how to perform the same count but with fewer operations (8 multiplications and 4 additions) by exploiting distributivity, commutativity and associativity.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/vincent-derkinderen/role-of-counting-in-probabilistic-reasoning/featured_huc14810198f481a5d7772972f597b348a_157944_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/vincent-derkinderen/role-of-counting-in-probabilistic-reasoning/featured_huc14810198f481a5d7772972f597b348a_157944_2000x2000_fit_lanczos_3.png" class="lazyload" alt="An example of a weighted model." width="400" height="1000">
&lt;/a>
&lt;/figure>
&lt;p>In the domain of knowledge compilation, researchers have produced algorithms that can automatically create such compact representations from a given logical formula, in a way that allows us to easily compute the weighted model count.&lt;/p>
&lt;h1 id="conclusion">Conclusion&lt;/h1>
&lt;p>In conclusion: we first explained what model counting is, namely, counting in a weighted fashion the number of assignments satisfying a given logical formula. We then hinted to the importance of this computational task by providing an intuition on how it models probabilistic inference problems and thereby contributes to state-of-the-art probabilistic reasoning algorithms. Finally, we mentioned knowledge compilation, a research domain that helps to solve counting tasks more efficiently by restructuring the logical formula.&lt;/p>
&lt;p>If you wish to learn more about how to use model counting for state-of-the-art probabilistic reasoning, we kindly refer to&lt;/p>
&lt;ul>
&lt;li>
&lt;a href="https://doi.org/10.1016/j.artint.2007.11.002" target="_blank" rel="noopener">On probabilistic inference by weighted model counting&lt;/a>. M. Chavira, A. Darwiche. Artificial Intelligence, 2008.&lt;/li>
&lt;/ul>
&lt;p>If you instead wish to learn more about how to automatically count models, check out our conference paper that improves the model counting process by exploiting structural symmetries!&lt;/p>
&lt;ul>
&lt;li>
&lt;a href="https://ojs.aaai.org/index.php/AAAI/article/view/16511/16318" target="_blank" rel="noopener">Symmetric Component Caching for Model Counting on Combinatorial Instances&lt;/a>. T. van Bremen, V. Derkinderen, S. Sharma, S. Roy, and K. S. Meel. AAAI, 2021.&lt;/li>
&lt;/ul>
&lt;p>We acknowledge the authors of the used icons:&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://www.flaticon.com/free-icons/humidity" title="humidity icons">Humidity icons created by justicon - Flaticon&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.flaticon.com/free-icons/rain" title="rain icons">Rain icons created by tulpahn - Flaticon&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.flaticon.com/free-icons/wet" title="wet icons">Wet icons created by Smashicons - Flaticon&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.flaticon.com/free-icons/sprinkler" title="sprinkler icons">Sprinkler icons created by Eucalyp - Flaticon&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.flaticon.com/free-icons/cloud" title="cloud icons">Cloud icons created by Freepik - Flaticon&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.flaticon.com/free-icons/summer" title="summer icons">Summer icons created by Freepik - Flaticon&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Lifted Reasoning for Combinatorial Counting</title><link>https://dtai.cs.kuleuven.be/stories/post/pietro-totis/jair/</link><pubDate>Fri, 13 Jan 2023 09:35:35 +0100</pubDate><guid>https://dtai.cs.kuleuven.be/stories/post/pietro-totis/jair/</guid><description>
&lt;div class="card relpub">
&lt;div class="card-body">
&lt;small>
&lt;p>This post is based on the following publications:&lt;/p>
&lt;ul>
&lt;li>
&lt;a href="https://jair.org/index.php/jair/article/view/14062" target="_blank" rel="noopener">Lifted Reasoning for Combinatorial Counting&lt;/a>. P.Totis, J.Davis, L.De Raedt, A.Kimmig, Lifted Reasoning for Combinatorial Counting, Journal of Artificial Intelligence Research, 2023.&lt;/li>
&lt;/ul>
&lt;p>Software is available in the following toolboxes:
&lt;a href="https://github.com/PietroTotis/CoSo" target="_blank" rel="noopener">github&lt;/a>&lt;/p>
&lt;/small>
&lt;/div>
&lt;/div>
&lt;h2 id="problem-combinatorics-math-word-problems">Problem: combinatorics math word problems&lt;/h2>
&lt;p>Combinatorics math word problems sketch in natural language a configuration of a finite set of objects and (possibly) some constraints. The task is to &lt;em>count&lt;/em> the number of valid arrangements for the objects. For example:&lt;/p>
&lt;blockquote>
&lt;p>In how many different ways can the letters in B A N A N A be written?&lt;/p>
&lt;/blockquote>
&lt;blockquote>
&lt;p>Fourteen construction workers are to be assigned to three different tasks. Seven workers are needed for mixing cement, five for laying bricks,and two for carrying the bricks to the brick layers. In how many different ways can the be assigned to these workers tasks?&lt;/p>
&lt;/blockquote>
&lt;blockquote>
&lt;p>A shipment of 12 different TVs contains 3 defective ones. In how many ways can a hotel purchase 5 of these TVs and receive at least 2 of the defective ones?&lt;/p>
&lt;/blockquote>
&lt;p>Such problems present two challenges for AI:&lt;/p>
&lt;ol>
&lt;li>&lt;em>NLP&lt;/em> - Understanding setting, objects, quantities, and the question provided in natural language.&lt;/li>
&lt;li>&lt;em>Automated reasoning&lt;/em> - Finding a solving strategy to answer the question from the given information.&lt;/li>
&lt;/ol>
&lt;p>In this paper we consider a &lt;em>two-step approach&lt;/em> to solving combinatorics math word problems.
The two-step approach addresses the two AI challenges in two stages:&lt;/p>
&lt;ol>
&lt;li>translating the problem expressed in natural language in a formal, machine-understandable language,&lt;/li>
&lt;li>applying automated reasoning methods (solver) to the formalization of the problem to infer the solution.&lt;/li>
&lt;/ol>
&lt;p>&lt;img src="twostep.svg" alt="Two steps">&lt;/p>
&lt;p>This approach showed more promising results on similar tasks than an &lt;em>end-to-end&lt;/em> approach, where a neural network predicts the answer directly from the text. This however showed several limitations:&lt;/p>
&lt;ul>
&lt;li>Poor solving performance (esp. on a small dataset)&lt;sup id="fnref:1">&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref">1&lt;/a>&lt;/sup>&lt;/li>
&lt;li>Lacking generalizability &lt;sup id="fnref:2">&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref">2&lt;/a>&lt;/sup>&lt;/li>
&lt;li>Lacking explainability &lt;sup id="fnref:3">&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref">3&lt;/a>&lt;/sup>&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="onestep.svg" alt="One step">&lt;/p>
&lt;p>In the two-step approach the intermediate language simplifies the task of the neural network by moving the automated reasoning challenge to a logic-based framework, which offers considerably more generalizability and explainability opportunities.
The challenge in a two-step approach is to have an intermediate formal language as expressive as possible, and at the same time to develop (efficient) inference methods for all possible problems expressible in the formal language.
Current declarative frameworks either offer languages that are not expressive enough for the class of problems at hand or inference methods that are very inefficient.&lt;/p>
&lt;p>We address these limitations with the following contributions:&lt;/p>
&lt;ol>
&lt;li>CoLa - a formal language to encode combinatorics math word problems,&lt;/li>
&lt;li>CoSo - a solver to automatically (and efficiently) reason over and solve problems expressed in CoLa.&lt;/li>
&lt;/ol>
&lt;h2 id="cola-modelling-combinatorics-math-word-problems">CoLa: modelling combinatorics math word problems&lt;/h2>
&lt;p>CoLa is a novel declarative language designed to model combinatorics math word problems, for which we also developed efficient reasoning techniques (implemented in the solver CoSo).
Existing declarative language, such as logic-based languages (Answer Set Programming, Prolog,&amp;hellip;) and constraint modelling languages, do not directly support all of the fundamental primitives to encode combinatorics math word problems. The three primitives necessary to formally encode combinatorics math problems are the following.&lt;/p>
&lt;h3 id="multisets">Multisets&lt;/h3>
&lt;p>Multisets are collections of objects where any object can have a number of identical copies. For example, the letters in B A N A N A are a multiset where A B and N are the distinguishable objects, and there are 3 identical copies of A and 2 of N.
&lt;img src="mset.svg" alt="Multiply" width="300"/>&lt;/p>
&lt;p>In CoLa multisets, in particular the &lt;em>universe&lt;/em>, can be declared by enumeration, repeating the labels of identical copies, or by specifying the property characterizing the copies and their number (with a &lt;em>size constraint&lt;/em>):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-plaintext" data-lang="plaintext">&lt;span class="line">&lt;span class="cl">universe letters = {a,a,a,n,n,b} % enumeration
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-plaintext" data-lang="plaintext">&lt;span class="line">&lt;span class="cl">property a; % distinguishable properties
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">property n;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">property b;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">#a=3; #n=2; #b=1; % identical copies
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The keyword &lt;code>labelled&lt;/code> can be used to specify a regular set where all elements are unique&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-plaintext" data-lang="plaintext">&lt;span class="line">&lt;span class="cl">labelled property workers;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">#workers = 14;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-plaintext" data-lang="plaintext">&lt;span class="line">&lt;span class="cl">labelled property tvs;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">#tvs = 12;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">labelled property defective;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">#defective = 3;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="configurations">Configurations&lt;/h3>
&lt;p>Configurations define how objects are arranged:&lt;/p>
&lt;ul>
&lt;li>Objects are &lt;em>ordered/unordered&lt;/em> (e.g. sets vs. permutations)&lt;/li>
&lt;li>Objects are placed &lt;em>with or without repetition&lt;/em> (e.g. multisets vs. sets)&lt;/li>
&lt;li>Objects are arranged in a &lt;em>single or multiple groups&lt;/em> (e.g. sets vs. partitions)&lt;/li>
&lt;/ul>
&lt;p>CoLa offers several statements to express the most common configurations, based on the
&lt;a href="https://en.wikipedia.org/wiki/Twelvefold_way" target="_blank" rel="noopener">Twelvefold-way&lt;/a>&lt;sup id="fnref:4">&lt;a href="#fn:4" class="footnote-ref" role="doc-noteref">4&lt;/a>&lt;/sup>.
These configurations are fundamental because they can be counted quickly with combinatorial rules, such as factorials or binomial coefficients.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-plaintext" data-lang="plaintext">&lt;span class="line">&lt;span class="cl">word in [letters] % a permutation of letters: a word
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;img src="word.svg" alt="Permutation" width="500"/>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-plaintext" data-lang="plaintext">&lt;span class="line">&lt;span class="cl">groups in [{workers}]; % a composition of workers: an ordered partition
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;img src="partition.svg" alt="Partition" width="300"/>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-plaintext" data-lang="plaintext">&lt;span class="line">&lt;span class="cl">purchase in {tvs}; % a subset of TVs
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;img src="truck.svg" alt="Subset" width="300"/>
&lt;h3 id="constraints">Constraints&lt;/h3>
&lt;p>Constraints define restrictions on how objects are arranged in the configuration. While natural language can express virtually any kind of constraint, in CoLa we restrict to few constraints that are interesting in terms of efficient resolution of combinatorics math word problems:&lt;/p>
&lt;ul>
&lt;li>
&lt;p>&lt;em>Size constraints&lt;/em> - define the size of configurations, properties and multisets.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-plaintext" data-lang="plaintext">&lt;span class="line">&lt;span class="cl">#groups=3; % specify the number of groups of workers
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-plaintext" data-lang="plaintext">&lt;span class="line">&lt;span class="cl">#tvs&amp;amp;defective = 3; % specify the number of tvs that are defective
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">#purchase = 5; % specify the number of purchased TVs
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>&lt;em>Positional constraints&lt;/em> - define the properties of objects in specific positions in an ordered configuration.
&lt;img src="size.svg" alt="Size constraint" width="300"/>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-plaintext" data-lang="plaintext">&lt;span class="line">&lt;span class="cl">#groups[1] = 7; % size constraints on the index of the groups of workers
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">#groups[2] = 5;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">#groups[3] = 2;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>&lt;em>Counting constraints&lt;/em> - define the number of objects in a configuration or subset with the given property.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-plaintext" data-lang="plaintext">&lt;span class="line">&lt;span class="cl">#(defective &amp;amp; purchase) &amp;gt;= 2;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ul>
&lt;img src="counting.svg" alt="Counting constraint" width="300"/>
&lt;h2 id="coso-reasoning-over-combinatorics-math-word-problems">CoSo: Reasoning over Combinatorics Math Word Problems&lt;/h2>
&lt;p>CoSo implements lifted reasoning techniques for combinatorics math word problems. Lifted reasoning exploits high-level symmetries and the interchangeability of objects to efficiently count the number of admissible assignments for a set of variables.
In this paper we implement the principles of &lt;em>probabilistic&lt;/em> lifted reasoning&lt;sup id="fnref:5">&lt;a href="#fn:5" class="footnote-ref" role="doc-noteref">5&lt;/a>&lt;/sup> in the context of &lt;em>counting constraint satisfaction problems&lt;/em> (#CSPs).&lt;/p>
&lt;p>Existing declarative frameworks usually resort to &lt;em>propositional&lt;/em> reasoning, that is, enumeration of the solutions or grounding, namely replacing each variable with all possible individual objects in its domain. Therefore, they can be very inefficient on combinatorics math word problems, where the number of solutions is usually exponential in the number of objects.&lt;/p>
&lt;p>CoSo can solve these problems efficiently by applying the following lifted reasoning principles:&lt;/p>
&lt;ol>
&lt;li>Multiplication - multiply the solution of two &lt;em>independent&lt;/em> subproblems to lift the count of their combinations.
&lt;img src="mul.svg" alt="Multiply" width="300"/>&lt;/li>
&lt;li>Splitting - decompose a problem into subproblems such that the multiplication principle is applicable.
&lt;img src="split.svg" alt="Split" width="200"/>&lt;/li>
&lt;li>Propositionalization - reason on individual objects when it is not possible to group them.
&lt;img src="prop.svg" alt="Propositionalization" width="300"/>&lt;/li>
&lt;li>Exchangeability - account for any invariance under permutation of the variables.
&lt;img src="exch.svg" alt="Exchangeability" width="300"/>&lt;/li>
&lt;/ol>
&lt;p>CoSo applies these principles to decompose a problem in subproblems where the common combinatorial counting rules for the base configurations are applicable.&lt;/p>
&lt;p>With experiments on a real-world dataset and synthetic benchmarks we show that the implementation of these principles can significantly speed-up the computation of the solution of combinatorics math world problems compared to traditional declarative frameworks.&lt;/p>
&lt;div class="footnotes" role="doc-endnotes">
&lt;hr>
&lt;ol>
&lt;li id="fn:1">
&lt;p>
&lt;a href="https://aclanthology.org/2021.emnlp-main.294/" target="_blank" rel="noopener">S.Suster, P.Fivez, P.Totis, A.Kimmig, J.Davis, L. de Raedt, W.Daelemans, &amp;ldquo;Mapping probability word problems to executable representations&amp;rdquo; EMNLP 2021&lt;/a>&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;li id="fn:2">
&lt;p>
&lt;a href="https://aclanthology.org/2021.naacl-main.168/" target="_blank" rel="noopener">A.Patel, S.Bhattamishra, and N.Goyal, &amp;ldquo;Are NLP Models really able to Solve Simple Math Word Problems?&amp;rdquo;, NAACL 2021&lt;/a>&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;li id="fn:3">
&lt;p>
&lt;a href="https://openreview.net/pdf?id=H1gR5iR5FX" target="_blank" rel="noopener">D.Saxton E. Grefenstette F. Hill P. Kohli, &amp;ldquo;Analysing Mathematical Reasoning Abilities of Neural Models&amp;rdquo;, ICLR 2019&lt;/a>&amp;#160;&lt;a href="#fnref:3" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;li id="fn:4">
&lt;p>
&lt;a href="https://math.mit.edu/~rstan/ec/" target="_blank" rel="noopener">R.Stanley, &amp;ldquo;Enumerative combinatorics&amp;rdquo;, 2012, Cambridge University Press, New York.&lt;/a>&amp;#160;&lt;a href="#fnref:4" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;li id="fn:5">
&lt;p>
&lt;a href="https://mitpress.mit.edu/9780262542593/an-introduction-to-lifted-probabilistic-inference/" target="_blank" rel="noopener">G. Van den Broeck, K. Kersting, and S. Natarajan, &amp;ldquo;An Introduction to
Lifted Probabilistic Inference&amp;rdquo;, 2021, The MIT Press.&lt;/a>&amp;#160;&lt;a href="#fnref:5" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;/ol>
&lt;/div></description></item><item><title>Automated Reasoning and Learning for Automated Payroll Management</title><link>https://dtai.cs.kuleuven.be/stories/post/sebastijan-dumancic/automated-payroll-management/</link><pubDate>Wed, 13 Jan 2021 21:26:06 +0100</pubDate><guid>https://dtai.cs.kuleuven.be/stories/post/sebastijan-dumancic/automated-payroll-management/</guid><description>
&lt;div class="card relpub">
&lt;div class="card-body">
&lt;small>
&lt;p>This post is based on the following publication:&lt;/p>
&lt;ul>
&lt;li>
&lt;a href="https://limo.libis.be/primo-explore/fulldisplay?docid=LIRIAS3418530&amp;amp;context=L&amp;amp;vid=Lirias&amp;amp;search_scope=Lirias&amp;amp;tab=default_tab&amp;amp;lang=en_US" target="_blank" rel="noopener">Automated Reasoning and Learning for Automated Payroll Management&lt;/a>, S. Dumancic, W. Meert, S. Goethals, T. Stuyckens, J. Huygen, K. Denies, IAAI 2021 (IAAI-21 Deployed Application Award).&lt;/li>
&lt;li>
&lt;a href="https://www.tealpartners.com/nl/blog/viren/viren-wannes-meert-kuleuven/" target="_blank" rel="noopener">VIREN - Interview met Wannes Meert van KU Leuven&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>It is part of the VLAIO O&amp;amp;O innovation project “Platform for complex computations”.&lt;/p>
&lt;/small>
&lt;/div>
&lt;/div>
&lt;p>While payroll management is a crucial aspect of any business venture, anticipating the future ﬁnancial impact of changes to the payroll policy is a challenging task due to the complexity of tax legislation. The goal of this work is to automatically explore potential payroll policies and ﬁnd the optimal set of policies that satisﬁes the user’s needs. To achieve this goal, we overcome two major challenges. First, we translate the tax legislative knowledge into a formal representation ﬂexible enough to support a variety of scenarios in payroll calculations. Second, the legal knowledge is further compiled into a set of constraints from which a constraint solver can ﬁnd the optimal policy. Furthermore, payroll computation is performed on an individual basis which might be expensive for companies with a large number of employees. To make the optimisation more efﬁcient, we integrate it with a machine learning model that learns from the previous optimisation runs and speeds up the optimisation engine. The results of this work have been deployed by a social insurance fund.&lt;/p>
&lt;p>This project was executed in collaboration with
&lt;a href="https://www.tealpartners.com" target="_blank" rel="noopener">Teal Partners&lt;/a>.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/sebastijan-dumancic/automated-payroll-management/ui_hudbab485c27bf5f6715f8da0130283969_284323_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/sebastijan-dumancic/automated-payroll-management/ui_hudbab485c27bf5f6715f8da0130283969_284323_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Viren user interface" width="400px" height="696">
&lt;/a>
&lt;/figure>
&lt;h2 id="approach">Approach&lt;/h2>
&lt;h3 id="financial-modelling-language-fml">Financial Modelling Language (FML)&lt;/h3>
&lt;p>The first step is translating the legal knowledge into a formal representation ﬂexible enough to support and simulate a variety of scenarios.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/sebastijan-dumancic/automated-payroll-management/fml_hu2b93ba6739f56d3145e4779c517ea03b_60357_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/sebastijan-dumancic/automated-payroll-management/fml_hu2b93ba6739f56d3145e4779c517ea03b_60357_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Example of the Financial Modeling Language" width="600px" height="178">
&lt;/a>
&lt;/figure>
&lt;h3 id="problem">Problem&lt;/h3>
&lt;ul>
&lt;li>Given: Computational rules&lt;/li>
&lt;li>What: Optimise a target quantity while respecting the rules and given a number of open variables&lt;/li>
&lt;li>Why: Reuse existing knowledge base to oﬀer new services&lt;/li>
&lt;li>How: Decoupling procedural knowledge and the knowledge in the rules&lt;/li>
&lt;/ul>
&lt;h3 id="technique-smt">Technique: SMT&lt;/h3>
&lt;p>We will use techniques from constraint satisfaction, a declarative framework for modelling problems without the need to provide the steps towards the solution.
Different paradigms exist: (1) Boolean satisfiability, (2) Constraint programming (CP), and (3) Satisfiability modulo theory (SMT).&lt;/p>
&lt;p>To solve financial models, we use SMT. However, a problem is that typically there are no multiple multiplications between variables. Most common solvers are designed for Linear programming, Integer Linear Programming, or mixed-integer programming. All of these assume linear constraints.&lt;/p>
&lt;p>The computation rules generated for our financial models contain structures like:&lt;/p>
&lt;pre tabindex="0">&lt;code>constraint Var1 = (Var2 * 23) div 100;
constraint Var3 = Var1 * Var4;
&lt;/code>&lt;/pre>&lt;p>This is a non-linear computation that is diffcult to optimise in theory. However, there are lots of solvable problems in practice. One reason to choose SMT over CP is that CP-tools like MiniZinc need to linearize approximately and derive new bounds. We found only the solver SCIP with support for nonlinear constraints but it fails to propagate the boundaries because our financial models have too many nonlinear interactions.&lt;/p>
&lt;p>A SMT-solver like Z3 has a dedicated solver for non-linear constraints and can deal with our models. Additionally, Z3 has native support for real numbers and has support for many programming structures because of its applications in program verification.&lt;/p>
&lt;h3 id="optimisation">Optimisation&lt;/h3>
&lt;p>One of the goals of financial modeling is to optimize a number of parameters to minimize or maximize a certain value (e.g. reduce taxes). We support:&lt;/p>
&lt;ul>
&lt;li>Maximization, for example: $maximize\ income$&lt;/li>
&lt;li>Minimization, for example: $minimize\ cost$&lt;/li>
&lt;li>Reach target, for example: $minimize |value_{desired} - value_{possible}|$&lt;/li>
&lt;/ul>
&lt;p>Unfortunately, there is no support for optimising a target value. But for the financial models use here, we foresee a custom method that is based on binary search and takes into account the difference between SAT and UNSAT.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/sebastijan-dumancic/automated-payroll-management/optimisation_hu731bf83a3a6f283957dc08207f797c84_33041_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/sebastijan-dumancic/automated-payroll-management/optimisation_hu731bf83a3a6f283957dc08207f797c84_33041_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Binary search for optimisation" width="400px" height="335">
&lt;/a>
&lt;/figure>
&lt;p>Often, there is no one best solution to minimize a target value. In such cases we are interested in finding a pareto front that expresses the trade-off between various parameters.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/sebastijan-dumancic/automated-payroll-management/pareto_hucbcd0e831885447c1edad8e8798dc288_30057_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/sebastijan-dumancic/automated-payroll-management/pareto_hucbcd0e831885447c1edad8e8798dc288_30057_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Pareto front" width="400px" height="372">
&lt;/a>
&lt;/figure>
&lt;h3 id="machine-learning">Machine Learning&lt;/h3>
&lt;p>The payroll optimisation task is performed on an individual employee basis. This can be an expensive task for a company of many thousands of employees. To overcome this issue, we can improve the efﬁciency of the optimisation step by using the solutions from previous calculations to provide a better initial point for the optimisation procedure. Though very few employees would share the identical characteristics, many employees would be similar which could give us a good estimate of the range for the optimal target value.&lt;/p>
&lt;p>Remembering the optimal solutions for all previously solved cases is not a feasible strategy. Therefore, we will use machine learning to discover the relationship between the subset of input values of the individuals and the optimal payroll target and use the predicted value as an initial value during optimisation.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://dtai.cs.kuleuven.be/stories/stories/post/sebastijan-dumancic/automated-payroll-management/ml_hu5acce668b71b32d4232763589ab6a148_79433_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://dtai.cs.kuleuven.be/stories/stories/post/sebastijan-dumancic/automated-payroll-management/ml_hu5acce668b71b32d4232763589ab6a148_79433_2000x2000_fit_lanczos_3.png" class="lazyload" alt="Combining machine learning and constraint solving" width="600px" height="222">
&lt;/a>
&lt;/figure></description></item></channel></rss>