The Wavefunction Collapse Algorithm Explained
robertheaton.com
robertheaton.com
https://inst.eecs.berkeley.edu/~cs188/fa18/assets/notes/n2.p...
I really can't see how this isn't "wavefunction collapse" and is rather just, "search."
But I feel like I must be missing something. If this isn't right, can someone explain to me why it's not right?
I’ve been wanting to work on a 2d game world generated off similar constraint algorithms. But also allow some tiles with high entropy states to be able to occasionally “flip” and propagate around, thus changing the world dynamically as you’re walking around.
And I shall name it Wave Function Collapse since it’s clearly not controversial.
This sort of loose analogy is a perfectly reasonable way to name things IMHO.
I don't hear anyone complaining that bubble sort doesn't consider buoyancy and surface tension, or that the flood fill algorithm doesn't involve any actual fuid dynamics.
I have my own theory on why people like to complain about this particular analogy, but for the sake of not causing offence I will leave it there ;p
Bubbles aren't cool, so bubble sort must be rightly chided. /s
Quantum physics? Now that's cool, regardless of how much one knows about it.
I don't think the reason gets much deeper than that, barring any disagreements that it is just plain misleading.
I guess you could argue to some degree that a name should be usefully informative to an outsider or newbie. But that doesn't really apply to things that have already established their cool factor, like 'deep learning', 'crypto', 'agile', 'serverless', etc..
You could say the same about bubble sort or whatever, sure, and a case might have been made about the name when it was first introduced, but now they’re established names where “bubble sort” are good search terms that will help you find lots of information about the algorithm, but “Wavefunction collapse” isn’t a widely used algorithm and the name has a lot of existing publications that are not related (because they’re to do with actual quantum physics, not this algorithm). Even searching “wavefunctoin collapse algorithm”, when I last did it, only found quantum physics result (that seems to have changed though, as I just did a google search and the entire first page is about this algorithm, but I see most of the results are quite recent: within the last few months)
I think you've answered your own question. I don't know how long this has been around and I'm not sure how long people have been calling it this. Regardless of any of that, it is now getting a name and recognition under that name. The world changes, and you're seeing a little of that here.
On a related note, I wrote some code to take a piece of music and output guitar TAB. I'd print a number on every string where it was playable, and this left me to manually search for optimal fingerings (some notes have 5 or 6 options). Wave Function Collapse is exactly the type of thing I had been trying to devise to reduce the TAB to something easy to play. You could even change the constraints for different picking styles.
The WFC algorithm itself is very interesting to me and now that I can find more information and code, I’m eagerly planning to play with t myself in the coming weeks. :)
[1] https://www.amazon.com/War-Art-Through-Creative-Battles/dp/1...
In other words, this isn't actually a superposition. You could definitely say there's entropy involved, but really this is replacing the word "uncertainty" with "superposition." If you do that, an extraordinary number of algorithms suddenly fit the template of wave function collapse. Basically anything that has a probability distribution and iterative reduction, because that's what this is (and not a wave function).
I'd also say that flood fill actually looks like a flood filling a room if you see a 2-dimensional visual of it pathfinding around obstacles. Personally I don't really care about how algorithms are named, but I think flood fill is a bad example because it actually looks like a flood filling a room.
> I have my own theory on why people like to complain about this particular analogy, but for the sake of not causing offence I will leave it there ;p
Why even mention it then? "I'm thinking something that might be offensive so I won't say anything"; sort of undoes the whole not saying anything bit, doesn't it?
Obviously. That was my point: it is but a simple analogy. There are no actual bubbles in bubble sort, either.
As for my theory -- I suspect that whenever quantum physics is mentioned, a certain brigade of users like to take the opportunity to look smart by showing off their (in this case largely irrelevant) knowledge of quantum physics. (While simultaneously showing how they fail to grasp the concept of simple analogies, and so actually appearing the opposite. But then I'm zero_iq, so what do I know...!)
wavefunction collapse is a singular event not an iterative process, results are not equiprobable, alternative probabilities become 0, there is no undo/traceback etc etc. the analogy doesnt make sense, it's just a fancy name
Regardless, it can be computed as a process, and this is where I believe the analogy in question arises. Is a perfect analogy? Of course not -- no analogies are. Bubble sort has no bubbles and involves no liquids or gravity, or buoyancy, etc. etc. the analogy still works despite that IMO.
I agree that the crucial property of quantum systems is interference, specifically "negative probabilities". Just having a dead/alive ambiguity does not make "wavefunction collapse" a reasonable name.
When I first saw this technique, I was interested in replicating it. So I started reading about wavefunction collapse on wikipedia. It had a bunch of complex quantum math and I gave up thiniking the technique was beyond me. But now I see it was also completely irrelevant. Thanks to the bad name, I gave up on it (until now, at least, when I see that its a lot simpler).
This algorithm is actually an instance of constraint propagation: https://en.wikipedia.org/wiki/Local_consistency and constraint satisfaction algorithms generally, that find use in say, computing graph homomorphisms.
This suggests that it be called "PDF collapse," because it is collapsing a probability distribution function instead of a wavefunction.
Of course, random sampling can be quite non-trivial. The Lovasz local lemma comes to mind as something that's similar (but more general) to what the algorithm here achieves.
I certainly understand how people can get annoyed by this kind of marketing. Randomized algorithms have a long tradition, including randomized rounding of fractional relaxations which somebody alluded to, and nobody who worked on those felt the need to mislead with quantum allusions.
It may not be fair to the author to allege that they "felt a need to mislead." They might have just been a coder who thought it would be a cool name.
Take the Mersenne twister algorithm for instance. It is a non secure pseudo random number generator that is found everywhere even though there are alternatives that are better IMHO. I'm sure it's success comes from the fact that it is good enough and that it has a cool name.
I also think it is the rationale behind named vulnerabilities like heartbleed and spectre. Grabs attention.
It's a good trick, to be sure, but it doesn't seem "quantum". I suppose you could argue that there are often many valid solutions to the system, and you're just selecting a superposition.
I believe the notion of waves and their relationship to observations is the new “megameme” for western intellectualism. The progression as I see it:
Everything (including us) is a clock/machine
Everything (including us) is a computer/information processor
Everything (including us) is a wave/field
This metaphor will get dragged just as hard as the clock and information metaphors got dragged
It comes with a console application that runs WFC based on JSON config files, so you can experiment with generation without writing any code.
Think it went over the basics a _bit_ too much. Would’ve liked to see a bit more in depth. Great write up nonetheless.