Constraint Programming Research at York 1. Modelling 2. Symmetry Breaking 3. SAT 4. Applications...

Post on 03-Jan-2016

217 views 1 download

Transcript of Constraint Programming Research at York 1. Modelling 2. Symmetry Breaking 3. SAT 4. Applications...

Constraint Programming Researchat York

1. Modelling2. Symmetry Breaking3. SAT4. Applications

• Allocating orders to steel slabs in a steel mill• Distribution with Wagner-Whitin costs• Allocating grid resources

What is Constraint Programming?

• Solve a combinatorial (optimisation) problem by– Mapping it to the finite-domain constraint satisfaction problem

(modelling)• Characterise problem by a set of constraints that a solution must satisfy

• For optimisation, include an objective function

– Solving the constraint satisfaction problem

• Useful for solving a wide range of important, complex problems including scheduling, allocation, layout and configuration problems.

Research on Modelling

Modelling Bottleneck

• Modelling a problem as a constraint program requires moderate/great expertise.

• Hence constraint technology is used almost exclusively by large enterprises on problems with large payoff.

Reducing the Modelling Bottleneck

• Systematise the knowledge of the expert.– 2 to 3 years: We have been building models more and

more systematically

• Embed this knowledge in a “compiler” that can reformulate a high-level problem specification into a set of constraints that can be executed efficiently using existing toolkits.– CONJURE

CONJURE

Automated Model Generation

• Given an abstract formal problem specification, in ESSENCE

• Generates a set of correct models– Should include good models generated by experts

– These models are in ESSENCE', a subset of ESSENCE

that is similar to what is provided by existing constraint toolkits

ESSENCE

– Must be at a level of abstraction above that at which modelling decisions are made

Distinguishing Features of ESSENCE

• Many types of non-atomic decision variablesSets, multisets, partitions, tuples, functions,

relations…

• Decision variables of arbitrarily-nested typesSet of 1..nSet of set of 1..n

Multiset of set of set of 1..n

• Quantification over decision variablesForall x in S … where S is a decision var of type set

• Type of unnamed elements

Generating Good Models Involves

1. Representing complex decision variables.

2. Identifying and breaking symmetries.

3. Exploiting channelling.

4. Performing transformations.

CONJURE is specificied by a set of compositional refinement rules and can perform 1 -- 3.

Expected Benefits of this Research

• Rigorous account of model generation– Make study of modelling more systematic– Reveal gaps in understanding– Guide study of model selection by identifying decision

points and available alternatives– Useful for teaching, presenting, cataloguing

• Formal account of model generation– Generator: CONJURE

– Proof checker– Major step towards automated entire modelling process

Research on Symmetry Breaking

Symmetry in Constraint Models

• Symmetry in a model results in symmetry in the search space of partial assignments to variables.

• Example: Find 3 natural numbers that sum to 9– X +Y + Z = 9– {X2, Y8}, {X8, Y2} are symmetric

• Enormous speed-ups can be obtained if symmetric parts of the search space can be avoided.

Symmetry-Breaking Constraints

• Add constraints to the model to rule out some, but not all, symmetrical assignments– To X + Y + Z = 9

add the constraint X Y Z

Row and Column Symmetry

• Many models use matrices of decision variables.

• These often have row and/or column symmetry

Row symmetry: swap any two rows and a solution stays a solution

Column symmetry: swap any two cols and a solution stays a solution

• We have identified and analysed several symmetry-breaking constraints and have implemented efficient propagation algorithms for them.

Allocating a Divisible Resource:An Application to Grid Computing

Alan M. Frisch Artificial Intelligence Group

Dept. Computer Science

University of York

In collaboration with:

Mark Bartlett (York), Youssef Hamadi (MSR),

Ian Miguel (St. Andrews), Chris Unsworth (Glasgow)

Introduction

• Effective use of grid computing will require efficient methods to solve a variety of combinatorial problems, such as:• Resource allocation,• Configuration, and• Scheduling.

• This talk considers the allocation of a divisible resource (e.g. bandwidth) via advanced reservations.

Introduction

• Given bids for quantities of the resource, each offering a price:• Accept a subset of the bids that can be fulfilled and

maximises revenue.

• This talk presents methods for solving realistic instances of this problem in batch mode.

• Concludes with discussion of a dynamic setting.

• Given:– A finite set of times totally ordered by – Along with each time t, capacity(t), a positive integer– A finite set of bids– Along with each bid b

