Skip to content

Instantly share code, notes, and snippets.

@wnoizumi
Created July 6, 2013 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wnoizumi/5940918 to your computer and use it in GitHub Desktop.
Save wnoizumi/5940918 to your computer and use it in GitHub Desktop.
lowerBound = MST
upperBound = todos os vértices conectados na raiz
G = (V, E)
e[] = sort(E) //as arestas serão usadas para particionar o espaço de soluções
bestSoFar = upperBound(G)
live[] = branch(e.dequeue()) //aqui gera as possibilidade: 1- com p0, 2 - sem p0
while Live not Empty and time < 1hour {
P = live.dequeue()
B = branch(P, e.dequeue())
for i in B {
LB(i) = lowerBound(i)
if LB(i) == S //is a feasible solution S
and S < bestSoFar {
bestSoFar = S
continue
}
if LB(i) >= bestSoFar {
stop branching in i
} else {
live.enqueue(branch(i))
}
}
}
return bestSoFar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment