Logic-Based Benders Decomposition in Answer Set Programming for Chronic Outpatients Scheduling

In Answer Set Programming (ASP), the user can define declaratively a problem and solve it with efficient solvers; practical applications of ASP are countless and several constraint problems have been successfully solved with ASP. On the other hand, solution time usually grows in a superlinear way (often, exponential) with respect to the size of the instance, which is impractical for large instances. A widely used approach is to split the optimization problem into sub-problems that are solved in sequence, some committing to the values assigned by others, and reconstructing a valid assignment for the whole problem by juxtaposing the solutions of the single sub-problems. On the one hand this approach is much faster, due to the superlinear behavior; on the other hand, it does not provide any guarantee of optimality: committing to the assignment of one sub-problem can rule out the optimal solution from the search space. In other research areas, Logic-Based Benders Decomposition (LBBD) proved effective; in LBBD, the problem is decomposed into a Master Problem (MP) and one or several Sub-Problems (SP). The solution of the MP is passed to the SPs, that can possibly fail. In case of failure, a no-good is returned to the MP, that is solved again with the addition of the new constraint. The solution process is iterated until a valid solution is obtained for all the sub-problems or the MP is proven infeasible. The obtained solution is provably optimal under very mild conditions. In this paper, we apply for the first time LBBD to ASP, exploiting an application in health care as case study. Experimental results show the effectiveness of the approach. We believe that the availability of LBBD can further increase the practical applicability of ASP technologies.


Introduction
Answer Set Programming (ASP) is recently gaining momentum not only in the logic programming area but also in the constraint optimization and Operations Research communities.ASP relies on the Stable Model Semantics (Gelfond and Lifschitz 1988); in an ASP formulation of a combinatorial problem, the solution is encoded in such a way that a stable model (or answer set) of the program corresponds to a solution of the problem.Most ASP solvers divide the solution process into two steps: a grounding phase, in which a ground program having the same stable models of the original program is generated, followed by a solving phase in which the answer sets are computed.The number of applications is impressive, deserving five surveys in a few years (Erdem et al. 2016;Dal Palù et al. 2018;Falkner et al. 2018;Kifer and Liu 2018;Schüller 2018).
However, many problems coming from real-life applications cannot be solved in reasonable time because their solution time is superlinear (often, exponential) with the instance size and the instances are very large.As splitting large problems can simplify them, the ASP literature reports many applications in which a difficult problem is split into two (or more) sub-problems that are then solved in sequence (see (Guido et al. 2020;Cardellini et al. 2021;Caruso et al. 2023;El-Kholany et al. 2022) just to name a few).Such an approach could be described as follows.Consider a problem P , in which a function f (x, y) is maximized subject to a set of conditions C(x, y), C x (x), C y (y), where x and y are two vectors of variables, that range respectively in the domains D x and D y : P : max{f (x, y) | x ∈ D x , y ∈ D y , C x (x), C y (y), C(x, y)}. (1) Suppose that solving P is too computationally demanding.The splitting approach would split P into e.g., two sub-problems P x and P y (we simplify the exposition by considering two sub-problems, although the approach could be extended to more levels and subproblems), in which P x might be responsible of assigning values to x variables, while P y to the y variables.One could then find the optimal assignment x * for P x : x * = arg max and finally provide the pair (x * , y * ) as proposed solution of the whole problem (1).This approach can be considerably faster than solving the whole problem (1), due to the superlinear solving time; on the other hand, it also has a number of issues.First, the optimal solution x * for the first sub-problem might be impossible to extend to the y variables, i.e., there might be no assignment to the y variables such that C(x * , y) is satisfied.In some applications one might be able to split the problem in such a way that for each value of the x variables there always exists an assignment to the y variables (and, indeed, in the aforementioned applications (Guido et al. 2020;Cardellini et al. 2021;Caruso et al. 2023;El-Kholany et al. 2022) the authors were able to find such an intelligent splitting); nevertheless, this limits the applicability of the splitting approach only to some specific applications.Second, even if for x * there exists an assignment y * that satisfies all constraints C(x * , y * ), the pair (x * , y * ) might be not optimal for the global problem P .In general, committing too early to the solution of one subproblem might prevent the optimal solution to be found.This splitting approach could be thought of as a (very clever) greedy algorithm, in which one solves to optimality the first subproblem, greedily commits to it and then solves the second subproblem.
Benders Decomposition is a technique to decompose a problem into subproblems while retaining the ability to obtain the optimal solution and prove its optimality.It was born in the realm of Operations Research, and relies on the duality theory of Linear Programming.It was later extended to approaches that cannot rely on a duality theory in the so-called Logic-Based Benders Decomposition (LBBD) (Hooker and Ottosson 2003).
In LBBD, a Master Problem (MP) is solved first, and provides tentative values that are passed to the sub-problems.Consider the generic problem in Eq (1); the optimal solution x * of the MP is obtained as in Eq. ( 2), and it is provided to the Sub Problem (SP).Now, the sub-problem (Eq.( 3)) is solved using the suggested values x * .Two situations may occur: either the SP is proven infeasible or its optimal solution y * is found.
In case of infeasibility, clearly the assignment x * is not acceptable for the whole problem (1), so a constraint that rules out x * is forwarded from SP to MP.Such a constraint is named a feasibility cut and it is added to the MP formulation.
In case SP is feasible, its optimal solution y * is obtained together with the corresponding value of objective function v * = f (x * , y * ); again a new constraint, called Benders cut, is returned to the MP.Such constraint relates the MP variables x with v * through a function B x * (x), imposing an upper bound on the value of the objective function: How to formulate the function B x * (x) is left to the designer of the LBBD solution process, and it is a challenge, as it can highly influence the efficiency of the decomposition.In order to devise Benders cuts, the idea is that the SP solver proved that v * was optimal for the SP, obtaining a proof of optimality that can be written as (∀y) f (x * , y) ≤ v * ; such a proof of optimality might also be extended to include values of x different from x * .Delving into further details of this fascinating subject would distract us from the main topic of this paper; the interested reader can refer to (Hooker 2019) for an introduction to LBBD and some examples of B x * (x) functions in practical instances.
In both cases (SP feasible / infeasible), a new iteration is started: the MP with the additional constraints is solved again, and the iteration continues until either the MP is proven infeasible (and in such a case the whole problem is infeasible) or the optimal solution is found.In any iteration, the optimal solution of the MP is an upper bound of the whole problem (1): since the MP contains a subset of the constraints of the whole problem P , it is actually one of its relaxations, so its optimal value is optimistic with respect to the real optimum of (1).Again, in each iteration, the pair (x * , y * ), obtained by juxtaposing the optimal solution y * of the SP (3) with the optimal solution x * of the MP, is a valid solution, so its value f (x * , y * ) is a lower bound of the whole problem P .If at any iteration the lower bound is equal to the upper bound, then (x * , y * ) is provably optimal for problem P .A sufficient condition for termination of the iteration is that the bounds (4) are valid and the variables' domains are finite (Hooker and Ottosson 2003).
In various interesting cases, this procedure can be simplified; in particular if the subproblems are feasibility problems, i.e., in Eq. (1) the objective function f does not depend on the y variables, the LBBD algorithm can be described as in Algorithm 1.
Algorithm 1 LBBD scheme in case the sub problem is a feasibility problem.
i ← 0 In the rest of the paper, we will focus on decompositions in which the sub-problems are feasibility problems, i.e., the y variables do not explicitly occur in the objective function.
LBBD can provide strong speedups in particular when there is a hierarchical relation between the solution of the master problem and that of the sub-problems, so that, once the assignment is found for the MP, the SP becomes easy in some sense (it could be a theoretically easy problem -e.g., a problem in P -or a problem that is experimentally found to be relatively easy).Further speedups can be obtained when once a solution for the MP is found, the rest of the problem P consists of independent sub-problems, that can be solved independently (even in parallel).
In this work, we use for the first time LBBD in an ASP-based solving scheme.We show its application on a challenging real-life problem coming from the healthcare domain.
2 Case study (Cappanera et al. 2022), (Cappanera et al. 2023) addressed a scheduling problem involving chronic patients with comorbidities.Many patients suffer from so-called Nontransmissible Chronic Diseases (NCDs), such as diabetes, hypertension, cirrhosis, obesity, and so on.For most NCDs there exist well-assessed medical guidelines involving periodic health services to be delivered at hospital premises -think of dialysis for patients with renal failure.Most patients are not hospitalized but access hospital premises as outpatients; many of them have more than one NCD (comorbidity).Patients are assigned personalized care plans, i.e., Clinical Pathways (CPs), that merge the medical guidelines of all diagnosed NCDs, customized to the specific patient.A CP's health services are known a priori over a mid term horizon, which allows for well in advance planning.Scheduling the health services of a CP means to assign a date, a time and an operator to each service the patient must receive at the hospital.Such process can be challenging because appointment dates must comply as much as possible with the ideal frequency and other time constraints, due to interference (a treatment may alter the result of an exam taken after it) or precedence (a consultancy requires recently taken exams).Finally, if there is not enough availability within the public hospital, a service can be provided by private health services at a higher cost for the National Health Service.The centralized management of the CPs of all patients would optimize the usage of public resources and ensure fairness.This yields a very challenging problem that we call NCD Agenda problem.

