Presentation is loading. Please wait.

Presentation is loading. Please wait.

School on Optimization, Le Croisic, 23-24, March, 2002. 1 Hybrid Constraint Solving in ECLiPSe: Framework and Applications Farid AJILI, IC-Parc, Imperial.

Similar presentations


Presentation on theme: "School on Optimization, Le Croisic, 23-24, March, 2002. 1 Hybrid Constraint Solving in ECLiPSe: Framework and Applications Farid AJILI, IC-Parc, Imperial."— Presentation transcript:

1 School on Optimization, Le Croisic, 23-24, March, 2002. 1 Hybrid Constraint Solving in ECLiPSe: Framework and Applications Farid AJILI, IC-Parc, Imperial College, London. March, 2002. (CP-AI-OR’02 School On Optimization, Le Croisic, France)

2 School on Optimization, Le Croisic, 23-24, March, 2002. 2 Agenda  Combinatorial Optimization  Integration of CP and OR techniques  CP and OR: what are they ?  Why both ?  ECLiPSe as a platform for hybrid solvers  Ingredients  Features  Probe Backtrack Search for CP-OR hybridization  Application: scheduling with piecewise linear optimization  Conclusion.

3 School on Optimization, Le Croisic, 23-24, March, 2002. 3 Combinatorial Optimization (1)  Intractable  No efficient general algorithm is known  Search for solution requires exponential time/space, e.g., · Problem size=10 solved in 1 nanosecond · Problem size=100 solved in 4 * age of the universe  Capture most of “real life” requirements  No solution approach is universally successful  Constraint Programming  Operations Research

4 School on Optimization, Le Croisic, 23-24, March, 2002. 4 Combinatorial Optimization (2)  Large scale  prohibitively expensive  Problem specificity  Every problem is unique  Very similar problems are actually different (sub-problem sizes, linking constraints,…)  Textbook solutions often won’t work  without modification/extensions  Problem structure embeds well-studied sub-problems  Scope for hybrid algorithms

5 School on Optimization, Le Croisic, 23-24, March, 2002. 5 Constraint Programming  CLP Program = Logic + Control  Logic => Modelling:  Expressive power (e.g., global constraints)  Clear and simple semantics  Control => Solving:  Fully exploit the structure of the constraints  Constraints communicate via variable domains  Inference based on constraint propagation/domain reduction  Search driven by problem-specific heuristics

6 School on Optimization, Le Croisic, 23-24, March, 2002. 6 CLP Modelling  Variables  Type  Domain  Constraints  N-ary relations  Built-ins or user- defined predicates  Model  = setup program X1{1..9} alldifferent([ _, _, _ ]) X3{1..9} X2{1..9} X4{1..9} _ #> _ _ #\= _ [X1,X2,X3,X4]::1..9, X1 #> X2, alldifferent([X2,X3,X4]), X1 #\= X4.

7 School on Optimization, Le Croisic, 23-24, March, 2002. 7 CLP Solving  CLP solving interleaves inference and search  The inference is supported by constraint propagation  Extract information from the constraint network  The network is simplified: inconsistent domain values are removed  Propagation is monotonic, sound and terminates  Search  Search disjunctive constraints through backtrackable decisions  Propagation might exclude some choices  “Guess” a decision using heuristics

8 School on Optimization, Le Croisic, 23-24, March, 2002. 8 A Solving Example (1) X{red,green} Y{red,blue} Z{red,green,blue} \= Search control Search control

9 School on Optimization, Le Croisic, 23-24, March, 2002. 9 A Solving Example (2) X{red,green} Y{red,blue} Z{red,green,blue} \= Search control Search control ?

10 School on Optimization, Le Croisic, 23-24, March, 2002. 10 A Solving Example (3) X{red} Y{red,blue} Z{red,green,blue} \= Search control Search control

11 School on Optimization, Le Croisic, 23-24, March, 2002. 11 A Solving Example (4) X{red} Y{blue} Z{green,blue} \= Search control Search control

12 School on Optimization, Le Croisic, 23-24, March, 2002. 12 A Solving Example (5) X{red,green} Y{red,blue} Z{red,green,blue} \= Search control Search control red blue green A solution

