Reasoning Engines

A bird's eye view

Contents

• Intro
• Logic-based systems
• Arithmetic-based systems
• Local Search
• IDP
• DMN

Goal of "reasoning engine"?

"each doctor has at most one shift per day"

"a doctor is present during each shift"

"doctor A never works on mondays"

• Decide whether solution exists
• Find any solution
• Find optimal solution

Solutions

• Logic-based
• Arithmetic-based
• Local Search
\varphi
$\varphi$
\sum
$\sum$
\nabla
$\nabla$

Logic-based

• Decision problems
• Discrete variables
• Disjunctive constraints
• "Artificial Intelligence"
\forall s \in Shift\colon \exists d \in Doctor \colon Assign(s,d)
$\forall s \in Shift\colon \exists d \in Doctor \colon Assign(s,d)$
Assign(s_1,d_1) \vee Assign(s_1,d_2) \vee \ldots \vee Assign(s_1,d_n)
$Assign(s_1,d_1) \vee Assign(s_1,d_2) \vee \ldots \vee Assign(s_1,d_n)$
Assign(s_m,d_1) \vee Assign(s_m,d_2) \vee \ldots \vee Assign(s_m,d_n)
$Assign(s_m,d_1) \vee Assign(s_m,d_2) \vee \ldots \vee Assign(s_m,d_n)$
\ldots
$\ldots$

High level:

Low level:

\varphi
$\varphi$

SAT solving

• Back-end technology
• Chip verification, cryptography
• MiniSat, Glucose, Lingeling
x_{11} \vee x_{12} \vee \ldots \vee x_{1n}
$x_{11} \vee x_{12} \vee \ldots \vee x_{1n}$
\ldots
$\ldots$
x_{m1} \vee x_{m2} \vee \ldots \vee x_{mn}
$x_{m1} \vee x_{m2} \vee \ldots \vee x_{mn}$
\varphi
$\varphi$

Constraint programming

• Language "intuitive for programmers"
• Planning, scheduling
• Chuffed, Gecode, ILOG (IBM), Google Optimization Tools
forall(j in 1..nbshifts)(
sum(i in 1..nbdoctors)(x[j,i]) >= 1
)
\varphi
$\varphi$

SMT solving

• Unknown / infinite domains
• Theorem proving, program verification, chip verification
• Z3 (Microsoft), CVC (Intel)
\varphi
$\varphi$
\forall s \in Shift\colon \exists d \in Doctor \colon Assign(s,d)
$\forall s \in Shift\colon \exists d \in Doctor \colon Assign(s,d)$

• Rule-like, originating from Logic Programming
• Strong recursion support
• SModels, DLV, Clingo
1 \leq \lbrace assign(X,1..n) \rbrace :- ~shift(X)
$1 \leq \lbrace assign(X,1..n) \rbrace :- ~shift(X)$
\varphi
$\varphi$

Arithmetic-based

• Optimization
• Numeric variables
• Arithmetic constraints
• "Operations Research"
\sum
$\sum$
\sum_i x_{1i} \geq 1
$\sum_i x_{1i} \geq 1$
\ldots
$\ldots$
\sum_i x_{mi} \geq 1
$\sum_i x_{mi} \geq 1$
\sum_{k,i} c_{i}x_{ki}
$\sum_{k,i} c_{i}x_{ki}$

Low level arithmetic formulas

Objective function

• Floating point variables
• (Linear) relaxation
• Routing, scheduling, production planning
• Cplex (IBM), GuRoBi, Coin-OR, Google Optimization Tools
\sum
$\sum$
forall(j in 1..nbshifts)(
sum(i in 1..nbdoctors)(x[j,i]) >= 1
)

Mixed integer programming

\sum_i x_{1i} \geq 1
$\sum_i x_{1i} \geq 1$
\ldots
$\ldots$
\sum_i x_{mi} \geq 1
$\sum_i x_{mi} \geq 1$
\sum_{j,i} c_{i}x_{ji}
$\sum_{j,i} c_{i}x_{ji}$

Low level:

Objective function:

• Non-linear programming
• Fractional programming
• Geometric programming
• Convex programming
• Semidefinite programming
• ...
\sum
$\sum$

In:

• simple solution
• (extended) objective function
• solution "transformations"

Return: best solution encountered

Local search

\nabla
$\nabla$

During: stochastically transform solution into "neighbor" solution

Local search

\nabla
$\nabla$

Analogy: hill climbing

• Large problems
• Much hand-work
• designing transformations
• writing custom search algorithm
• No optimality guarantee
• LocalSolver, Tabu search, Simulated annealing

• Logic-based
• constraint programming + answer set programming
• Rich high-level language
• Implements the knowledge base paradigm
• solve multiple problems with 1 specification
• E.g., give explanation for inconsistent constraints

• Not quite a "reasoning engine"
• inherent workflow: input -> output
• cfr. hamburger problem
• Similar: rule-based systems