• price(b), bw(b), two positive integers

• duration(b), a non-empty interval of times

• Find: a set accept bids

• Such that: t times bw(b) capacity(t)

Temporal Knapsack Problem (TKP)

b accept|t duration(b)

• Maximising: price(b)b accept

Sample Instance of TKP

Bid3: 5 units, £20

t2 t3 t4 t5t1

Uniform Capacity: 10

Bid2: 6 units, £10Bid1: 6 units, £11

t2 t3 t4 t5t1

Bid2: 6 units, £10Bid1: 6 units, £11

Solution: Objective Fn = £21

TKP Generalises Knapsack• Every instance of Knapsack is an instance of TKP in which |times| = 1.• Hence TKP is NP-hard. (Easy to see that TKP is NP-easy)

Multi-dimensional Knapsack (MDK) generalises TKP

• Multi-dimensional knapsack– each item has n-dimensional vector as its size – knapsack has n-dimensional vector as its capacity– sum of sizes of items in knapsack cannot exceed capacity of knapsack

• Every instance of TKP is an instance of MDK in which every item has size of form (0 … 0 bw … bw 0 … 0)

TKP Reduces toInteger Linear Programming

Bid3: 5 units, £20

t2 t3 t4 t5t1

Uniform Capacity: 10

Bid2: 6 units, £10Bid1: 6 units, £11

Maximise: Xb price(b)b bids

Subject to:

b Xb in {0,1}

6X2 6X2+ 5X3

5X3 6X1 + 5X3

6X1

Solving the TKP

• Decomposition algorithm

• Greedy Algorithm

• Integer Linear Programming

Decomposition Algorithm

Decomposition Algorithm

• Makes use of four operations:• Forced rejection of bids.• Remove times (can lead to forced acceptance).• Split into independent sub-problems.• Branch on accept/reject a bid.

• These operations are composed into a branch and bound search for optimal solutions.

Forced Reject

• If at any time during the interval required by a bid, available bandwidth is less than that requested, bid rejected.

10 units required.Bid:

AvailableCapacity:

105

t1 t2 t3 t4 t5 t6 t7 t8 t9

Remove Times

Bid3: 5 units

t5 t6 t6 t7 t8 t9 t10 t11 t12t1 t2 t3 t4

Capacity: 10

Demand:

Bid2: 6 unitsBid1: 6 units

t5 t8

56

6• Problem reduced to important decision points.

Remove Times Forced Accept

Bid3: 5 units

t5 t6 t6 t7 t8 t9 t10 t11 t12t1 t2 t3 t4

Capacity: 10

Demand:

Bid2: 6 unitsBid1: 4 units

t4 t5

56 • Bid1 Accepted.

Split

• Can solve independently, combine solutions.

Bid3: 5 units

t5 t6 t6 t7 t8 t9 t10 t11 t12t1 t2 t3 t4

Bid2: 6 unitsBid1: 6 units

t5t1 t2 t3 t4

Bid2: 6 units

Bid3: 5 units

t6 t6 t7 t8 t9 t10 t11 t12

Bid1: 6 unitsAND

Branch

t5 t8

56

6

t5 t8

66

Capacity 10Demand 11

t5 t8

66

Reject Bid3Accept Bid3 OR

Demand 6Capacity 5

Capacity 10Demand 6

Interaction: Example

• Bid 1: Forced reject.

Bid2: 5 units

t5 t6 t6 t7 t8 t9t1 t2 t3 t4

Bid1: 6 units

Capacity:Demand:

Interaction: Example

• Times removed. So bid 2 accepted.

Bid2: 5 units

t5 t6 t6 t7 t8 t9t1 t2 t3 t4

Capacity:

Demand:

Reduce• Instance of TKP reduced if:

• Contains no forced rejects.• Demand(t) > capacity(t) for all times t.• Reduce operation:

• Forall b bids TestForcedReject(b).

• Forall t times TestRemoveTime(t).

TestForcedReject(b:bid) if exists t duration(b) s.t. bw(b) > capacity(t) then Reject(b)

TestRemoveTime(t:time) if demand(t) capacity(t) then RemoveTime(t)

Decomposition Algorithm: Initialisation(P)

• Reduce(P)

• Split P into set of problems S.

• Foreach s S, Solve(s).

Decomposition Algorithm: Solve(P)

• If no bids, return.

• Select a bid b from bids.

