Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Блог пользователя tom

Автор tom, история, 9 лет назад, По-английски

Hello,

I'm solving problem with 2-SAT algorithm and I need to be sure that some xi will be 1 (or 0). How can I make this happen with 2SAT algorithm? When I add "xi or xi", I put xi and not xi into one SCC and 2-SAT returns me that there is no solution. Is it possible?

Thanks

  • Проголосовать: нравится
  • +13
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится +18 Проголосовать: не нравится

when you add x or x you shouldn't put them in one SCC. because you are adding 2 same sdges.

»
9 лет назад, # |
  Проголосовать: нравится +18 Проголосовать: не нравится

If you want to force x_i to be true just add implication !x_i -> x_i.

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

It's simple: BFS over the 2-SAT graph (the skew-symmetric one) from the fixed variables while checking for contradictions. When it finishes, there will be no edge from a known variable to an unknown one. The skew-symmetricity makes sure that there's no unfixed variable from which a fixed variable can be reached afterwards, so any solution of the unfixed part of the graph + the variables you fixed this way is a solution of the original problem.