1

suppose there are many testcase specified by capital letter, the letters in one bracket mean these are equal testcases. And I want the smallest set X of letters. But there is not transitive relation for the equal testcases. That is, (A,B) (A,D) could not get (B,D).

so,when input is: (A,B) (A,C) (A,D) (E) obviously the output should be (A,E) not (B,C,D,E)

when input is: (A,B) (A,C) (A,D) (B,E) (C,F) (D,G) in this case output should be (B,C,D) not (A,E,F.G).

when input is (A,B,C) (B,D) (C,D) the output is either (B,C) or (A,D).

Thank you a lot.

林子洋
  • 13
  • 3
  • 2
    Can you clarify what you actually want here? I'm interpreting this as: you have a bunch of pairs of letters, and you want the smallest set X of letters such that every pair contains at least one letter in X. Is that correct? – charleyc Feb 03 '13 at 06:42
  • Yes, I want the smallest set X of letters. – 林子洋 Feb 03 '13 at 06:48
  • 1
    That's the [vertex cover](http://en.wikipedia.org/wiki/Vertex_cover) problem. It's NP-hard. – charleyc Feb 03 '13 at 06:49
  • I am trying to Google it. And can you tell me if there's global optimized solution exist. – 林子洋 Feb 03 '13 at 06:54
  • Oh, but there may have many letters in one bracket, so it is still a NP hard? – 林子洋 Feb 03 '13 at 07:04
  • The general problem posed is NP-hard. There will be cases where it is analytically obvious what the solution is but that doesn't change the problem class which is to do with finding algorithmic solutions. – m.brindley Feb 03 '13 at 07:25
  • Just a side note: the example you gave for transitivity actually isn't transitivity (assuming the pairs are ordered). (A,B) & (B,C) => (A,C) is transitivity. Also, if you say the letters denote equality, but the relation isn't transitive, that is a contradiction since equality is transitive. – G. Bach Feb 03 '13 at 17:27

1 Answers1

1

This is an optimization problem that can be formulated for a branch and bound solution. See this: http://www.sce.carleton.ca/faculty/chinneck/po/Chapter12.pdf

jurgenreza
  • 5,856
  • 2
  • 25
  • 37