• Branch on:1. Reject(b) then Reduce(P).

Split(P) into set of problems S.

Foreach s S, Solve(s).

2. Accept(b) then Reduce(P).

Split(P) into set of problems S.

Foreach s S, Solve(s).

Smarter Problem Reduction

• ReduceAfterReject(P, b).• Forall t duration(b), TestRemoveTime(t).

• ReduceAfterAccept(P, b).• Forall b’ bids s.t duration(b) overlaps duration(b’).

• TestForcedReject(b’).

• Let R be set of bids rejected in previous step.• Forall b’ R, Forall t b’ TestRemoveTime(t).

Selecting Bid to Branch on

• Of many availabile strategies, we have tried– Highest Price Order (in experiments)– Highest bandwidth x length

• encourages decomposition

• Slightly slower than previous (limited experiments)

– Next: Select to force decompositions

AND/OR Search Space

• Decomposition requires AND/OR search.

• To optimise, must also perform branch and bound.

Decomposition: AND node.Accept/Reject branch:OR nodes

etc etc

Search Strategy• Currently use AO*

– Only uses upper bounds (simplistic method)– Optimal in that it expands fewest possible nodes for any given upper-bound method– Uses too much memory

• Next: Get good upper bounds through linear relaxation and cuts• Next we will consider other Branch & Bound search algorithms (upper and lower bounds)

– First: depth first– Then: algorithms that exploit bounded memory

Greedy Algorithm

Greedy Algorithm: Properties

• Guaranteed to terminate with a solution quickly.• Low polynomial time.

• Not guaranteed to find optimal solution.

Greedy Algorithm: Stage 1Forall t times While (capacity(t) < demand(t)) let b be a minimal rate bid in {b’|t duration(b’)} Reject(b)

Rate(b) = price(b)/(bw(b) |duration(b)|)

Greedy Algorithm: Stage 2

Let R be set of bids rejected in Stage 1Foreach b R selected in descending order of rate if forall t duration(b): capacity(t)-demand(t) > bw(t) then put b back into bids.Accept all bids.

Performance

Generating Random Instances

• Given parameters: max-rate, number of bids

• Allocate resources for a period of one month. Granularity of 15 minutes, gives 2,880 times.

• Start time of each bid: uniform random [1, 2880]

• Duration of each bid: uniform random [1, 100]

• Bandwidth of each bid: uniform random [1, 50]

• Rate of each bid: uniform random [1, max-rate]

• Price and end time of each bid derived from above.

Solution Quality of Greedy

Time to Solution

Integer Programming

• Not thoroughly tested, in particular not on hardest instances.

• On test instances tried it is very fast.

Ongoing and Future Work

Ongoing Work on Batch Problem

• Improve decomposition algorithm as described• Get more realistic test data.• Generation of more varied random instances, including

some very hard instnaces• More realistic model of Grid allocation.

• Suggestions solicited!

Dynamic Operating Environment

• Assume time-points separated by 30-min intervals.

• Initially:• Have a set of bids as usual.• Assume start time of each bid > t• Produce a solution within 30 mins.

t

Dynamic Operating Environment

• At time t+1, may receive new bids.• New problem depends on operating conditions.• Commit Deadline:

• Bids have a deadline by which must commit to accept/reject.• Can reconsider any bid prior to commit deadline.• Problem at t+1:

• New bids• Bids at t that haven’t reached their deadline.

• NB Can vary price with deadline.

t+1

Dynamic Operating Environment

• At time t+1, may receive new bids.

• New problem depends on operating conditions.

• Throw-out Penalty:• Might throw out an accepted bid by taking a penalty.• Problem at t+1:

• New bids

• Bids at t that haven’t begun to execute.

t+1

TKP in ESSENCEGiven: times: set of Int capacity: times -> Nat Bids: enumerated price, bw: Bids -> Nat duration: Interval of times????Find: accept: set of Bids

Such that: t times bw(b) capacity(t)

Maximising: price(b)

b bids|t duration(b)

b accept

Solutions Anytime

• When time limited, want guarantee that a solution can always be returned (even if sub-optimal).

• Given extra time, solution quality should improve.

1st Decomposition node.

Solve each of these sub-problems once.Gives a first (probably sub-optimal) solution.Go back and solve each sub-problem to optimality.

Heuristics

• At an OR node:• Select a bid. Which?• Must try both accept and reject. Which first?

Decomposition: AND node.Accept/Reject branch:OR nodes