Related works
Several healthcare problems have been tackled with ASP (see the review (Alviano et al. 2020)).We recall the most notable contributions highlighting any decomposition.(Caruso et al. 2023) schedule pre-operative exams for outpatients dividing the problem in two steps: first, exam areas are staffed and patients are given an appointment day; second, exams starting times are set, complying with first level decisions, maximizing the served patients and minimizing waiting time.Each phase is executed once, with no feedback; to ensure feasibility in phase two, demand is overestimated in phase one.(Guido et al. 2020) schedule multi appointments for rheumatic outpatients at a Hospital Day Service.Patients are partitioned into three classes with decreasing priority; to reduce computing time the schedule is computed separately for each priority class.(Alviano et al. 2018) address the nurse (re)scheduling problem, improving on the representation of hospital and work balance constraints by (Dodaro and Maratea 2017).Nurse scheduling consists of determining a shift assignment for each nurse for a given planning horizon such that working hours, shift mix, and rest days comply with hospital rules.Rescheduling is due in case of nurse temporary absences, and consists of feasibly scheduling vacant duties, while minimizing deviations from the original schedule.
Appointment scheduling for chemotherapy treatments ( (Dodaro et al. 2021)) must deal with the availability of special equipment, that is assigned to a patient for the whole session.A treatment encompasses up to 4 subsequent steps, some of which are optional, whose duration is patient dependent and known.In case of multiple treatments, a treatment frequency is given.A weekly problem is solved, as well as a rescheduling one.
Rehabilitation sessions for inpatients are scheduled by (Cardellini et al. 2021).Two types of resources are present: gyms and operators.Solution quality criteria and constraints include: continuity of care and preferred time slots on the patient side, and workload balancing and abiding by working rules on the operator side.The daily problem is decomposed into two subsequent decision phases.In the first, the board, patients are assigned to operators; in the second, the agenda, a starting and ending time is set for each session according to the board.As there is no feedback, there is no guarantee that a feasible board-compatible agenda exists.To this aim, potential overlapping are admitted: some sessions are partially turned from one-to-one care to supervision (one operator supervises a few patients at a time).
Finally, ASP has been proved effective in the (re)scheduling of operating rooms (OR).A planned surgery requires a free bed at the specialty ward or at intensive care units, starting from surgery date for the predicted length of stay ( (Dodaro et al. 2022)), and a bed at the post anaesthetic care unit for temporary post-surgery staying ( (Galatà et al. 2021)).Since a surgical team is made of surgeons, anesthesiologists, and nurses, the whole surgery slot must be fully contained into the current working shift of each team member.Based on its specialty, priority, special needs, and expected duration, a request is assigned a day and a time during the OR time blocks reserved to its specialty.
Out of the healthcare domain, (El-Kholany et al. 2022) present a decomposition scheme in ASP for Job Shop Scheduling, driven by a machine learning algorithm.There is no feedback from the SPs to the MP, each sub-problem is solved only once, and thus the resulting algorithm cannot prove optimality of the found solution (it is a heuristic algorithm).The approach is further improved in (El-Kholany et al. 2022).
In conclusion, we observe that ASP proved to be able to capture and easily represent the complex features of several challenging problems.Decomposition schemes are often implemented, motivated by the need for solving large instances in a reasonable time, however they are implemented in such a way that the optimal solution could be overlooked and optimality cannot be guaranteed.To the best of our knowledge, we are the first to propose the use of LBBD in ASP.Out of the ASP area, LBBD has been successfully applied in Integer Linear Programming (Riise et al. 2016) and Constraint Programming frameworks, often as an hybrid algorithm.(Fazel-Zarandi and Beck 2009) use a hybrid CP-MILP approach for facility location, (Benini et al. 2011) for resource allocation for multicore platforms, just to name a few.Recently, in (Zhu et al. 2023) two major problems in manufacturing -usually solved in pipe, to the detriment of optimality -were handled together exploiting LBBD and a clever CP based formulation.A comprehensive survey can be found in (Hooker 2019).LBBD was also applied to a railway timetabling problem using Satisfiability Modulo Theory (Leutwiler and Corman 2022).
Finally, the splitting set theorem (Lifschitz and Turner 1994) provides syntactic conditions under which the stable models of a program can be obtained extending the stable models of one subprogram.LBBD is applied on a different level: the level of modelling an optimization problem and decomposing it into subproblems, even if the splitting set theorem could be exploited to have synergies with LBBD.

