Solving some instances of the two color problem Stefano Brocchi1 , Andrea Frosini1 , Simone Rinaldi2 1

Dipartimento di Sistemi e Informatica, Universit`a di Firenze 2 Dipartimento di Matematica, Universit` a di Siena

December 18, 2008

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

1 / 36

Discrete tomography

Goal: to reconstruct discrete sets from their projections

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

2 / 36

Motivations

Real world inspiration: electron beam techniques - QUANTITEM Many other problematics can be recunducted to discrete tomography I

Es. modeling of problems through discrete matrices

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

3 / 36

Typical problems

Typical problems concern I I I

Consistency: is there a matrix that satisfies the input constraints ? Reconstruction: rebuilding a matrix that solves the problem Uniqueness: is the solution of the problem unique ?

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

4 / 36

Constraints

Often various constraints are imposed on the studied discrete set I

I I

Connectiveness (Polyominoes): the studied set represents an only connected object Convexity: the searched set is convex in respect to various directions Other: problems modelled with discrete matrices can lead to any arbitrary constraint

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

5 / 36

The n color problems

Most basical family of problems defined in discrete tomography I I I I

Discrete set with cells of n different types (colors, atoms) Projections along parallel lines in various directions Known for each of them the number of cells of the given types No other constraint assumed on the discrete set

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

6 / 36

Known results

Known results I

I

For more than 2 projections, consistency and reconstruction are proved to be NP-complete even for only one atom Assumed 2 projections, usually ortogonal

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

7 / 36

Known results: 1 color

For one atom, complexity determined by Ryser Found necessary and sufficient conditions for consistency A simple greedy algorithm solves the reconstruction problem Usually no guarantee of uniqueness

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

8 / 36

Known results: more than 2 colors

For more than two atoms, problem is NP-hard Shown at first for 6 atoms (Gardner, Gritzmann, Prangenberg) and in the following for three or more (Chrobak and D¨ urr)

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

9 / 36

The two color problem

The only left undetetermined case in that of the two atoms Problem represents a boundary between easy and hard problems Determining complexity of an n atom problem gives results also about related problems

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

10 / 36

Definition of the problem