13 School on Optimization, Le Croisic, 23-24, March, 2002. 13 The CLP View Constraint setup ( = Modeling ) Xi Cj Variables & Constraints Heuristics & Search control Propagation & Domain reduction Generic CLP program: solve(Vars) :- constrain(Vars), search(Vars). constrain(Vars) :- search(Vars) :-

14 School on Optimization, Le Croisic, 23-24, March, 2002. 14 Operational Research  Often associated to Mathematical Programming (MP)  Model and analyse decision problems  Assumption: optimization function and constraints are functions of the decision variables.  Restricted modelling power  Numeric domains  Equations/Inequalities  Integrality constraints  Solution methods take advantage of special structure of problems  Linear Programming (LP) (e.g., Simplex),  Branch and Bound (e.g., MIP)  Cutting Planes.

15 School on Optimization, Le Croisic, 23-24, March, 2002. 15 A MP Formulation Given |J| sites and |I| customers: Let c ij be the cost of satisfying demand i from the facility located at site j Let y ij = 1 if demand of client i is served by facility j, 0 otherwise Let x j = 1 if a facility is opened at site j, 0 otherwise. LP Relaxation Non-linearity

16 School on Optimization, Le Croisic, 23-24, March, 2002. 16 CP versus OR  CP l more general constraints l handle integers directly l Favourable example:  Variable Bounds:  [X 1,…,X 100 ] :: 1..100  Previous Constraints:  X 1 < X 2, …, X 98 < X 99  Resulting Bounds:  X 1 :: 1..2, …, X 99 :: 99..100  New Constraint:  X 1 >= 3  Result (1 step): failure!  CP l more general constraints l handle integers directly l Favourable example:  Variable Bounds:  [X 1,…,X 100 ] :: 1..100  Previous Constraints:  X 1 < X 2, …, X 98 < X 99  Resulting Bounds:  X 1 :: 1..2, …, X 99 :: 99..100  New Constraint:  X 1 >= 3  Result (1 step): failure!  OR l restricted class of constraints l finds optimum without search l Favourable example:  Variable Bounds:  [X 1,X 2 ] :: 1..100  New Constraints:  X 1 > X 2, X 2 > X 1  Result (1 step): failure!  OR l restricted class of constraints l finds optimum without search l Favourable example:  Variable Bounds:  [X 1,X 2 ] :: 1..100  New Constraints:  X 1 > X 2, X 2 > X 1  Result (1 step): failure!

17 School on Optimization, Le Croisic, 23-24, March, 2002. 17 CP-MP Hybridization  Hybridization of traditional CP & MP  Successful approach for large-scale combinatorial optimization  Benefits are increasingly recognized  They have complementary characteristics · Pure CP · Powerful for satisfaction of combinatorial constraints · Weak on optimization because inference is based on local consistency · Pure MP · Special-purpose optimization for a special classes of problems (e.g. linear) · Weak on satisfaction of combinatorial constraints  Efficiency via CP-MP hybridization  Decomposition into well-structured sub-problems  Exploit problem structure and specificity

18 School on Optimization, Le Croisic, 23-24, March, 2002. 18 Ingredients for Hybridization  Expressive power of the “hybrid” language  Built-in primitives  Setup complex constraints before and during search  Flexible modelling  The hybrid algorithm consists of 1. backtrack search procedure, and 2. “support methods” which assist it  Accommodate co-operative solvers  Cooperate with the search as it progresses  Selection & Scope of appropriate methods to the sub-problems  Provide “glue” for heterogeneous solvers  Link sub-problems through variables and channels (“glue”)  Advanced control of solvers

19 School on Optimization, Le Croisic, 23-24, March, 2002. 19 The ECLiPSe Platform  ECLiPSe is a CLP environment  Development  ECRC, Munich  IC-Parc AND Parc-Technologies Ltd  Growing academic user community  More than 400 academic licenses issued  Objectives of ECLiPSe  Development & Delivery of software solutions to real world problems  Solutions = Hybrids  Novel approach: support hybrid algorithms

20 School on Optimization, Le Croisic, 23-24, March, 2002. 20 Features for Hybridization  Constraint setup  Common conceptual model: one program for different solvers  Different solvers handle different constraint classes  Programmable mapping/relaxing into solver constraints  Synchronisation and integration  Search decisions are communicated to all solvers  Solvers are dealing with parts of the same problem  Information passing between solvers  How the information is integrated back to the search  Incremental prototyping  Incremental development of the solver  Incremental extension of the problem