NCD Agenda formalization
Let us consider a planning horizon (set of available days) H = {1, . . ., h}, a set of health services S, and a set of patients P = {p 1 , . . ., p N P }.For each patient p, a CP is known, consisting of a set of packets.Each packet π is a set of services to be delivered on the same date, even if they are provided by different care units.
The appointment dates of each CP should satisfy the following CP constraints: Frequency: Often a pathway contains sets of packets corresponding to recurring services; for each packet there is an ideal date (ensuring that the patient is serviced with the correct frequency) and the packet should be scheduled within a tolerance from the ideal date.The tolerance depends on the pathway and it is such that the tolerance windows of consecutive occurrences of the same packet are disjoint.
Interdiction: if s i interdicts service s j for δ days and s i is scheduled in τ (s i ), then τ (s j ), the appointment date of s j , is such that Interdiction constraints are always satisfied if one of the two services is not scheduled.
Necessity: if s i requires s j , an interval [δ min , δ max ] is provided; service s j should be scheduled on day τ (s j ) ∈ [τ (s i ) + δ min , τ (s i ) + δ max ] and cannot be scheduled in the A second class of constraints concerns resource assignment: each service s has a service type and a duration; each scheduled service should be assigned to an operator of the care unit that provides that service type.Each operator at the care unit has a working shift (start and end time, potentially empty) for each day in the horizon.The following daily agendas constraints hold: i) all services provided by an operator should be completed within the operator shift and ii) without overlaps (no patient overlapping), iii) each patient cannot receive two services in parallel (no service overlapping), iv) a service cannot be interrupted and resumed at a later time (no preemption), as well as v) a scheduled service is delivered by a single operator (no split-service).
A feasible schedule assigns an appointment date τ (π) to each scheduled packet π, as well as a time and an operator to the services of π, so that all constraints are satisfied.If a packet is not scheduled, the patient will receive the same services from a private clinic at a higher cost.The objective is to maximize the number of scheduled packets.
For example, in Figure 1 the set of patients is P = {p1, p2}; the pathway of p1 is made of just one packet π 1 which includes two services; the color (red or blue) represents the service type and each service is associated with the care unit of the same color.Care unit 1 (red) has 4 time slots of availability on day 1, 3 slots on day 2, and 2 slots on day 3.Note also the different start times of the operators' shifts: the operator of care unit 1 on day 3 starts earlier than that of care unit 2.

