News for hackers. Stuff that matters.
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by zeteo on Wednesday July 06, 2011 @08:57PM (#2736678)
What he calls "Iterate and Repair" is basically a greedy algorithm. Greedy algorithms are great where they work, but there are also situations where they break spectacularly. I guess the algorithms course is no longer required at MIT?!
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by aaroniba on Wednesday July 06, 2011 @09:47PM (#2736798)
Most greedy algorithms I've seen do not have a repair step.  But whether I call it "iterate-and-repair" or "greedy" doesn't change the message, does it?  Or are you saying that I shouldn't be surprised that iterate-and-repair works so well on this puzzle?
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by knowtheory on Thursday July 07, 2011 @01:18AM (#2737285)
Really?

OP isn't right that this is greedy either. What your users are doing is an iterative search with a backoff strategy. They pursue one path through the search space, and when they don't find the solution, they remove some links (backing off) and try a new path through the search space.

The clever bit is whether you can automate their decision mechanism for how they're proceeding through the space step by step, and what points you can fall back to when something does wrong (and how to recognize when you've gone wrong).

The fact that people can do this by the seat of their pants somewhat shouldn't come as a surprise to people who study cognitive psychology, but certainly might be a surprise to engineers. After all, that's why everyone who's not a social scientist loves Malcolm Gladwell's books.

Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by icebraining on Thursday July 07, 2011 @04:02AM (#2737671)
Iterative search with a backoff strategy is called backtracking, no? Seems an obvious way of solving the problem, especially since if I was to write a solver I'd definitively do it in Prolog.
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by knowtheory on Thursday July 07, 2011 @07:59AM (#2738106)
I've heard it called a bunch of stuff, but yep, that's one of 'em! Sorry i was writing while exhausted :)
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by dgreensp on Thursday July 07, 2011 @06:01PM (#2740486)
To pick a nit, I don't think the human, "cognitive" strategy really has any "back-off."

In my experience (playing Monorail!) the "fast" approach is basically guess, repair, repair, repair, ... If you're trying to keep a mental stack of tentative moves to "undo," as many people do, e.g. when doing a Sudoku, that's a different, more "logical" approach, to me. The fast approach has no state except the current state of the board.

Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by zeteo on Wednesday July 06, 2011 @09:58PM (#2736828)
What I'm saying is that you shouldn't draw such general conclusions from seeing a simple algorithm work in a particular case. Your problem-game turned out to be algorithmically simple. This probably makes it more appealing as a game. But most things in life will not be as simple, and this includes large coding projects.

What you call the repair step I see as running the greedy algorithm again, from a different node in the search graph.

Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by aaroniba on Wednesday July 06, 2011 @10:27PM (#2736901)
The conclusion I drew from this experience was that I should get over my fear of making mistakes. I could have been more clear on that in the post.

There's probably some optimal level of fear-of-mistakes for any given project. Monorail made me realize my brain was tuned too far in the fear direction. I stand by that generalization.

Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by zeteo on Wednesday July 06, 2011 @10:37PM (#2736926)
"It turns out to be easier and faster to iterate from an existing but wrong solution, than to deduce a correct solution from scratch. Even if you have to occassionally press the “clear” button to start over."

This is what I was referring to. Yes, if you tackle coding projects that are challenging mostly by size and not by algorithmic difficulty, simply plowing ahead is the right attitude. But sometimes you will encounter real challenges, and for those you will need all the top-down design and logical tricks that you can muster. To the extent that my personal experience is relevant, for my PhD thesis I've designed and implemented a novel algorithm. I went through three non-functional versions before I realized that I actually needed to spell everything out on paper first, before writing a single line of code. After that, I was done in two weeks.

Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by JesseAldridge on Thursday July 07, 2011 @12:34AM (#2737158)
Something tells me trying and failing three times contributed much more to your solution than writing everything out on paper.
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by vecter on Wednesday July 06, 2011 @10:37PM (#2736925)
Can you define "algorithmically simple"? This looks like hamiltonian cycle with an extra constraint that there is one bounded region. I wouldn't be surprised if this problem was NP-hard.
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by zeteo on Wednesday July 06, 2011 @10:48PM (#2736941)
You're right, there are probably instances of this problem for which greedy algorithms are quite slow.
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by gosub on Thursday July 07, 2011 @09:17AM (#2738293)
"iterate and repair" is a pretty standard form of local optimum search, like in http://en.wikipedia.org/wiki/Hill_climbing or simulated annealing. Why are you surprised that works for exploring the decision tree of a puzzle game?
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by alanh on Thursday July 07, 2011 @05:17PM (#2740364)
Regular expression search is often greedy and also repairs by next examining a less greedy partial solution
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by richcollins on Wednesday July 06, 2011 @09:09PM (#2736717)
How is it a greedy algorithm? He didn't say anything about the "intuitive" decisions maximizing immediate gain at every decision point.
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by zeteo on Wednesday July 06, 2011 @09:12PM (#2736726)
I'm sure the users he describes can be trusted to make locally optimal choices.
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by purewater on Wednesday July 06, 2011 @09:42PM (#2736789)
Greedy algorithms run the same way every time given the same choices. Why? Because, if options are received in a deterministic order, it'll make the locally optimal choice.

With iterate and repair, people are using an internal heuristic to make a choice and refining that over time. These are not necessarily the locally optimal choice.

Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by zeteo on Wednesday July 06, 2011 @09:58PM (#2736829)
They won't run the same way if you start from a different node in the search graph, which is probably what the players are doing.
Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by purewater on Wednesday July 06, 2011 @10:08PM (#2736862)
I was being nice before, but it's obvious that you don't know what a greedy algorithm is.

Please don't make offensive comments like, "I guess the algorithms course is no longer required at MIT?!"

Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by zeteo on Wednesday July 06, 2011 @10:26PM (#2736892)
A greedy algorithm is an algorithm that makes locally optimal choices. The classic example, if you've taken an algorithms course, is the travelling salesman problem with the nearest neighbor heuristic. This starts at an arbitrary node, and will usually generate different solutions based on the node that is chosen to start at.

The very presence of the "internal heuristic" that you mention is usually enough to make the algorithm greedy.

Otherwise, thanks for being nice, and try to take less offense at what people say on the Internet.

Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by nocipher on Thursday July 07, 2011 @12:23AM (#2737131)
It is not the presence of an internal heuristic that makes an algorithm greedy, it is the choosing of locally optimal solutions. For your claim to hold, you would need to demonstrate that people make locally optimal solutions, at least in the context of this problem.

That is most likely a wrong assumption. Greedy algorithms usually do not find globally optimal solutions, yet the people solving these problems are finding -the- solution. That is enough to suggest that the heuristic people are using is much more complex than merely choosing local optimums.

Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by juliennakache on Thursday July 07, 2011 @09:46AM (#2738371)
It was interesting to read both of you guys. I can see a lot of ego on both sides... But that's a good thing :)

No one is wrong or right. It just depends on what you believe users are doing. One thing is certain: users use "local search" techniques as opposed to "systematic" search. The salesman problem describes this: the algorithm operates using a single current node and moves only to neighbors of that node.

However, depending on the "local search" algorithm used, those may be greedy or not: - "Hill Climbing" is greedy. The algorithm is affected by local maxima, ridges and plateaux. - "Simulated annealing" is not greedy. It uses "gradient descent" and does not always pick the "best" neighbors.

I believe the heuristics used by the users: - are not very precise ("Well, it is better, right?") - may change over time ("Oh, look at this!") That's why, I think it is not a "greedy" algorithm with deterministic results, but it is NOT complete anyway (hence, the clear process).

I can't wait for you guys to kick my butt :) ps: I'm a business major...

Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by sitkack on Thursday July 07, 2011 @09:42AM (#2738363)
"Quid in nomine? Quod dicitur rosa Odorem suavitatis, ut non alio nomine.

All you guys are trying to label, taxonimicate the "lay person's" strategy into your hierarchy.

Humans are damn smart, and the cocksure MIT nerd got his ass handed to him.

Re:Users of my iOS Game Teach Me a Lesson MIT Didn’t by dev1n on Thursday July 07, 2011 @10:11AM (#2738463)
this is true for the most part. Humans have always been the "try it and if it kills somebody try it another way." i.e. we used to eat tobacco leaves. Now we smoke them. riddle me that.