Presentation is loading. Please wait.

Presentation is loading. Please wait.

A LGPL framework for combinatorial optimization & problem solving Renaud De Landtsheer.

Similar presentations

Presentation on theme: "A LGPL framework for combinatorial optimization & problem solving Renaud De Landtsheer."— Presentation transcript:

1 A LGPL framework for combinatorial optimization & problem solving Renaud De Landtsheer

2 Content What are combinatorial problems? Several approaches for solving combinatorial problems What is Asteroid Roadmap 2

3 Combinatorial problem solving Given a problem: A set of unknown, with discrete range hence, combinatorial problem A set of constraints involving the unknowns (An objective function to minimize / maximize) Find a value for each variable, such that The values belong to the ranges of the variables Each constraint is enforced (The objective is minimized / maximized) 3

4 Examples of combinatorial problems Scheduling problems eg: Job shop: Set of tasks eg: 1k With precedence constraints and ressource usage Minimize makespan Decision problems eg: Nqueens: Given a chessboard of size N*N (eg: 1000) Put N queens on it such that they do not threaten each other Routing problems eg: tsp+deadline Visit a set of places, with deadline constraints Minimize overall distance Etc. 4

5 Approaches for solving combinatorial problems Exhaustive symbolic exploration Constraint programming MIP Local search -based Constraint-based local search Large neightboorhood search Other approaches Column generation Ant colony Method should be tailored to requirements! COMET, Kangaroo (COMET, Scampi) All CP engines LocalSolver GLPK, LPSolve… Gecode, Jacop, CHOCO, COMET, Scampi 5

6 Relevant aspects to be considered Scalability CBLS provides very good scalability, better than CP Optimality CBLS might be suboptimal; requires benchmarking Development cost The more declarative is the framework, the lower Need for tuning MIP requires zero (but high modeling cost) CP requires more, CBLS more than CP Specific requirements Local search requires adequate search heuristics 6

7 What bring these framework compared to a specific development? Declarativity Code your problem as it is defined, through standardized vocabulary, eg: constraints allDiff(Array_of_variables) a <= b+5 Lower development cost Thanks to declarativity, focus given to the fine tuning, not to heavy development Efficiency Standardized constraints are deeply optimized Eg: Alldiff costs O(1) for each move in Asteroid 7

8 Local search Perform a descend in the solution space; repeatedly move from one solution to a better one Next solution identified via neighborhood exploration Neighborhood = set of neighbors obtained by slightly perturbing the solution (several possibilities) Nqueens: moving a queen or swapping two queens Scheduling: swapping two tasks Routing: moving a task 8

9 Constraint-based local search Enables very fast evaluation of neightbors Fastest than evaluating objective from scratch Additional mechanisms are provided to identify the most relevant neightbors without evaluating them Eg: get the worse part of the problem Rich library of standardized formulas that can be used to encode a problem into the Asteroid framework 9

10 A standard Benchmark of Asteroid 10

11 Logical Architecture of Asteroid Propagation Propagation element, propagation structure Computation Variable, invariant, IntVar, IntSetVar Library of invariants Plus, minus, argMax, Inter, ArrayAccess, … Constraint structure Constraint system, constraint Constraint library eq, neq, ge, alldiff, atMost Search selectMax,… stopwatch 11

12 Availability and Roadmap of Asteroid Asteroid is a research prototype for Wist3.0 project (Wallonie) Developed entirely at CETIC Aiming at prioritizing patients in oncology services Includes specific extensions for scheduling problems Available free of charge under LGPL license Bug correction, and some extensions are LGPL Written entirely in Scala 12

13 NQueens naïve: the initial blabla object NQueens extends SearchEngine{ def main(args: Array[String]) { val N:Int=40 val range:Range = Range(0,N) val MaxIT = 10000 println("NQueens(" + N + ")") 13

14 NQueens naïve : defining the problem val m: Model = new Model val Queens:Array[IntVar] = new Array[IntVar](N) for (q <- range){Queens(q) = new IntVar(m, 0, N-1, q, "queen" + q)} val c:ConstraintSystem = new ConstraintSystem(m) ( q <- range) yield (q plus Queens(q)).toIntVar)) ( q <- range) yield (q minus Queens(q)).toIntVar)) c.close m.close Plus and minus are infix expression for sum and minus invariants AllDiff constructor does not require « new » (scala case class) 14

15 NQueens naïve : defining the search procedure var it:Int =0 while((c.Violation.getValue() > 0) && (it < MaxIT)){ val (q1,q2):(Int,Int) = selectMin2(range, range, (q1:Int, q2:Int) => c.getSwapViol(Queens(q1), Queens(q2)), (q1:Int,q2:Int) => q1 < q2) Queens(q1) :=: Queens(q2) it += 1 println("it: " + it + " " + c.Violation + " (swapped "+ q1 + " and " + q2 + ")") } 15

16 NQueens naïve : printing & running NQueens(40) it: 1 Violation:=38 (swapped 12 and 9) it: 2 Violation:=37 (swapped 8 and 39) … it: 33 Violation:=1 (swapped 10 and 14) it: 34 Violation:=0 (swapped 3 and 11) Violation:=0 IntVars(queen0:=13,queen1:=17,queen2:=25,queen3:=11,queen4:=8,… println(c.Violation) println(m.getSolution(true)) } 16

17 Invariant library Logic Acces on array of IntVar, IntSetVar Access on array of IntVar, where index is IntSetVar Sort Filter, Cluster (indexes of element whose value is…) SelectLeSetQueue (for Tabu search) … MinMax Min, Max (linear and Log variants) ArgMin, ArgMax Numeric sum, prod, minus, div Also on enumeration of IntVar abs Set Cardinality Inter, Union, Diff Interval, MakeSet Look also in Computation Structure Identity invariants Events « TriggerOn » 17

18 Constraint Library Global allDiff atLeast atMost (untested) Basic Eq, Neq G, GE L, LE 18

19 Need more info Asteroid Website Wiki Svn Scaladoc available Also on the website Renaud De Landtsheer 19

20 References Constraint-Based Local Search by Pascal van Van Hentenryck, Laurent Michel 20

Download ppt "A LGPL framework for combinatorial optimization & problem solving Renaud De Landtsheer."

Similar presentations

Ads by Google