ASP approaches
ASP relies on the Stable Model Semantics (Gelfond and Lifschitz 1988).An ASP program is a set of clauses h:-b 1 , . . ., b n , where h is an atom p(t 1 , . . ., t m ) or a choice {p(t 1 , . . ., t m )} and b i can either be literals of the form [not]p(t 1 , . . ., t k ), possibly followed by a condition : c 1 , . . ., c k , or an aggregate #sum{t 1 , . . ., t m : c 1 , . . ., c k } • n where • is a comparison operator <, =, >=, . . . .A clause without head is called an Integrity Constraint (IC), and its body must evaluate to false in every Stable Model (or Answer Set) of the program.Optimization components can be added by means of weak integrity constraints, with syntax : ∼body; the aim will be to find an answer set that satisfies all ICs while satisfying the maximum number of weak ICs.For the full ASP syntax see (Calimeri et al. 2020).
We recap the ASP formalization of the agenda component of the NCD Agenda (Cappanera et al. 2022) in Sect 5.1, and the scheduling of services within the day in Sect 5.2.The LBBD approach is developed in Section 5.3.

Scheduling services -date assignment
The input data is provided by the following predicates: The ASP program for the scheduling of packets to the available days (Listing 1) follows the classical generate & test methodology.The generation part (lines 1-6) tries to assign a date Day to each Packet within the given tolerance from the ideal date.
As a packet could be not scheduled at all, the number of packets scheduled within the horizon will be maximized by the weak constraint in line 7.The IC in line 9 deals with interdiction constraints: Srv1 and Srv2 are two services for the same patient and the first interdicts the second for Ndays.The IC in line 12 ensures that each necessity constraint is satisfied.Predicate satisfied necessity declares that the necessity must be either satisfied within the horizon, or assumed to be satisfied beyond it, while the previous condition τ (s j ) / ∈ [τ (s i ), τ (s i ) + δ min ) is dealt with by the IC in line 23.

Daily agendas
In the ASP formalization in Section 5.1, services are assigned a date, but daily agendas are not handled, i.e., neither a starting time is given, nor services are assigned to specific operators at the various care units.The program for the daily agendas, reported in Listing 2, uses the following input predicates, in addition to those in Section 5.1:  In the generate part of the daily agenda program (Listing 2), each scheduled service is assigned a start time (line 2) and an operator of the care unit that provides the required service type (line 3), leveraging on the daily assignment defined by predicate sched service (line 5 of Listing 1).
In order to avoid overlapping between services of the same patient (constraint iii of the daily agenda problem) or delivered by the same operator (see ii), we define predicate precedes (line 7), stating that service S1 of patient P1 precedes S2 of P2 if they are scheduled on the same day and S1 terminates before or at the same time as S2 starts.Now if two services S1 and S2 are for the same patient or are provided by the same care unit operator Op in the same Day, one of the two services must precede the other (ICs in lines 11 and 15).Finally, ICs in lines 19 and 23 state that each service should be scheduled within the working shift of the operator who delivers it (constraint i of the daily agenda).

LBB decomposition
The ASP formalization of Sections 5.1 and 5.2 correctly solves the NCD Agenda problem; on the other hand solving such a difficult problem in a monolithic approach does not scale well with the size of the instance.To speedup the solving process while retaining the completeness of the search, we apply LBBD ( (Hooker and Ottosson 2003)).
The NCD Agenda can be cast as in Eq 1 in which the MP (based on the ASP program in Section 5.1) maximizes the number of scheduled packets while assigning a day to each scheduled packet; while a series of SPs (based on the program in Section 5.2), one for each day, assign a time and an operator to each service.Decomposing the program this way provides a strong improvement, since the SPs are independent problems, one per day, and they could even be solved in parallel (although in our experiments we do not exploit such parallelism in order to have a fair comparison with the monolithic approach).On the other hand, some SPs could be infeasible, since the master problem does not contain all constraints of the NCD Agenda.
The MP is an optimization problem, while each SP is a satisfiability problem.In case all SPs are satisfiable, the optimal solution of the MP is also the optimum of the whole NCD Agenda problem.Otherwise, if one of the SPs is infeasible, a no-good is returned to the MP conveying the information that the particular set of health services the MP has assigned to that day cannot be feasibly served.Then, the MP is solved again, with the additional no-good, which avoids looping.Convergence occurs when each SP admits a feasible solution.Such solution is provably optimal.
In particular, the unfeasible SP returns to the MP the set of packets that could not be scheduled on that day, as a set of facts of the form unfe as_su bprobl em ( patient , packet , day , gid ) together with a fact nogood_id(gid), where gid is a unique identifier for the group of packets.A new version of the MP is then generated, appending to the previous code the new facts unfeas_subproblem and nogood_id, and together with the following IC, that avoids generating schedules for the same day including all the packets in the no-good :-schedule(Pat, Pck, Day) : unfeas subproblem(Pat, Pck, Day, Gid); nogood id(Gid). (5)

