Finding minimum cut-sets between bounded subgraphs

佐手、 提交于 2019-12-04 19:15:27

问题


If a game map is partitioned into subgraphs, how to minimize edges between subgraphs?

I have a problem, Im trying to make A* searches through a grid based game like pacman or sokoban, but i need to find "enclosures". What do i mean by enclosures? subgraphs with as few cut edges as possible given a maximum size and minimum size for number of vertices for each subgraph that act as a soft constraints.
Alternatively you could say i am looking to find bridges between subgraphs, but its generally the same problem.


Example

Gridbased gamemap example http://dl.dropbox.com/u/1029671/map1.jpg

Given a game that looks like this, what i want to do is find enclosures so that i can properly find entrances to them and thus get a good heuristic for reaching vertices inside these enclosures.

alt text http://dl.dropbox.com/u/1029671/map.jpg

So what i want is to find these colored regions on any given map.


My Motivation

The reason for me bothering to do this and not just staying content with the performance of a simple manhattan distance heuristic is that an enclosure heuristic can give more optimal results and i would not have to actually do the A* to get some proper distance calculations and also for later adding competitive blocking of opponents within these enclosures when playing sokoban type games. Also the enclosure heuristic can be used for a minimax approach to finding goal vertices more properly.

Possible solution

A possible solution to the problem is the Kernighan Lin algorithm :

function Kernighan-Lin(G(V,E)):
  determine a balanced initial partition of the nodes into sets A and B
  do
     A1 := A; B1 := B
     compute D values for all a in A1 and b in B1
     for (i := 1 to |V|/2)
      find a[i] from A1 and b[i] from B1, such that g[i] = D[a[i]] + D[b[i]] - 2*c[a][b] is maximal
      move a[i] to B1 and b[i] to A1
      remove a[i] and b[i] from further consideration in this pass
      update D values for the elements of A1 = A1 / a[i] and B1 = B1 / b[i]
    end for
    find k which maximizes g_max, the sum of g[1],...,g[k]
    if (g_max > 0) then
       Exchange a[1],a[2],...,a[k] with b[1],b[2],...,b[k]
 until (g_max <= 0)
 return G(V,E)

My problem with this algorithm is its runtime at O(n^2 * lg(n)), i am thinking of limiting the nodes in A1 and B1 to the border of each subgraph to reduce the amount of work done.

I also dont understand the c[a][b] cost in the algorithm, if a and b do not have an edge between them is the cost assumed to be 0 or infinity, or should i create an edge based on some heuristic.

Do you know what c[a][b] is supposed to be when there is no edge between a and b? Do you think my problem is suitable to use a multi level method? Why or why not? Do you have a good idea for how to reduce the work done with the kernighan-lin algorithm for my problem?


回答1:


Not sure of the question, but perhaps you can use the max-flow/min-cut duality.

There are specialized and efficient algorithms for the max-flow that you can use to solve the primal.

You then need to obtain the dual solution using the technique described here.

PS: let me know if you need help with Operations Research jargon.




回答2:


Maybe have a look at this link on Wikipedia for further reading.

The graph partitioning problem in mathematics consists of dividing a graph into pieces, such that the pieces are of about the same size and there are few connections between the pieces.

Graph Partition



来源:https://stackoverflow.com/questions/2583977/finding-minimum-cut-sets-between-bounded-subgraphs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!