21 School on Optimization, Le Croisic, 23-24, March, 2002. 21 Solver Cooperation in ECLiPSe  “Demons” and data-driven triggering  Fine grained waking conditions (narrowed bounds,...)  suspend(simplex_solve(Handle), 5, [X->min, X->max])  Priority scheme  Cheap agents first, slow ones later  e.g., interval propagation before Simplex  Attributed variables  Bounds, Domain, Range  Tentative value (later)  Repair-based forward search  Search independently sub-problems  Support methods to aid the backtrack search  Forward search methods

22 School on Optimization, Le Croisic, 23-24, March, 2002. 22 Repair library  Basic idea  Start with a “good” inconsistent “solution”  Increase consistency incrementally  Applications  Repair Problems · “good” inconsistent solution: the “previous” solution  Repair-Based Constraint Satisfaction · “good” inconsistent solution: the partially consistent soln. found by heuristics  Repair-Based Constraint Optimization · “good” inconsistent solution: a good soln. with respect to optimization function  Hybridization · “good” inconsistent solution: a good soln. produced by a forward search method

23 School on Optimization, Le Croisic, 23-24, March, 2002. 23 Basic concepts  Variables can have “tentative values” X::1..9, X tent_set 5. X = X{fd:[1..9], repair:5}  Their changes are propagated [X,Y,Z] tent_set [1,1,1], S tent_is X+Y+Z, Y tent_set 5. S = S{repair:7}  Constraints can be monitored for violation [X,Y,Z] tent_set [1,2,3], X + Y #= Z r_conflict confset, % X + Y #= Z satisfied X tent_set 2, % X + Y #= Z violated conflict_constraints(confset,Conf). % Conf=[X+Y#=Z] X{ } Y{ } fd:3..6 fd:1..3repair:3 repair:5 #>=#>= r_conflict

24 School on Optimization, Le Croisic, 23-24, March, 2002. 24 Probe Backtrack Search  Partition problem into easy and hard part  Easy part: tractable  Hard part: remaining constraints  Solve the easy part using a specialised OR solver  Value suggestions (a probe) as a tentative assignment  Characteristics: · Optimally, satisfy the “easy sub-problem” · “Super-optimal” and partially consistent · Discrete values  Incrementally repair violations in the hard part  Make a choice: add an easy constraint (on backtracking, its negation)  Aim: reduce hard constraint violation in subsequent probes Easy Part Cost Function Hard Part

25 School on Optimization, Le Croisic, 23-24, March, 2002. 25 Algorithm Outline search:- define_problem(Vars), probe_tent_values(c,Vars), % assigns tentative values repair_label(c, Vars). repair_label(CS,_):- conflict_constraints(CS, []), !. repair_label(CS, Vars): conflict_constraints(CS, [Constr|_]), fix_constr(Constr), probe_tent_values(CS, Vars), % re-assigns tentative values to “better” values repair_label(CS, Vars). search:- define_problem(Vars), probe_tent_values(c,Vars), % assigns tentative values repair_label(c, Vars). repair_label(CS,_):- conflict_constraints(CS, []), !. repair_label(CS, Vars): conflict_constraints(CS, [Constr|_]), fix_constr(Constr), probe_tent_values(CS, Vars), % re-assigns tentative values to “better” values repair_label(CS, Vars).