Example 1
Consider the example in Figure 1, already introduced in Sec 4. The master problem may schedule both patients on day 1, as depicted.In such a case, the SP for day 1 will detect infeasibility and return a no-good to the MP, stating that both packets cannot fit together on that day: unfeas subproblem(p1, pck1, day1, gid1).unfeas subproblem(p2, pck2, day1, gid1).nogood id(gid1).
The MP receives the no-good and, in the following iterations, it will contain the IC in Eq. ( 5), which is grounded into :-schedule(p1, pck1, day1), schedule(p2, pck2, day1).so that, in the following iterations, at most one of the two packets can be assigned to day 1.Since a limited number of options are present, after a certain number of iterations In LBBD, in order to speedup convergence, it is worth strengthening the MP by adding a relaxed version of some of the SPs constraints.In our case, in the MP we avoid any reference to the timing within the day, but we state that, for each day and each care unit, the total duration of the services assigned to that care unit cannot exceed the sum of the shift duration of all the operators of that unit: :-day(D), total time(D, CU, TotTime), #sum{Dur, P, S : sched service(P, S, D), srvType(S, CU, Dur)} > TotTime.Note that predicate total time is grounded into a set of facts by the grounder gringo.
The MP solution may violate the daily agenda constraints: as shown in Example 1, the MP may schedule both packets on day 1 or on day 2.However, with the availabilities depicted in Fig. 1, IC (7) forbids the MP to schedule both packets on day 3, as the red care unit provides only two time units.

Multi-shot solving
The interaction scheme in Section 5.3 can be implemented by a script that iteratively invokes the ASP solver on the MP, on the SPs and adds to the MP code the no-goods generated by the SPs.However, in this way the MP should be solved from scratch at every iteration, losing information about the clauses learnt in the previous iteration.
Recent versions of Clingo (Gebser et al. 2019) allow the customization of ASP solving processes that deal with continuously changing logic programs, called multi-shot solving.
The solving process can be controlled through commands written in Python.It is possible to integrate non-ground input rules into subprograms having a name and a list of parameters, and that are introduced by the #program directive.A dedicated subprogram base gathers all the rules that are not included in a subprogram (Kaminski et al. 2017).By default, Clingo grounds and solves just the base program, but we can add control in Python using a main routine taking as argument a control object representing the state of Clingo.
The parameters pat, pck and day correspond to the arguments of the schedule predicate, and gid identifies a group of schedules that produced an inconsistent SP, as in Eq. ( 5).
The nogood program can be grounded incrementally from a Python script, passing a list L of ground terms; each term contains the 4 parameters of nogood.In the LBBD, the parameters will be the schedules that made unfeasible one of the SPs, provided as a set of ground facts unfeas subproblem.
Algorithm 2 gives the pseudocode that controls the solving process, solving in sequence the MP ("base"), then each SPs with an external call to Clingo for each day.Afterwards, from failing SPs the group of packets scheduled by the MP in the specific day is added as a no-good.This information is added to the MP grounding the nogood program, and the process loops until no new constraints are added, i.e., all SPs are satisfiable.We implemented an instance generator based on well assessed and publicly available medical guidelines for the most common NCDs1 .The generator allocates resources on a weekly basis and replicates the allocation in each week of the given time horizon, then it generates CPs.Specifically, we have: (i) 5 CUs, each of them with a daily capacity (expressed in number of slots) drawn with uniform probability in the range [24,60]; (ii) a number of operators drawn with uniform probability in [1,4] on each day of the week for each CU; (iii) services with a duration (expressed in number of slots) in [6,15] and associated with a CU; (iv) packets made of 4 services at most; (v) a given number of patients with a number of CPs in [1,4].The probability of assigning a number of CPs to a given patient is inversely proportional to the number of CPs itself.
For each number of patients in {10, 20, 40} and length of the planning horizon in {30,60} days, 20 instances are generated, summing up to 120 instances.Experiments were run with Clingo 5.6.2 with a time limit of one hour on a Ubuntu 22.04.1 LTS OS, Intel(R) Xeon(R) CPU E5-2430 v2 @ 2.50GHz machine with a 32GB System Memory.
Figure 2 shows on the y-axis the number of instances solved by each of the three approaches within a given computation time reported on the x-axis.The decomposition approach lets one solve to optimality between 30% and 42% more instances.
To have a finer detail on how the running time varies with the size of the instance, we plot in Figure 3 the runtime versus the number of services to be scheduled, comparing the monolithic approach and the LBBD method equipped with Multi-Shot solving (MS).Solid lines represent total time, while dotted lines show the time required by grounding.Instances running into out of memory were counted as running for 3600s.For the LBBD-MS we also show the time for the overall algorithm (orange series) as well as the time required by the MP (green series).The time required by the SP can be easily evaluated by difference between the orange and the green series.We can observe the following facts: (i) as expected, the total time grows as the number of services increases regardless of the method used; (ii) for the monolithic approach, the running time is almost entirely spent in the grounding phase; (iii) for the LBBD with MS the grounding time spent in the MP is stable across instances and negligible; the grounding time of this approach is almost all due to the Sub-Problems.
To show the exact speedup in the two phases, Figure 4 considers only those instances for which the monolithic approach was able to terminate within the timeout; clearly these are the most favorable for the monolithic approach.In these instances, the average grounding time for LBBD was 39.2% of that of the monolithic, while the average solving time was 12.05% of that of the monolithic, with almost an order of magnitude of improvement in the solving time.

