Hybrid Algorithms, Local Search and ECLiPSe - PowerPoint PPT Presentation

About This Presentation
Title:

Hybrid Algorithms, Local Search and ECLiPSe

Description:

The RAC's Birmingham Despatch Centre. Patrol Despatcher : Summary. Strategic Objectives. Despatch a years' worth of jobs. Simulate the company's operation ... – PowerPoint PPT presentation

Number of Views:125
Avg rating:3.0/5.0
Slides: 169
Provided by: mgw2
Category:

less

Transcript and Presenter's Notes

Title: Hybrid Algorithms, Local Search and ECLiPSe


1
Hybrid Algorithms, Local Search and ECLiPSe
2
Overview
  • Motivations
  • From Problem to Solution
  • Solvers
  • Global Constructive Search Hybrids
  • Hybrids with Separate Search Routines
  • Mappings between Models
  • Hybrid Search

3
Combinatorial Optimisation
  • Theory
  • Why arent deterministic computers as efficient
    as nondeterministic ones?
  • Practice
  • Science and Engineering
  • Configuration and design
  • Resource and Task Optimisation
  • Industry and government organisations

4
Applications of CP in Melbourne
  • Internet Routing and Balancing
  • Telstra
  • Supply Chain
  • Patrick Corp
  • Berri Ltd
  • Linfox
  • Coles Myers
  • Transportation
  • Translogix
  • IBM
  • CTI
  • NAB
  • Construction Scheduling
  • Synctec
  • Bovis Lend Lease
  • Health Systems
  • Southern Health

5
Four Case Studies
  • Logistics with Depots
  • Wincanton Transport
  • Patrol Despatcher
  • RAC
  • Flight Schedule Retimer
  • BA
  • Network resilience
  • Cisco Systems

6
Logistics with Depots
7
Logistics with Depots Summary
  • Objectives
  • Generate feasible schedule
  • Minimise driver/vehicle/travel costs
  • Constraints
  • Collection and delivery time windows
  • Vehicle capacity data
  • Travel time data
  • Vehicle load/unload time data
  • Driver shift data
  • Business Benefits
  • Strategy which customers to take
  • Profitability how much to charge

8
Patrol Despatcher
The RACs Birmingham Despatch Centre
9
Patrol Despatcher Summary
  • Operational Objectives
  • Meet real-time requirements
  • Decisions match business goals
  • Handle larger regions
  • Consistency, completeness
  • Business Benefits (planned)
  • Cost savings
  • Quick, fair decisions
  • Better despatching at borders
  • Flexible business process
  • Strategic Objectives
  • Despatch a years worth of jobs
  • Simulate the companys operation
  • Meet constraints/business criteria
  • Business Benefits
  • Negotiation with patrols
  • Test benefits of onsite protocol
  • Test different resource levels
  • Test different objectives (cost/QoS)

10
Flight Schedule Retimer
11
Flight Schedule Retimer Summary
  • Objectives
  • Retime scheduled flights
  • Observing constraints
  • Minimising changes to existing schedule
  • Business Benefits
  • Aircraft utilisation gains
  • Slot profile change
  • Punctuality improvement

12
Network Resilience Summary
  • Objectives
  • For each route passing through a network
    component, find an alternative that avoids the
    component
  • Separate shared link risk groups
  • Ensure there is sufficient bandwidth in
    alternative routes
  • Business Benefits
  • Computes minimal network redundancy
  • Maintains quality of service
  • Exploits MPLS technology

13
Approaches Research Communities
  • Operations Research
  • Integer/linear programming
  • Metaheuristics
  • Generate and improve
  • Constraint Programming
  • Constraint programming

14
Combinatorial Optimisation CommunityBig
Questions
  • What problem features best map to what
    approaches?
  • Schedule optimisation problem
  • 10,000 variables Time points
  • 50,000 constraints
  • 1 disjunction
  • Can each approach be informed by the others?
  • Why do metaheuristics improve faster than branch
    and bound?
  • How do we get from a problem definition to a
    problem solution?

15
Overview
  • Motivations
  • From Problem to Solution
  • Solvers
  • Global Constructive Search Hybrids
  • Hybrids with Separate Search Routines
  • Mappings between Models
  • Hybrid Search

16
Problem Definition gt Problem Solution
PhD
Solver Platform
17
Mapping Conceptual to Design Model
Conceptual Model Add Constraint
Behaviour Add Search Design Model
18
Logical Transformations
  • Conceptual Model
  • Decompose
  • Transform
  • Tighten
  • Link
  • Conceptual Model

19
Logical Transformations
  • Conceptual Model
  • Decompose
  • Transform
  • Tighten
  • Link
  • Conceptual Model

20
Final Conceptual Model to Design Model
  • Conceptual Model
  • Logic
  • Solver Choices
  • Add constraint behaviour
  • Search Choices
  • Add search
  • Design Model
  • Program

21
Add Constraint Behaviour
  • Post constraints to chosen solvers
  • Choose information to export from one solver to
    another
  • Choose information to export from solvers to
    search engine

22
Constraint Programming Nature and Scope
Model
Algorithm
Finite Domain Library
Repair Library
Interval Reasoning Library
Linear Programming Library
CPLEX
Xpress-MP
23
Add Search
  • Choose one global or multiple separate searches
  • Choose type of search
  • Choose information to import from and export to
    solvers

24
Research Challenge
Example Workforce Scheduling
Scheduling
Routing
What search? What information? What control?
Subproblem
Subproblem
25
Overview
  • Motivations
  • From Problem to Solution
  • Solvers
  • Global Constructive Search Hybrids
  • Hybrids with Separate Search Routines
  • Mappings between Models
  • Hybrid Search

26
Constraint Behaviour Solvers
  • Finite Domain
  • Linear
  • Interval
  • Integer/linear (MIP)
  • Set
  • SAT
  • One-way constraints