26 School on Optimization, Le Croisic, 23-24, March, 2002. 26 A Toy Example (1) define_problem(Vars, rc, Handle, Trigger) :- Vars = [X1,X2,X3], fdplex:(Vars:: 1.. 4), fdplex:(X2 - X3 #=<2), fdplex:(X2 #=< X1), fdplex:(-X2 + X3 #= 3), lp_demon_setup(min(X1 - X3),Cost,[],9,[trigger(simplex)],Handle), lp_get(Handle,vars,Vs), lp_get(Handle, solution, Solution), Vs tent_set Solution, sos2([X1,X2,X3]) r_conflict rc, Trigger = simplex. sos2(Vars):- Vars tent_get Vals, sos2_is_ok(Vals). define_problem(Vars, rc, Handle, Trigger) :- Vars = [X1,X2,X3], fdplex:(Vars:: 1.. 4), fdplex:(X2 - X3 #=<2), fdplex:(X2 #=< X1), fdplex:(-X2 + X3 #= 3), lp_demon_setup(min(X1 - X3),Cost,[],9,[trigger(simplex)],Handle), lp_get(Handle,vars,Vs), lp_get(Handle, solution, Solution), Vs tent_set Solution, sos2([X1,X2,X3]) r_conflict rc, Trigger = simplex. sos2(Vars):- Vars tent_get Vals, sos2_is_ok(Vals). No Integrality Constraints

27 School on Optimization, Le Croisic, 23-24, March, 2002. 27 A Toy Example (2) probe_tent_values(Handle,Trigger) :- schedule_suspension(Trigger), wake, lp_get(Handle,vars,Vars), lp_get(Handle,solution,Solution), Vars tent_set Solution. fix_constr(sos2([X1,X2,X3])) :- ( X3 = 0 ; X1 = 0 ). probe_tent_values(Handle,Trigger) :- schedule_suspension(Trigger), wake, lp_get(Handle,vars,Vars), lp_get(Handle,solution,Solution), Vars tent_set Solution. fix_constr(sos2([X1,X2,X3])) :- ( X3 = 0 ; X1 = 0 ). X3=0 X1=0

28 School on Optimization, Le Croisic, 23-24, March, 2002. 28 Input schedule (fixed times) s1s1 s2s2 s3s3 e1e1 e2e2 e3e3 No. of Resources Required Time 3 2 1 3 2 1 s1s1 s2s2s3s3

29 School on Optimization, Le Croisic, 23-24, March, 2002. 29 Output: retime activities New Requirements : 1) Only, two resources 2) Precedence constraints: S1 :: L … U 20  S1–E2 S2– E3=60 etc … No. of Resources Required s1s1 s2s2 s3s3 S1 S2 S3 E1 E2 E3 3 2 1

30 School on Optimization, Le Croisic, 23-24, March, 2002. 30 Some use-cases  Dynamic scheduling problems  Existing schedule is given  Constantly changing schedule environment  Use cases for re-scheduling  Cope with resource failures  Additional activities/requirements  Resource saving  Criteria  Minimal perturbation to existing schedule  Minimal schedule cost  Maximise schedule revenues  Starting point: industrial transportation application

31 School on Optimization, Le Croisic, 23-24, March, 2002. 31 Problem Interest  Piecewise Linear (PL) optimization  Captures most common objective criteria · Minimal perturbation · Tardiness · Earliness  Piecewise linearizations are often a good approximation  Hybrid algorithm for minimal perturbation  It significantly outperforms individual CP and CPLEX MIP solvers  [El-Sakkout, Wallace 2000] Time_i Cost_i T0=Preferred Time

32 School on Optimization, Le Croisic, 23-24, March, 2002. 32 Problem Input  Scheduling with piecewise linear (PL) optimisation  Input  Resources with their capacities, activities and their resource demands  For each activity, a PL constraint  (Time_i, Cost_i)  Temporal constraints: · Let # be a relation in {=, , , ,  }, and U,V be temporal variables · Constraints are of the form: U # c or U # V+c where c   Assumption: time discreteness Time_i Cost_i

33 School on Optimization, Le Croisic, 23-24, March, 2002. 33 The Problem as a CSP  Constrained variables  Start/End time variables of activities  Boolean variables capturing whether an activity spans with an other activity start time  Cost-related variables  Constraint system  Resource utilisation rules · Resource demand is smaller than or equal to the available amount · Resource maintenance requirements  Temporal constraints · Bounding (e.g., time windows) · Distance/precedence relations  Objective function constraints · Cost definition · PL constraints · Cost bounds

34 School on Optimization, Le Croisic, 23-24, March, 2002. 34 Conceptual Model CP hard set MP easy set Domain reduction Interval propagation Lookahead resource bound checking Heuristics Repair Global cost Optimal assignment Discreteness InferenceRelaxation+Probe

35 School on Optimization, Le Croisic, 23-24, March, 2002. 35 Probing Issues  Curves are non-convex (unlike Minimal Perturbation)  Pure Linear Programming is not enough  Which part handles the non-convexity of the piecewise linearity ? 1. Easy part contains a linear relaxation of the PL constraints · Linear Programming is enough · More search to fix the PL violations 2. Easy part contains the PL constraints · Need to use Mixed Integer Programming (MIP)  Different options for the probers  The -formulation (MIP)  The  -formulation (MIP)  Linear relaxation (LP) MIP/LP problem CP search Probing