b , hr )) and V = ((v b , v r ), . . . , (v b , v r )) Input H = ((h1b , h1r ), . . . , (hm m n n 1 1 containing non negative integers

Task Find a matrix A = (ai,j ) such as ∀1 ≤ i ≤ m hix = |{ai,j : ai,j = x}| with 1 ≤ j ≤ n, and x ∈ {b, r }, and analogously, ∀1 ≤ j ≤ n vix = |{ai,j : ai,j = x}| with 1 ≤ i ≤ m, and x ∈ {b, r }.

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

11 / 36

A two colored matrix An example of a two colored matrix and its projections 2

2

1

3

0

2

3

2

1

2

2

1

2

3

1

1

2

2

2

2

3 2

Stefano Brocchi (DSI, Firenze)

2

3

0

3

1

Solving some two color problems

2

December 18, 2008

12 / 36

Our result

Consistency always satisfied if For all i, j, x we have 0 < hix , vjx ≤ M, where: I I

if m and n are both even, M = bmin{m, n}/3c; otherwise, M = bmin{m, n}/4c;

For two positive integers c1 , c2 and for all i, j we have hib = c1 , vjr = c2 The projection sums are consistent

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

13 / 36

Idea of the algorithm Given an efficient recunstruction algorithm The idea: decomposing the problem in 4 1-color problems

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

14 / 36

Idea of the algorithm Rarely decomposition is directly appliable The algorithm will also merge a limited number of cells in a subproblem relative to the opposite color

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

15 / 36

Intermediate results

Result is based on three subresults Definition of instances of 1-color that always allow a solution Theorem that defines some when inserting cells of a color in a partially filled matrix is possible Theorem about multiset partitioning

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

16 / 36

The one color problem

One color problem studied extensevely by Ryser We give an equivalent model confortable to us Studied what are the arrays H consistent with a given V

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

17 / 36

The maximal array of projections

Defined a poset on the possible projections for a given number of cells Array (k, k, . . . , k, k − 1, k − 1, . . . , k − 1) and its permutations are the maximal element of the poset Consistent with any other feasible projection array I

Beyond this result, the construction of this poset can be valuable for further studies

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

18 / 36

Cell insertion problem Input I

I I

A w × h matrix M with some cells of color 1 and others of color 0 (empty cells) In M there are at most w − c cells per row, for a fixed c A set of rows R such that |R| ≤ c

Problem Can we insert in the empty positions of M a red cell for each row in R such that there is at most a red cell for each column ? The given task always has a solution

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

19 / 36

The problem of multiset partitioning

Multiset S of positive integers with maximal value M Goal is to obtain a partition S 0 and S 00 of S such that I I

|S 0 | = b|S|/2c and |S 00 | = d|S|/2e The sums of the elements in S 0 and S 00 do not differ of more than M

We prove that the sets S 0 and S 00 always exists and can be found efficiently

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

20 / 36

The main algorithm The main algorithm (

Dipartimento di Sistemi e Informatica, Universit`a di Firenze 2 Dipartimento di Matematica, Universit` a di Siena

December 18, 2008

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

1 / 36

Discrete tomography

Goal: to reconstruct discrete sets from their projections

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

2 / 36

Motivations

Real world inspiration: electron beam techniques - QUANTITEM Many other problematics can be recunducted to discrete tomography I

Es. modeling of problems through discrete matrices

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

3 / 36

Typical problems

Typical problems concern I I I

Consistency: is there a matrix that satisfies the input constraints ? Reconstruction: rebuilding a matrix that solves the problem Uniqueness: is the solution of the problem unique ?

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

4 / 36

Constraints

Often various constraints are imposed on the studied discrete set I

I I

Connectiveness (Polyominoes): the studied set represents an only connected object Convexity: the searched set is convex in respect to various directions Other: problems modelled with discrete matrices can lead to any arbitrary constraint

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

5 / 36

The n color problems

Most basical family of problems defined in discrete tomography I I I I

Discrete set with cells of n different types (colors, atoms) Projections along parallel lines in various directions Known for each of them the number of cells of the given types No other constraint assumed on the discrete set

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

6 / 36

Known results

Known results I

I

For more than 2 projections, consistency and reconstruction are proved to be NP-complete even for only one atom Assumed 2 projections, usually ortogonal

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

7 / 36

Known results: 1 color

For one atom, complexity determined by Ryser Found necessary and sufficient conditions for consistency A simple greedy algorithm solves the reconstruction problem Usually no guarantee of uniqueness

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

8 / 36

Known results: more than 2 colors

For more than two atoms, problem is NP-hard Shown at first for 6 atoms (Gardner, Gritzmann, Prangenberg) and in the following for three or more (Chrobak and D¨ urr)

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

9 / 36

The two color problem

The only left undetetermined case in that of the two atoms Problem represents a boundary between easy and hard problems Determining complexity of an n atom problem gives results also about related problems

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

10 / 36

Definition of the problem

b , hr )) and V = ((v b , v r ), . . . , (v b , v r )) Input H = ((h1b , h1r ), . . . , (hm m n n 1 1 containing non negative integers

Task Find a matrix A = (ai,j ) such as ∀1 ≤ i ≤ m hix = |{ai,j : ai,j = x}| with 1 ≤ j ≤ n, and x ∈ {b, r }, and analogously, ∀1 ≤ j ≤ n vix = |{ai,j : ai,j = x}| with 1 ≤ i ≤ m, and x ∈ {b, r }.

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

11 / 36

A two colored matrix An example of a two colored matrix and its projections 2

2

1

3

0

2

3

2

1

2

2

1

2

3

1

1

2

2

2

2

3 2

Stefano Brocchi (DSI, Firenze)

2

3

0

3

1

Solving some two color problems

2

December 18, 2008

12 / 36

Our result

Consistency always satisfied if For all i, j, x we have 0 < hix , vjx ≤ M, where: I I

if m and n are both even, M = bmin{m, n}/3c; otherwise, M = bmin{m, n}/4c;

For two positive integers c1 , c2 and for all i, j we have hib = c1 , vjr = c2 The projection sums are consistent

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

13 / 36

Idea of the algorithm Given an efficient recunstruction algorithm The idea: decomposing the problem in 4 1-color problems

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

14 / 36

Idea of the algorithm Rarely decomposition is directly appliable The algorithm will also merge a limited number of cells in a subproblem relative to the opposite color

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

15 / 36

Intermediate results

Result is based on three subresults Definition of instances of 1-color that always allow a solution Theorem that defines some when inserting cells of a color in a partially filled matrix is possible Theorem about multiset partitioning

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

16 / 36

The one color problem

One color problem studied extensevely by Ryser We give an equivalent model confortable to us Studied what are the arrays H consistent with a given V

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

17 / 36

The maximal array of projections

Defined a poset on the possible projections for a given number of cells Array (k, k, . . . , k, k − 1, k − 1, . . . , k − 1) and its permutations are the maximal element of the poset Consistent with any other feasible projection array I

Beyond this result, the construction of this poset can be valuable for further studies

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

18 / 36

Cell insertion problem Input I

I I

A w × h matrix M with some cells of color 1 and others of color 0 (empty cells) In M there are at most w − c cells per row, for a fixed c A set of rows R such that |R| ≤ c

Problem Can we insert in the empty positions of M a red cell for each row in R such that there is at most a red cell for each column ? The given task always has a solution

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

19 / 36

The problem of multiset partitioning

Multiset S of positive integers with maximal value M Goal is to obtain a partition S 0 and S 00 of S such that I I

|S 0 | = b|S|/2c and |S 00 | = d|S|/2e The sums of the elements in S 0 and S 00 do not differ of more than M

We prove that the sets S 0 and S 00 always exists and can be found efficiently

Stefano Brocchi (DSI, Firenze)

Solving some two color problems

December 18, 2008

20 / 36

The main algorithm The main algorithm (