27
Communication Between Solvers
Information Events
Import constraints wake(Change,Prior)
Export assignments return / failure
variables
interrupt(Prior)
post(Change)
constraints heuristics
28
Finite Domain Solver Information
  • Import
  • Variables and domains
  • Constraints primitive,reified,global,
  • Export
  • Instantiation
  • Domain bounds
  • Domain sizes
  • Active constraints on a variable
  • Entailed constraints (disequalities,
    inequalities, reified)
  • Disentailed constraints

29
Constraint Behaviour Solvers
  • Finite Domain
  • Linear
  • Interval
  • Integer/linear (MIP)
  • Set
  • SAT
  • One-way constraints

30
Linear Solver Information
  • Import
  • Linear constraints (2X 3Y 6Z lt 24.3)
  • Optimisation expression (min(2X Y))
  • Export
  • Optimum value
  • An optimal solution
  • Reduced costs, shadow prices

31
Linear Constraints
Optimal solution
Feasible Region
32
Shadow Prices
X-Y lt 2
X-Y lt 1
Feasible Region
Shadow Price
33
Reduced Costs
34
Reduced Costs
Variable X
Feasible Region
35
Reduced Costs
Feasible Region
Reduced Cost
36
ECLiPSe Linear Solver Interface eplex
  • lib(eplex)
  • An interface between ECLiPSe and an external
    LP/MIP solver
  • XPRESS-MP, a product by Dash Associates
  • CPLEX, a product by ILOG SA
  • Motivation to have this link
  • Use state-of-the-art linear programming tools
  • Use ECLiPSe for modelling
  • Build hybrid solvers
  • Implementation
  • Tight coupling, using subroutine libraries

37
Mathematical Programming
  • minimize
  • 10 A1 7 A2 11 A3
  • 8 B1 5 B2 10 B3
  • 5 C1 5 C2 8 C3
  • 9 D1 3 D2 7 D3
  • subject to
  • A1 A2 A3 200
  • B1 B2 B3 400
  • C1 C2 C3 300
  • D1 D2 D3 100
  • A1 B1 C1 D1 ? 500
  • A2 B2 C2 D2 ? 300
  • A3 B3 C3 D3 ? 400

Plant capacity
Client demand
Transportation cost
A
200
10
1
? 500
8
9
5
B
400
7
5
2
? 300
5
3
C
300
10
11
3
8
? 400
7
D
100
  • Modelled as a matrix
  • Each row is one constraint
  • Each column is one variable

38
Example problem as a matrix
A1 A2 A3 B1 B2 B3 C1 C2 C3 D1 D2 D3
1 1 1 0 0 0 0 0 0 0 0 0 200
0 0 0 1 1 1 0 0 0 0 0 0 400
0 0 0 0 0 0 1 1 1 0 0 0 300
0 0 0 0 0 0 0 0 0 1 1 1 100
1 0 0 1 0 0 1 0 0 1 0 0 ? 500
0 1 0 0 1 0 0 1 0 0 1 0 ? 300
0 0 1 0 0 1 0 0 1 0 0 1 ? 400
10 7 11 8 5 10 5 5 8 9 3 7
39
Modelling MP problems in Eplex
  • Eplex can model multiple MP problems
    simultaneously
  • Each MP problem represented by an eplex instance

MP Problem
eplex instance
variables bounds
X1 X2 ... Xm
solution values

c1
lt
c2
constraints
gt
cn

