IBM HRL template

Stocs – A Stochastic CSP Solver
Bella Dubrov
IBM Haifa Research Lab
© Copyright IBM
IBM Haifa Research Lab
Outline
 CSP solving algorithms
 Systematic
 Stochastic
 Limitations of systematic methods
 Stochastic approach
 Stocs algorithm
 Stocs challenges
 Summary
2
Copyright IBM
IBM Haifa Research Lab
Constraint satisfaction problems
 Variables: Anna, Beth, Cory, Dave
 Domains: Red, Green, Orange, Yellow houses
 Constraints:
 The Red and Green houses are in the city
 The Orange and Yellow houses are in the
countryside
 The Red and Green houses are neighboring, as
well as the Orange and Yellow houses
 Anna and Dave have dogs, Beth owns a cat
 Dogs and cats cannot be neighbors
 Dogs must live in the countryside
 Solution:
 Anna lives in the Orange house, Beth lives in the
Red house, Cory lives in the Green house, Dave
lives in the Yellow house
3
Copyright IBM
IBM Haifa Research Lab
CSP Solving algorithms
Systematic: GEC
Stochastic: Stocs
4
Copyright IBM
IBM Haifa Research Lab
Systematic approach
 Systematically go over the search space
 Use pruning whenever possible
 pruning is done by projection
5
Copyright IBM
IBM Haifa Research Lab
Example: projector for multiply
axb=c
a є [2, 20], b є [3, 20], c є [1, 20]
Projection to input 1
a’ = [2, 6]
Projection to input 2
b’ = [3, 10]
Projection to result
c’ = {6, 8, 9, 10, 12, 14, 15, 16, 18, 20}
6
Copyright IBM
IBM Haifa Research Lab
Limitations of systematic methods: example 1
a, b, c  0,..., N  1
a *b  c
Propagation is hard (factoring)
7
Copyright IBM
IBM Haifa Research Lab
Limitations of systematic methods: example 2
 The Some-Different constraint: given a graph on the variables, the
variables connected by an edge must have different values
 Propagation is NP-hard for domains of size k > 3 (k-colorability)
8
Copyright IBM
IBM Haifa Research Lab
Limitations of systematic methods: example 3
a, b, c  0,..., N  1
1. a  0  b  0
2. a  0  c  0
3. b  0  c  0
Only solution:
a  1, b  c  0
4. c  0  a  1
 Local consistency at onset  probability of success: 1/N
9
Copyright IBM
IBM Haifa Research Lab
Stochastic approach
 State: an assignment of values to all the variables
 Cost: a function from the set of states to {0} U R+
Cost = 0 iff all constraints are satisfied by the state
10
Copyright IBM
IBM Haifa Research Lab
Stochastic approach
 General idea:
Start from some state
Find the next state and move there
Stop if a state with cost 0 is found
 Stochastic algorithms are usually incomplete
 Different stochastic algorithms use different heuristics for finding the
next state
 Examples:
Simulated annealing
Tabu search
11
Copyright IBM
IBM Haifa Research Lab
Stocs algorithm overview
 Check states on length-scales “typical” for the problem. Hop to a new state if
cost is lower
Learn the topography of the problem: learn the typical step sizes and
directions
Get domain-knowledge as input strategies
12
Copyright IBM
IBM Haifa Research Lab
Example: Social Golfer Problem
13
Social Golfer Problem (7-6-4)
10000
Number of Successes
 Problem:
7 groups of players
6 members in each group
Play 4 weeks
Without any two players playing
together (in the same group) twice
 Exponential decrease
No sense in trying step sizes
larger than 20.
But may benefit strongly from step
sizes of 10-15
 Reproducible - characterizes the
problem
1000
100
10
1
0
10
20
30
40
50
Step Size
4.6 million tries
4.7 million tries
93 million tries
Copyright IBM
IBM Haifa Research Lab
Example: LABS
Low Autocorrelation Binary Squence (N = 45)
100000
Number of Successes
 Problem:
Minimize the autocorrelation
on a sequence of N (45) bits
 Non-exponential decrease,
followed by saturation
Makes sense to always try
large steps
 Identifies small characteristic
features
 Extremely reproducible
10000
1000
0
10
20
30
40
50
Step Size
77 million tries
14
77 million tries
Copyright IBM
IBM Haifa Research Lab
Example: Selection Problem
Selection Problem (40,30)
10000
Number of
Successes
 Problem:
Select different values for
three variables out of a given
set of values (smaller than
domains)
Easy problem: results are
for many runs
 Prefer larger step sizes
(up to a cutoff)
 Reproducible
1000
100
10
1
0
1000
1500
Step Size
1.5 million tries
15
500
1.5 million tries
3.3 million tries
Copyright IBM
IBM Haifa Research Lab
Example: Selection Problem, different modeling
Selection Problem (4,3)
10000000
Number of
Successes
 Problem:
Same as before, modeled
differently
 Prefer intermediate step sizes
 Reproducible
1000000
100000
10000
0
2
4
6
8
10
12
14
Step Size
n tries
16
n tries
m tries
Copyright IBM
IBM Haifa Research Lab
Stocs algorithm
At each step:
decide attempt type: random, learned or user-defined
if random:
choose a random step
if learned:
decide learn-type: step-size, direction, …
if step-size:
choose a step-size which was previously successful (weighted)
create a random attempt with chosen step size
if direction:
choose a direction which was previously successful (weighted)
create a random attempt with chosen direction
if user-defined:
get next user-defined attempt
17
Copyright IBM
IBM Haifa Research Lab
Optimization problems
 Constraints must be satisfied
 In addition, an objective function that should be optimized is given
 Example: doll houses
 Constraints as before
 In addition each doll has a preferred set of houses
 The best solution satisfies as much of the preferences as possible
18
Copyright IBM
IBM Haifa Research Lab
Optimization with Stocs
 Last year we added the optimization capability to Stocs
 Optimization is natural for Stocs:
 First find a solution
 Then keep searching for a better state
 Implementation:
 Cost function from a state to a pair of non-negative numbers (c1, c2):
 c1 is the cost of the constraints
 c2 is the value of the objective function
 lexicographic order on the pairs:
 a better state will always improve the constraints
 after a state with c1 = 0 is found, Stocs will continue searching for
a better c2
19
Copyright IBM
IBM Haifa Research Lab
Preprocessing and initialization
 Before starting the search 2 things happen:
 Preprocessing of the problem
 including:
 finding bits that should be constant in any solution
 removing unnecessary variables
 simplifying constraints
 has a big impact on the search:
 last year we improved the performance by a factor of 100 with
preprocessing
 Initialization: finding the initial state
 Starting the search at a good state is critical
 Currently, each constraint tries to initialize its variables to a satisfying
assignment, considering the “wishes” of other constraints
20
Copyright IBM
IBM Haifa Research Lab
Summary






21
Limitations of systematic methods
Stochastic approach: move between full assignments
Stocs: learn the topography of the problem, allow user-defined heuristics
Optimization with Stocs
Preprocessing and initialization
Variable types
Copyright IBM
IBM Haifa Research Lab
Thank you
22
Copyright IBM