Conclusions
In this work, we adopted Logic-Based Benders Decomposition (LBBD) in a solving process based on Answer Set Programming; to the best of our knowledge, this is the first work adopting this methodology with ASP.LBBD is a widely used solving technique in Operations Research and in Constraint Programming, and it constitutes one of the most effective technologies for hybridization of Integer Linear Programming and Constraint Programming technologies.With LBBD, the problem can be decomposed without losing completeness, i.e., maintaining the possibility to find the optimal solution and prove its optimality.Even more interestingly, this opens a new avenue of integration of ASP with other paradigms for solving constrained optimization problems, e.g.new hybrid algorithms involving ASP and Constraint Programming or Integer Linear Programming.
The considered application is a scheduling problem for chronic outpatients with Non-Communicable Diseases needing recurrent services at the hospital.The experimental results show that LBBD enlarges the applicability of ASP to larger instances without sacrificing optimality.Future work includes strengthening the efficiency of the LBBD scheme by providing stronger no-goods from the subproblems to the master problem, and to apply LBBD to other problems.
We believe that the LBBD approach could be applied to a number of applications already available for ASP (e.g., (Guido et al. 2020;Cardellini et al. 2021;Caruso et al. 2023), just to name a few in the health care domain) in which the global problem was greedily split into sub-parts; we hope that this work could be of inspiration for the many ASP applications in which the authors forewent obtaining optimality, and widen even further the ASP applications in the real world.

•
occurrence to schedule(Patient,Packet) provides the packets that should ideally be scheduled for each patient; the ideal date is ideal date(Patient, Packet, IdealDate), but a tolerance is accepted; predicate within tol(Packet, Day, IdealDate) checks if Day stands within the tolerance.• The set of available days for the scheduling is provided by day(D); • service in packet(Srv,Pck) means that service Srv belongs to packet Pck • necessity(Service1,Service2,(Dmin,Dmax)) means that if Service1 is scheduled on day d 1 , Service2 should be scheduled in the interval [d 1 + Dmin, d 1 + Dmax].• interdiction(Service1,Service2,Ndays) states that Service2 cannot be scheduled for Ndays after Service1.

Fig. 2 :
Fig. 2: Number of solved instances vs running time

Fig. 3 :
Fig. 3: Run time vs number of services -all instances.
∅ return AS M P ∪ day AS SP day