Cost
Obj
cost
40
Transportation Problem in ECLiPSe
  • - lib(eplex).
  • main1(Cost, Vars) -
  • Vars A1, A2, A3, B1, B2, B3, C1, C2, C3, D1,
    D2, D3,
  • Vars 0.0..1.0Inf,
  • eplex (A1 A2 A3 200),
  • eplex (B1 B2 B3 400),
  • eplex (C1 C2 C3 300),
  • eplex (D1 D2 D3 100),
  • eplex (A1 B1 C1 D1 lt 500),
  • eplex (A2 B2 C2 D2 lt 300),
  • eplex (A3 B3 C3 D3 lt 400),
  • eplex optimize(min(
  • 10A1 7A2 11A3
  • 8B1 5B2 10B3
  • 5C1 5C2 8C3

41
Linear constraints
  • Non-strict linear equalities and inequalities
  • eplex(XY)
  • eplex(XgtY)
  • eplex(XltY)
  • No strict inequalities or disequalities allowed
  • X and Y are linear expressions
  • X
  • 123 3.4
  • Expr - Expr
  • E1 E2 E1 - E2 Coeff E2
  • sum( ListOfExpr )

42
Triggering the solver repeatedly
  • eplex_solver_setup(Objective, -Cost,
    Options, Priority, TriggerModes)
  • Objective
  • min(Expr) or max(Expr)
  • -Cost
  • variable - it does not get instantiated, but only
    bounded by the solution cost.
  • TriggerModes
  • inst - if a variable was instantiated
  • bounds - if a variable bound was changed
  • deviating_bounds - if a variable bound was
    changed such that its LP-solution was excluded by
    more than a tolerance.
  • new_constraint - when a new constraint appears
  • trigger(Atom) - explicit triggering

43
Retrieving results from eplex instance
  • eplex_get(Handle, What, -Value)
  • Solver results
  • typed_solution
  • reduced_cost
  • slack
  • dual_solution
  • Statistics
  • simplex_iterations
  • node_count
  • statistics
  • Original setup input
  • vars, ints, constraints, objective

44
Constraint Behaviour Solvers
  • Finite Domain
  • Linear
  • Interval
  • Integer/linear (MIP)
  • Set
  • SAT
  • One-way constraints

45
Interval Solver Information for integer and
continuous variables
  • Import
  • Variables and domains
  • Integrality (or not)
  • Constraints primitive,reified,global,
  • Export
  • Instantiation
  • Domain bounds
  • Domain sizes
  • Active constraints on a variable
  • Entailed constraints (disequalities,
    inequalities, reified)
  • Disentailed constraints
  • Interfaces Linear Relaxation and FD Solver

46
Integer/linear (MIP) Solver Information
Exponential Cost Solver
  • Import
  • Linear constraints
  • Optimisation expression
  • Integrality constraints
  • Export
  • Optimum value
  • An optimal solution
  • Reduced costs, shadow prices
  • Linear Constraints (cutting planes)
  • Fixed variables
  • Search node heuristics
  • Branching heuristics

47
Set Solver InformationFinite Sets of Values
  • Import
  • Set variables and domains
  • Set cardinality variables and domains
  • Constraints primitive,reified,global,
  • Export
  • FD information on cardinality variables
  • Values excluded from set
  • Values included in set
  • Entailed/disentailed set constraints

48
SAT Solver Information Exponential Cost Solver
  • Import
  • Clauses
  • Export
  • Feasible solutions
  • If solver can be suspended, can export
  • Clauses (nogoods)
  • Variable choice heuristics

49
Constraint Behaviour Solvers
  • Finite Domain
  • Linear
  • Interval
  • Integer/linear (MIP)
  • Set
  • SAT
  • One-way constraints

50
One-way solver information
  • Import
  • One-way constraints (functions)
  • Heuristic information
  • Variable (tentative) assignments
  • Export
  • Inconsistency
  • Heuristic information
  • Variable (tentative) assignments

51
One-way Solver Examples
  • X Y 3
  • Y 2 gt X 5
  • Y 4 gt X 7
  • Incremental Computation
  • S sumX,Y,Z
  • Y 4 gt S S_old
  • Application
  • Var select(mindomain,X,Y,Z)
  • Y \ 4 gt ???
  • Method
  • Invariant (specialised implementation of
    incremental one-way solver)

4 Y_old
52
One-way Solver in ECLiPSe - repair
  • Purpose
  • To maintain non-logical tentative information
  • Library Invocation
  • lib(repair)
  • Method
  • Attach hidden information to each variable
  • Associate events and actions with this info.

53
Tentative Assignments to Avoid Failing
Logical Assignment
Tentative Assignment
Define Decision Variables Constrain Decision
Variables Search for a Solution
X1..10 X4
X tent_set 8 X tent_set 4
Xgt5
Fail Record Conflict
54
Problem Modelling and Solving
FD
Repair
VarsDomain
Vars tent_set Vals
Initialise Decision Variables Constrain Decision
Variables Search for a Solution
ic ltConsgt
ltConsgt r_conflict Store
ic labeling(Vars)
repair(Store)
55
Tentative Invariants
X,Y tent_set 1,2
Initialise Decision Variables Constrain Decision
Variables During Search
Either Y X1
r_conflict a
Or Y tent_is X1
X tent_set 3
Record Conflict
Y4
56
Overview
  • Motivations
  • From Problem to Solution
  • Solvers
  • Global Constructive Search Hybrids
  • Mappings between Models
  • Hybrid Search

57
Global Constructive Search Hybrid Forms
Add constraint and wake solvers
Root Node
Node1
Node2
Some of these leaf nodes are our solutions
58
Cooperating Solvers Intersecting Subproblems
C1
Y
X
Z
C2
Subproblem2
Subproblem1
59
Cooperating Solvers Copied Variables
Y
C1
X2
X1
Z
C2
Solver2
Solver1
Keep X1 and X2 in step Communicate
events Communicate information
60
Cooperating Solvers Copied Variables
Y
C1
X2
C2
X2 gt 10.5
X2 gt 11
X2 gt 11
X1
Z
X1 gt 10.5
X1 gt 10.5
integer(X2)
Linear Solver
Interval Solver
Info on X
X gt 10.5
X1 gt 11

61
FD and Linear Solver Cooperation (within a
Global Constructive Search)
  • Motivation
  • Linking through Channeling Constraints
  • Forms of Cooperation

62
Motivation for FD Linear Comunication
  • Performance
  • Behaviour

63
Motivation for FD Linear CommunicationPerformanc
e
  • Linear
  • e.g. Simplex, Gauss
  • restricted class of constraints
  • finds optimum without search
  • Favourable example
  • Variable Bounds
  • X1,X2 1..100
  • New Constraints
  • X1 gt X2, X2 gt X1
  • Result (1 step) failure!
  • FD
  • e.g. interval propagation
  • more general constraints
  • handle integers directly
  • Favourable example
  • Variable Bounds
  • X1,,X100 1..100
  • Previous Constraints
  • X1 lt X2 , , X98 lt X99
  • Resulting Bounds
  • X1 1..2, , X99 99..100
  • New Constraint
  • X1 gt 3
  • Result (1 step) failure!

64
FD and Linear Constraint Solving Performance
  • Add N variables and trivial constraints
  • N 100, 200, 500, 1000, 2000, 5000, 10,000,
    20,000, 50,000
  • The Constraints
  • for each variable XJ do XJ1..N, XJ
    gt XJ-1.
  • The Solvers
  • FD
  • CLPQ
  • CPLEX (run once, after posting ALL constraints)
  • CPLEX (incremental)

65
Performance Figures (FD) - X i1gtXi
Log. Time per Constraint
66
The Less Trivial Case - N Propagation Steps per
Constraint
  • Add N variables and constraints
  • N 100, 200, 500, 1000, 2000, 5000, 10,000,
    20,000, 50,000
  • The Constraints
  • for each variable XJ do XJ1..N, XJ-1
    gt XJ-1.
  • The Solvers
  • FD
  • CPLEX (run once, after posting ALL constraints)
  • CPLEX (incremental)

67
Performance Figures (FD) - X i1gtXi
Log. Time per Constraint
68
Motivation for FD Linear Comunication
  • Performance
  • Behaviour

69
One-machine Scheduling
Task 1 Start-time 0..15, Duration 5 Task 2
Start-time 0..15, Duration 15,
Either Task1 must precede Task2
0
5
25
10
15
20
Or Task2 must precede Task1
0
5
10
15
20
Constraint no_overlap(S1,5,S2,15).
70
Representing Disjunction with
Auxiliary Boolean Variables
no_overlap(S1,D1,S2,D2) - S1 gt
S2D2. no_overlap(S1,D1,S2,D2) - S2 gt S1D1.
Choose a large number M Introduce variables
B1,B2 0..1 Replace disjuction with
conjunction
no_overlap(S1,D1,S2,D2,B1,B2) - S1M-B1M gt
S2D2, S2M-B2M gt S1D1, B1B2gt1.
Example S1,S2 0..4, no_overlap(S1,3,S2,5,B1
,B2), B11 gt fail!
71
Communicating Linear and FD Solvers
Optimisation Integer Feasibility
X,Y0..10 Ygt 2X XY gt 5 Cost min(X2Y)
FD
Linear
S1,S20..4, B1,B20..1 S1 10 - B110 gt S2
3 S2 10 - B210 gt S1 5 B1 B2 gt 1
Cost min(S1)
B20, B11 S1 3..4, S2 0..1
Cost 0..30
Cost gt 0
Cost gt 25/3
72
Hoist Scheduling
Each product must be dipped in a sequence of
tanks.
73
Disjunctive Constraint in Hoist Scheduling
Period P 1 Hoist
action b
0
T1
T2
1
2
3
4
action a
P
PT1
PT2
1
2
3
4
Disjunctive Constraint on actions a and b T2
gt PT1timefull12 timeempty23 or PT1 gt
T2timefull34 timeempty41
74
Disjunctive Constraint in Hoist Scheduling
Period P 2 Hoists
action b hoist H2
0
T1
T2
1
2
3
4
action a hoist H1
P
PT1
PT2
1
2
3
4
Disjunctive Constraint on actions a and b T2
gt PT1timefull12 timeempty23 or PT1 gt
T2timefull34 timeempty41 or H1 lt H2
75
Hoist Performance
76
Hoist Robustness -Algorithm
100 Randomly Generated 2-hoist 2-track Problems
Optimal Solutions Found 100
Minimum Time 167 secs
Maximum Time 1146 secs
Average Time 314 secs
77
Hoist Robustnes - Model
  • Benchmark Hoist Scheduling Problem
  • Tank Capacities
  • Two hoists on one track
  • Multiple hoists on multiple tracks

FD/Linear Hybrid Previous approaches
Same basic model for each problem class Completely different models
78
FD and Linear Solver Cooperation (within a
Global Constructive Search)
  • Motivation
  • Linking through Channeling Constraints
  • Forms of Cooperation

79
Different Models in FD and Linear
Distances Table Data
X1 X2 X3 X4 X5 X6
X2
X1 X2 X3 X4 X5 X6
X1
0 5 2 4 1 7
5 0 4 7 2 5
2 4 0 4 6 1
4 7 4 0 3 5
1 2 6 3 0 2
7 5 1 5 2 0
X5
X4
X3
X6
TSP Problem Find shortest route
80
ECLiPSe Syntax
  • Iteration
  • foreach(El,a,b,c,d) do write(El),write( ).
  • for(K,1,4) do write(K), write( ).
  • for(K,1,4),foreach(El,List) do ElK
  • Consta, (foreach(El,List), for(_,1,4),
    param(Const) do ElConst)
  • Consta, (foreach(El,List), for(_,1,4) do
    ElConst)
  • for(K,1,4),for(J,1,4) do write(K-J),write( ).
  • multifor(K,J,1,1,3,3) do write(K-J),write(
    )

a b c d
1 2 3 4
List 1,2,3,4
List a,a,a,a
List _,_,_,_
1-1 2-2 3-3 4-4
1-1 1-2 1-3 2-1 2-2 2-3 3-1 3-2 3-3
81
ECLiPSe Syntax
  • Arrays
  • Struct f(a,b,c,d), X is Struct2.
  • Xb
  • Matrix m(f(11,12),f(21,22),f(31,32)), X is
    Matrix3,2
  • X32
  • Matrix m(f(11,12),f(21,22),f(31,32)), X is
    Matrix1..3,2
  • X12,22,32
  • dim(M,2,2), A is M1,2
  • M ((_,A),(_,_))
  • dim(M,2,3),
  • ( multifor(K,J,1,1,2,3), param(M) do X is
    MK,J, XK-J)
  • M ((1-1, 1-2, 1-3), (2-1, 2-2, 2-3))

82
TSP Problem ECLiPSe FD Design Model
  • length(Vars,6), ic(Vars 1..6),
    icalldifferent(Vars),
  • length(Dists,6), ic(Dists 1..10),
  • ( for(J,1,6),
  • foreach(SJ,Vars),
  • foreach(DJ,Dists),
  • param(Data)
  • do
  • ListJ is DataJ,1..6),
    icelement(SJ,ListJ,DJ) ),
  • ic (Cost sum(Dists))

For example icelement(S3,2,4,0,4,6,1,D3)
83
TSP Problem ECLiPSe Linear Design Model
dim(Bools,6,6), Bools0..1, ( for(J,1,6),
param(Bools) do eplex
(Bools0..1), eplex
(sum(BoolsJ,1..6) 1),
eplex (sum(Bools1..6,J) 1) ), (
multifor(I,J,1,1,6,6),
foreach(C,Costs), param(Bools,Data) do
C BoolsI,JDataI,J
), eplex(Cost sum(Costs)).
84
Mapping FD Variables to Booleans
ic,eplex (Var 1..N), length(Bools,N),
eplex (Bools0..1), eplex (sum(Bools)
1), (foreach(B,Bools), for(Val,1,N),
for(E,Exprs) do E BVal), eplex (Var
sum(Exprs)).
Channeling constraint in linear solver
85
Cooperating Solvers Copied Variables
Channeling constraint in linear solver
Bk
C1
Var
C2
Bk1
Var
Z
Vark
Vark
Linear Solver
FD Solver
Info on Var

86
Cooperating Solvers Copied Variables
Channeling constraint in linear solver
Bk
C1
Var
C2
Bk1
Var
Vark
Vark
Z
Linear Solver
FD Solver
Info on Var

87
Mapping FD Variables to Booleans
ic (Var 1..N), length(Bools,N),
ic,eplex (Bools0..1), eplex(sum(Bools)
1), ( foreach(B,Bools), for(Val,1,N), param(Var)
do ic (Var, Val, B) ).
Channeling constraint in FD solver
88
FD and Linear Solver Cooperation (within a
Global Constructive Search)
  • Motivation
  • Linking through Channeling Constraints
  • Forms of Cooperation

89
Information Communicated from FD to Linear Solvers
  • Variable Bounds
  • Variable instantiation
  • Variable remains in linear solver, with identical
    bounds
  • Linear Constraints
  • Delay
  • MLLP

90
Communicating FD to LP Delay
  • XB gt Y
  • As soon as B is instantiated to 1, send XgtY to
    linear solver
  • As soon as B is instantiated to 0, send 0gtY to
    linear solver
  • As soon as X is instantiated, send XB gtY to
    linear solver
  • ECLiPSe Syntax
  • suspend(eplex (XBgtY), 3, X,B -gt inst)

91
Communicating FD to LP MLLP Hookers Mixed
Logical Linear Programming
  • FD(X1,,Xn) gt LP(Y1,,Ym)
  • If search or propagation entails FD constraint,
  • then LP constraint is posted to linear solver
  • ECLiPSe Syntax
  • mllp_1(X) ? Xgt5 eplex (Y gt X)

92
Information Communicated from Linear to FD Solvers
  • Directly
  • Cost Bounds
  • Indirectly
  • Reduced costs gt Var ?Val
  • often by fixing Bval0

93
Reduced Cost Pruning
94
Branch-and-bound (incremental)
Cost
Solu- tions
(Proof of optimality)
Lower bound (relaxed solution)
Iterations
95
Communicating Linear and FD Solvers
Optimisation
X,Y0..10 Ygt 2X XY gt 5 Cost min(X2Y)
FD
Linear
Cost 0..30
Cost gt 25/3
96
Branch-and-bound (incremental)
Cost
Solu- tions
Optimal solution
(Proof of optimality)
No solution
Lower bound (relaxed solution)
Iterations
4
97
Global Constructive Search FD and Linear Solvers
Add constraint and wake FD and linear solvers
Root Node
Node1
Node2
Some of these leaf nodes are our solutions
Reasoning at each node Repeat Reduce FD
domains Tighten linear relaxed cost bound Until
fixpoint
98
Linear and FD Constraints as Fixpoint Operators
99
Information Communicated from FD and Linear to
Search Engine
  • FD
  • Domain size
  • Number of active constraints
  • Linear
  • Relaxed solution
  • Reduced costs gt regret

100
Combining Linear and FD Horses for Courses
Problem Progressive Party Cabinet Assignment Set Partitioning
CP gt 5 mins 9.27 secs 64.68 secs
LP gt 5 mins gt 5 mins 0.18 secs
CP LP 91.5 secs 13.2 secs 0.71 secs
101
Overview
  • Motivations
  • From Problem to Solution
  • Solvers
  • Global Constructive Search Hybrids
  • Hybrids with Separate Search Routines
  • Mappings between Models
  • Hybrid Search

102
Hybridisation Forms with Separate Subproblem
Search Routines
Subproblem A
Subproblem B
Search Solver 1
Search Solver 2
103
Hybridisation using Nogoods
BSubmodel
ASubmodel
Nogood
Solution
Solver
Solver
Solution to subproblem A is infeasible for
subproblem B gt Add constraint to subproblem A
precluding similar solutions
104
Solver Requirements
  • Extract Minimal Cause of Conflict
  • General
  • Application-specific
  • Export Constraints
  • Treatable by solver A
  • Exclude current violation
  • Leave choice points if necessary
  • Disjunction of alternatives should not preclude
    any feasible solutions

105
Different Models in FD and Linear
Distances Table Data
X1 X2 X3 X4 X5 X6
X2
0 5 2 4 1 7
5 0 4 7 2 5
2 4 0 4 6 1
4 7 4 0 3 5
1 2 6 3 0 2
7 5 1 5 2 0
X1 X2 X3 X4 X5 X6
X1
X5
X4
Flow out of subset gt 1
X3
X6
TSP Problem Find shortest route
106
Hybrisation of FD and One-way solver using nogoods
Subproblem A Temporal Constraints
Subproblem B Resource Constraints
Nogood
Solution
Interval Solver
One-way Solver
107
ECLiPSe Repair library
  • Tentative Values
  • Vars tent_set Vals
  • Vars tent_get Vals
  • Conflict Sets
  • conflict_constraints(Cset,CCs)
  • conflict_vars(CVars,CCs)
  • Constraint Annotations
  • Constraint r_conflict Cset
  • Var tent_is Expression

108
Example Bridge Scheduling
  • Schedule tasks to build a bridge
  • Schedule consists of different tasks that share
    several resources
  • (eg. excavator, pile-driver)
  • Some tasks depend on others
  • Temporal Constraints
  • e.g time for concrete to set
  • Disjunctive resource constraints
  • pile-driver can only be used in one task at a
    time

109
The Bridge Scheduling Problem
T2
T1
T3
T4
T5
M1
M6
M5
M4
M3
M2
B6 S6
B1 S1
A1
A6
B4 S4
B5 S5
B2 S2
B3 S3
A5
A3
A4
A2
P1
P2
110
Bridge Scheduling Problem
No. Name Description
Duration Resource 1 PA
Beginning of project
0 - 2 A1
Excavation (abutment 1) 4
excavator 3 A2 Excavation
(pillar 1) 2
excavator 8 P1 Foundation
Piles 1 20
pile-driver 9 P2 Foundation
Piles 2 13
pile-driver 10 U1 Erection of
temporary housing 10
- 11 S1 Formwork (abutment 1)
8 carpentry 17
B1 Concrete Foundation (abut. 1)
1 concrete-mixer 23 AB1
Concrete Setting Time (abut 1) 1
- 29 M1 Masonry work
(abutment 1) 16
bricklaying 35 L Delivery of
preformed Bearers 2
crane 36 T1 Positioning (preformed
bearer 1) 12 crane 42
V1 Filling 1
15 caterpillar 46
PE End of Project
0 -
111
Temporal constraints on the Schedule
  • Precedence
  • before(Start1,Duration1,Start2)
  • Maximal delay
  • before(Start2,-Delay,Start1)

before(Start1,Duration1,Start2) - ic
(Start1 Duration1 lt Start2).
112
Resource Constraints
Machine
End
Start
D1
D2
D3
D4
D5
Tasks
noclash(S1,D1,S2,D2) - ic (S1gtS2D2). noclash(S
1,D1,S2,D2) - ic (S2gtS1D1).
113
Non-repair Search Labeling
before(S1,D,S2), noclash(S0,D0,S1,D1),
mylabeling(Starts) - ( foreach(S,Starts) do
mindomain(S,S) ).
114
Repair Search Probe Backtracking
before(S1,D,S2) noclash(S0,D0,S1,D1) r_conflict
cs
  • Tentative Values are earliest possible start
    times
  • They satisfy temporal constraints
  • They may violate resource constraints

tent_set_to_min(Vars) - ( foreach(Var,Vars),
foreach(Min,Mins) do mindomain(Var,Min) ),
Vars tent_set Mins.
115
A disjunctive constraint is in conflict
  • Probe can cause violation (overlap)

repair_label - conflict_vars(cs,CVs), tent_set_
to_min(CVs), conflict_constraints(cs,CCs), (
CCs -gt true CCs Constraint_, c
all(Constraint), Fix the constraint
create choice point tighten var bounds
repair_label ).
116
Repair Search Top level
  • Fix to tentative values after all conflicts
    resolved

minimize( ( repair_label, Starts tent_get
Starts ), End_date ).
117
Adding Multiples of Linear Constraints
A3 6X 9Y lt 21 B2 6X 12Y lt 24
(A) 2X 3Y lt 7 (B) 3X 6Y lt 12
A3B2 12X 21Y lt 45
Optimisation expression 12X 21Y
Optimum value 45
Dual values for
constraint A3
for constraint B2
118
Adding Multiples of Linear Constraints
A3 6X 9Y lt 24 B2 6X 12Y lt 20
(A) 2X 3Y lt 8 (B) 3X 6Y lt 10
A3B2 12X 21Y lt 44
Optimisation expression 12X 21Y
Optimum value 44
Dual values for
constraint A3
for constraint B2
119
Hybridisation Using Benders Decomposition
BSubmodel
ASubmodel
BendersCut
Solution
Solver computing duals
Solver
Solution to subproblem A is infeasible for
subproblem B gt Add Benders cut to subproblem A
precluding similar solutions
120
Hybridisation using Column Generation
A AllocateTasks
B Assign a resource
CostBound
ResourceAssignment
Solver
Solver computing duals
Solution to subproblem B is used to build
solutions to A gt Add cost bound focussing B on
useful assignments
121
Requirement
  • Access to Dual Values
  • Encapsulation of Hybridisation Technique
  • Automatic generation of Benders Cut/Column
  • Automatic imposition of cut/cost bound
  • Automatic detection of stopping condition
  • Handling of Numerical Instability
  • Automatic avoidance of looping
  • User hooks to control tailing off behaviour

122
Plug-and-play with Column Generation
1-Dimensional Cutting Stock Example
Stock Boards of length 17 Required 25
boards of length 3 20 boards of
length 5 15 boards of length
9 Minimise Wastage
123
Plug-and-play with Column Generation
  • - lib(ic), lib(colgen).
  • solve(Cost) -
  • Vars Threes,Fives,Nines, Vars 0..10,
  • 3Threes5Fives9Nines Used, Used lt
    17,
  • Waste 17-Used,
  • colgen (sum(Threes) gt 25),
  • colgen (sum(Fives) gt 20),
  • colgen (sum(Nines) gt 15),
  • minimize(my_solve(C,Vars), sum(Waste), Cost).

124
Plug-and-play with Column Generation
my_solve(C,Vars) - labeling(Vars),
colgen sol(C,Vars).
  • my_solve routine written by problem solver
  • Master problem dual automatically created by
    library
  • Dual cost constraint automatically added to
    subproblem

125
Overview
  • Motivations
  • From Problem to Solution
  • Solvers
  • Global Constructive Search Hybrids
  • Hybrids with Separate Search Routines
  • Mappings between Models
  • Hybrid Search

126
Logical Transformations
  • Conceptual Model
  • Decompose
  • Transform
  • Tighten
  • Link
  • Conceptual Model

127
Problem Decomposition
  • Send variables to different solvers
  • Send constraints to different solvers
  • Send to multiple solvers
  • Variables
  • Constraints

128
Linking Constraints to Solvers in ECLiPSe
  • - lib(ic).
  • solve(Digits) -
  • Digits S,E,N,D,M,O,R,Y,
  • integers(Digits),
  • ic (Digits 0..9),
  • ic alldifferent(Digits),
  • ic (S gt 1), ic (M gt 1),
  • ic (1000S 100E 10N D
  • 1000M 100O 10R E
  • 10000M 1000O 100N 10E Y),
  • labeling(Digits).

129
Requirement Generic Solver Interface
  • - lib(eplex).
  • solve(Digits) -
  • Digits S,E,N,D,M,O,R,Y,
  • eplex integers(Digits),
  • eplex (Digits 0..9),
  • alldifferent(0,9,Digits),
  • eplex (S gt 1), eplex (M gt 1),
  • eplex (1000S 100E 10N D
  • 1000M 100O 10R E
  • 10000M 1000O 100N 10E Y),
  • optimize(min(sum(Digits),_Min).

130
Mapping SENDMOREMONEY to both ic and eplex
  • - lib(ic), lib(eplex).
  • solve(Digits) -
  • Digits S,E,N,D,M,O,R,Y,
  • icintegers(Digits),
  • ic,eplex (Digits 0..9),
  • ic alldifferent(Digits),
  • ic,eplex (S gt 1), ic,eplex M gt 1,
  • ic,eplex (1000S 100E 10N D
  • 1000M 100O 10R E
  • 10000M 1000O 100N 10E
    Y),
  • eplex_solver_setup(min(sum(Digits)),_Min,
    ,0,inst),
  • labeling(Digits).

131
Logical Transformations
  • Conceptual Model
  • Decompose
  • Transform
  • Tighten
  • Link
  • Conceptual Model

132
Transform
  • Global constraints
  • e.g. turn a set of disjunctions into an atmost
  • Dual forms
  • e.g. Constraints -gt variables, variables -gt
    constraints
  • Manageable constraints
  • e.g. eliminate disjunctions
  • Separable subproblems
  • e.g. multiple resource scheduling problem -gt
    schedule each resource separately

133
A CLP(R) Model
solve(W,X,Y,Z) - imp(X,W), imp(Y,W),
two(X,Y,Z). imp(X,Y) - XltY. two(X,Y,Z) -
and(X,Y). two(X,Y,Z) - and(Y,Z). two(X,Y,Z) -
and(Z,X). and(X,Y) - Xgt1, Ygt1. ?-
solve(W,X,Y,Z), W0.
134
Removing Disjunction from a CLP Model
solve(W,X,Y,Z, B) - imp(X,W, B), imp(Y,W, B),
two(X,Y,Z, B). imp(X,Y, B) - XltY
2-2B. two(X,Y,Z, B) - B1,B2,B3
0..1, and(X,Y, B1), and(Y,Z, B2), and(Z,X,
B3), B1B2B3 gt B. and(X,Y, B) - X 2-2B gt
1, Y 2-2B gt 1. ?- solve(W,X,Y,Z, 1), W0.

solve(W,X,Y,Z) - imp(X,W), imp(Y,W),
two(X,Y,Z). imp(X,Y) - XltY. two(X,Y,Z) -
and(X,Y). two(X,Y,Z) - and(Y,Z). two(X,Y,Z) -
and(Z,X). and(X,Y) - Xgt1, Ygt1. ?-
solve(W,X,Y,Z), W0.
135
Removing Disjunction from a CLP(R) Model
  • Add boolean to all predicates
  • solve(W,X,Y,Z, B) - imp(X,W, B),
    imp(Y,W, B), two(X,Y,Z, B).
  • Call the goal with extra boolean1
  • ?- solve(W,X,Y,Z,1).
  • Add M(1-B) to inequations
  • imp(X,Y, B) - XltY 2-2B.
  • Replace disjunction with boolean inequations
  • two(X,Y,Z, B) -
  • B1,B2,B3 0..1,
  • and(X,Y, B1), and(Y,Z, B2), and(Z,X,
    B3),
  • B1B2B3 gt B.

136
Logical Transformations
  • Conceptual Model
  • Decompose
  • Transform
  • Tighten
  • Link
  • Conceptual Model

137
Tighten
  • By programmer
  • Experience
  • Maths
  • Automatically
  • Propagation
  • Intelligent methods

138
Redundant Constraints
  • Cover a mutilated chess board with dominoes

dominoes(List) - length(List,31),
foreach(D,List) do domino(D), guess(List).
domino(X-Y) - X,Y 2..63,
(Y X8) or guess(List) -
for(N,2,63), param(List) do
member(X-Y,List), (XN Y N).
Y X1
139
Redundant Constraints
  • Cover a mutilated chess board with dominoes

dominoes(List) - length(List,31),
foreach(D,List) do domino(D), guess(List).
bw(List,B,W), B30, W32, bw(,0,0).
bw(X-YT,B,W) - bw(T,BR,WR), B BR1, W
WR1.
140
Logical Transformations
  • Conceptual Model
  • Decompose
  • Transform
  • Tighten
  • Link
  • Conceptual Model

141
Link
  • Channeling constraints
  • Communicating intermediate solutions

142
Summary
Conceptual Model Add Constraint
Behaviour Add Search Design Model
143
Overview
  • Motivations
  • From Problem to Solution
  • Solvers
  • Global Constructive Search Hybrids
  • Hybrids with Separate Search Routines
  • Mappings between Models
  • Hybrid Search

144
Hybrid Search
  • Incomplete Constructive Search
  • Local Search
  • Hybrid Schemes
  • Current Framework

145
Incomplete Constructive Search - Labelling
  • Select a variable
  • Allocate credit to each value in the variables
    domain
  • Choose a value

Credit Based Search
Incoming Credit Allocated credit
16 8 4 2 1
1 0
146
Incomplete Constructive Search - Labelling
  • Select a variable
  • Allocate credit to each value in the variables
    domain
  • Choose a value

Best N
Incoming Credit Allocated credit
3 3 3 3 0
0 0
147
Incomplete Constructive Search - Labelling
  • Select a variable
  • Allocate credit to each value in the variables
    domain
  • Choose a value, and take its credit

Limited Discrepancy Search
Incoming Credit Allocated credit
2 2 1 0 0
0 0
148
Incomplete Constructive Search- Other
  • Step search
  • Xa v X ? a
  • 2-variable constraints
  • S1 S2D2 v S2 S1D1
  • Range splitting
  • X gt 4 v X 4

149
Based on Value Choice Heuristics
  • Problem-specific
  • N-queens middle-out
  • Relaxed solution
  • Linear relaxation
  • Tree relaxation
  • Relaxed local search (Kamarainen)
  • Previous solution
  • Limited Discrepancy Search
  • Only count a discrepancy when two heuristics agree

150
Local Search
  • Min conflicts
  • change a variable in conflict
  • (improves expected time to solve 2-SAT)
  • Guided Local Search
  • Escape from local opt. by penalising solution
    features
  • ? Can we change viewpoint so features are
    represented by new-variable assignments ?
  • ? Are feature variables also decision variables ?

151
Hybrid Schemes
  • MIP and Row Generation
  • Repair variables in conflict
  • Iterated search methods
  • Local search hybrids
  • Core/dependent variables
  • Large Neighbourhoods

152
MIP Bridge Scheduling
before(S1,D,S2), noclash(S0,D0,S1,D1), optimiz
e(End,Cost).
noclash(S1,D1,S2,D2) - eplexB1,B20..1,
eplexintegers(B1,B2),
eplex(S1M-B1MgtS2D2), eplex(S2M-B2MgtS1
D1), eplex(B1B2 gt 1)
Solve linear relaxation Find 0e lt Bool lt
1-e Branch on Bool lt 0 or Bool gt 1 effectively
branch on S2gtS1D1 or S1 gt S2D2
153
Hybrid Bridge Scheduling
  • Probe can cause violation (overlap)

repair_label - conflict_vars(CVs), tent_set_to_
min(CVs), conflict_constraints(cs,CCs), ( CCs
-gt true CCs Constraint_, call(
Constraint), Fix the constraint
create choice point affect probe
repair_label ).
154
A repair heuristic
  • Pick a constraint according to a heuristic

noclash(S0,D0,S1,D1) r_conflict cs -
tasks(Task0,Task1) select_constraint(TaskPairs,Se
lectedPair) - (
foreach(TaskPair,TaskPairs),
foreach(Key-TaskPair,KeyedCCs) do
TaskPair tasks( task with durationD0
, task with durationD1), Key is
min(D0,D1) ), sort(1,gt,KeyedCCs,_
- SelectedPair_).
155
Results MIP vs Hybrid LP Nodes
156
Exploring search spaces
partial assignments
  • Tree search
  • constructive (partial/total assignments)
  • systematic
  • complete or incomplete
  • Local search
  • move-based (only total assignments)
  • random or systematic
  • incomplete

157
A Tentative Assignment
  • The Conflict Region

Remaining Variables
Conflict Region of Violated Constraints
Changed Variables
158
Tree Search Employing Tentative Assignments
a
b
c
c
159
Search with Tentative Assignments
Initialise Decision Variables Constrain Decision
Variables Search for a Solution
Vars tent_set Vals
ltConsgt r_conflict a
search(a) - ( find_conflict( a, Var) -gt
search(a)
true ).
160
Local Search - algorithm template
  • local_search
  • set starting state
  • while global_condition
  • while local_condition
  • select a move
  • if acceptable
  • do the move
  • if new optimum
  • remember it
  • endwhile
  • set restart state
  • endwhile

161
Local Search instances
  • Algorithm parameters
  • starting (and restarting) state
  • global and local condition
  • possible moves and how to select one
  • when is a move accepted
  • Different parameters yield different algorithms
  • random walk
  • hill climbing
  • simulated annealing
  • tabu search
  • ... and many variants

162
Hill climbing
  • hill_climb(MaxTries, MaxIter, VarArr, Profit,
    Opt) -
  • init_tent_values(VarArr, 0),
    starting solution
  • (
  • for(I,1,MaxTries),
    global condition
  • fromto(0, Opt1, Opt4, Opt),
  • param(MaxIter,Profit,VarArr)
  • do
  • (
  • for(J,1,MaxIter),
    local condition
  • fromto(Opt1, Opt2, Opt3,
    Opt4),
  • param(I,VarArr,Profit)
  • do
  • Profit tent_get PrevProfit,
  • (
  • flip_random(VarArr),
    try a move
  • Profit tent_get
    CurrentProfit,
  • CurrentProfit gt
    PrevProfit, is it uphill?
  • conflict_constraints(cap
    ,) is it a solution?
  • -gt

163
Techniques used here
  • Move operation and acceptance test
  • They are within the condition part of the
    if-then-else construct, so
  • If the acceptance test fails (no solution or
    objective not improved) the move is automatically
    undone by backtracking!
  • Detecting solutions
  • Constraint satisfaction is checked by checking
    whether the conflict constraint set is empty
  • Monitoring cost/profit
  • Retrieve tentative value of Profit-variable
    before and after the move to check whether it is
    uphill
  • Since the move changes the tentative values of
    some variable(s), tent_is/2 will automatically
    update the Profit variable!

164
Auxiliaries used
  • Starting state
  • init_tent_values(VarArr, N) -
  • ( foreacharg(X,VarArr),param(N) do X tent_set N
    ).
  • Move operator (the most stupid one...)
  • flip_random(VarArr) -
  • functor(VarArr, _, N),
  • X is VarArrrandom mod N 1,
  • X tent_get Old,
  • New is xor(Old,1),
  • X tent_set New.

165
Interleaved Search Methods
  • Interleaved Construction and repair
  • 1) Construct a partial solution till no
    consistent extension
  • 2) Make this partial solution tentative
  • 3) Choose a value for the next variable
  • 4) Repair the tentative solution
  • Instances
  • Greedy construction local search repair
  • Weak commitment repair by constructive search
  • Iterated search retain completeness by
    distinguishing instantiated and repairable
    variables

166
From Local to Global
  • Local search on small set of driving variables
  • Constructive search to complete solution and cost
  • Move by unfixing part of solution
  • Create move by constructive search
  • Pesant best neighbour
  • Large neighbourhood search
  • Linear optimisation (Le Pape)

167
Current Framework
partial assignments
Move between (consistent) partial solutions Move
upwards by unfixing a variable Move downwards
by fixing a variable
Limitations of diagram Should go to ancestor
node Should rearrange tree after move
168
Current Framework
  • Unfix
  • Which variable?
  • What dependency information should be kept?
  • Fix
  • Which variable?
  • What propagation?
  • Move by unfixing and fixing
  • Can this successfully encompass complex moves,
    e.g.2-swaps?
  • Is there a viewpoint that makes this equivalent
    to unfixfix?

169
Summary
  • Separate Model from Solution
  • No
  • Separate Constraint Behaviour from Search
  • No
  • Bring together MP, CP and SSP
  • No
  • Consequence
  • Theres lots to be done ?
Write a Comment
User Comments (0)
About PowerShow.com