36 School on Optimization, Le Croisic, 23-24, March, 2002. 36 The Hybrid Algorithm  Probing phase:  Purpose: get a tentative temporal assignment (“probe”)  Scope: minimize Cost subject to Temporal & PL constraints  Structure: the integrality of the temporal variables is guaranteed  Resource feasibility phase:  Monitor resource constraints for violation  Probe guides the search towards “conflict regions”  Repair incrementally the violations · Select a resource violation (e.g., the maximum infeasibility,..) · “Guess” a distance constraint reducing the contention · The constraint should preserve the tractability of the probing sub-problem X <Y XYXY

37 School on Optimization, Le Croisic, 23-24, March, 2002. 37 The role of the probe Fixed Variables X{4}4 Tentative Variables Y{1..4}3 Conflict Region of Violated Constraints 1.High quality 2.Focus the search

38 School on Optimization, Le Croisic, 23-24, March, 2002. 38 Outline of the Algorithm 1. Apply propagation to all the constraints 2. Temporal && PL Optimisation Apply the Prober to the easy part 3. Determine the set of violated constraints 4. Select a violated constraint 5. Feasibility (Backtrackable decision) Impose a new temporal ordering constraint C to reduce violations consistent optimum integer values none: Exit with success

39 School on Optimization, Le Croisic, 23-24, March, 2002. 39 Some Notes  Discreteness of the the temporal variables  Make easier the integration with FD reasoning  Caution: no cost bound in the MIP formulation  Inference via probing  Propagation based on the “Reduced costs”  Fix variables to their lower/upper bounds if them will not improve the cost  Close cooperation is more effective  The probing sub-problem is dynamically re-shaped during search  Tighten individual PL constraints [Refalo, 99]

40 School on Optimization, Le Croisic, 23-24, March, 2002. 40 The -formulation Tightening the probing sub-problem  Variable Fixing [Refalo, 99]  Infer further “cuts” on the s For each  (Time, Cost) Time Cost

41 School on Optimization, Le Croisic, 23-24, March, 2002. 41 The  -formulation Tightening the probing sub-problem:  Similarly, some  s can be fixed [Refalo, 99]  Derive further “cuts” on them For each  (Time, Cost) Time Cost

42 School on Optimization, Le Croisic, 23-24, March, 2002. 42 Linear Relaxation Time Cost T Time  T 1+T  Time  Model  (Time, Cost) by its convex hull  Split the domain of Time and branch  Incrementally updated.

43 School on Optimization, Le Croisic, 23-24, March, 2002. 43 The Repair Strategy  Two types of violation  Resource violations  PL violations  Repair priority 1) Resource violations 2) PL violations  Advantage  Favours resource feasibility · Initially ignore accuracy of costs 1 1 2 3 2 Time |Res|

44 School on Optimization, Le Croisic, 23-24, March, 2002. 44 Evaluation & Discussion  Evaluation on randomly generated tests  Problem tightness  Amount of resource saving  PL optimisation: “distance” from the convex case  The strength of the pruning in H(MIP)  H(relax ) outperforms H( - prober):  “First, repair resource violations” versus “First, repair PL violations”  Cheap probing versus probe quality  Ongoing work with other applications  Networking area

45 School on Optimization, Le Croisic, 23-24, March, 2002. 45 Conclusion  Even when problem precludes OR, hybridization is beneficial!  ECLiPSe is an environment for integration of  Models  Solvers  More hybrid schemes are available  Bender’s Decomposition  Column Generation  CP mixed with Langrangian Relaxation  CP combined with Local Search  Finite Domains & Real Interval Propagation  and 44 solvers/libraries.

46 School on Optimization, Le Croisic, 23-24, March, 2002. 46

47 School on Optimization, Le Croisic, 23-24, March, 2002. 47

48 School on Optimization, Le Croisic, 23-24, March, 2002. 48


Download ppt "School on Optimization, Le Croisic, 23-24, March, 2002. 1 Hybrid Constraint Solving in ECLiPSe: Framework and Applications Farid AJILI, IC-Parc, Imperial."

Similar presentations


Ads by Google