For example a video game consists of millions of possibilities/results in movement based on environment - it's not approached as a collection of thousands of if/then/else statements.
In fact the movement of cows seems very much like video game coding, it needs a "cow engine".
Imagine being given a problem such as "add any two given integers but do not use math operators".
A person without anything but if/then/else knowledge would proceed to try to write
if (a==1 && b==2) c==3
and repeat it for every variation until they gave up.Someone with more core experience and coding instinct would immediately recognize there must be away to set patterns for 0-9 and then analyze each decimal place, apply a matrix, or a number of other approaches.
Do you have any material one can read to learn more about this?
Custom (non-physics) solutions involve declarative sets of constraints being solved by some sort of engine; such solutions often start to resemble physics engines even if the physical rules even if the constraints are not exactly physical.
Learning how to use a physics engine, first, then how those physics engines work, is a good start to understanding these kinds of problems.
Edit: I'm really surprised the stackexchange answers don't mention this.
It may not necessarily be realistic but then most players won't be familiar with cow movements.
Genetic Programming
ADTree
Random Forest
Decision Tree
Most of the work would be in figuring out the best way to gather all the data.
*opinion.
ADTrees, Random Forests, and Decision trees are all classifiers, so they serve this guy's needs. Genetic Programming is not a machine learning technique: it is an optimization method for a very specific task and is quite unsuited for his purposes.
Wikipedia says Genetic Programming is a specialization of genetic algorithms where the objects are programs. I think this is the only thing I have ever seen where the specialization turns out to be more general than the parent.
I'd also like to point out that I although all ML learns models, all those I gave can learn stuff as what amounts to a bunch of IF-THEN statements. Well GP need not be so limited. And Random Forests lose the trees in the forest (harder to interpret) but yeah, that's why I formed that particular list.
Considering the question-asker has a specific problem to solve, I would even hazard they probably aren't a programmer by trade.
So why would someone hire them to be a programmer? And yet, unlike other skilled professions, rank amateurs often present themselves as competent programmers. It would be valuable to include evidence to the contrary with résumés.
you've never been a complete novice programmer before?
I certainly wasn't hired when I was. What kind of ridiculous statement is this?
The poster is asking the wrong question. They are asking about how to manage incidental complexity, when they should be asking how to avoid inherent complexity. Incidentally complex code is the worst possible code to maintain, and you'll thank yourself for not letting contributors commit it.
Unfortunately, once your dimensions get large it becomes difficult for humans to visualize the optimizations, which is where Espresso[2][3] comes in handy.
[1] http://en.wikipedia.org/wiki/Karnaugh_map
[2] http://embedded.eecs.berkeley.edu/pubs/downloads/espresso/in...
[3] ftp://ftp.cs.man.ac.uk/pub/amulet/balsa/other-software/espresso-ab-1.0.tar.gz
http://code.google.com/p/eqntott/
I haven't touched this code since 2008, so beware of grues, but I remember it being a really slick system for minimizing boolean logic when you combine eqntott with espresso. Just the thing for an electrical engineering student who's sick of doing K-maps, which described me nicely at the time.
This phrase gives me the same feeling I'd get from finding an old Thomas Bangalter track or something.
A Prolog program is essentially a list of rules that are written as an implication. Something like:
moves_to(Cow, Location) :-
hungry(Cow),
current_location(Cow, OldLoc),
food_in(OldLoc, OldFood), food_in(Location, Food),
Food > OldFood.
In human language: a cow moves to a location if it's hungry and there's more food in that location than in current location.I should probably write a proper answer.
edit: Added a proper answer to the stackoverflow with an almost complete introductory Prolog example. It's waiting for your upvotes :)
You start by writing a logic flowchart that you understand, then you reduce the logic flowchart to code, usually automatically. This is how a logic flowchart looks:
http://en.wikipedia.org/wiki/File:LampFlowchart.svg
Here is the article it appears in:
http://en.wikipedia.org/wiki/Flowchart
The single most important parts of this process are:
1. That you understand the logic diagram and see that it meets the program's requirements.
2. That there is a way to turn the logic flowchart into code, ideally without human intervention.
3. That the rebuild time be short between adding a new logical step and testing the resulting program.
I'm a big fan of state machines, but systems like this are often multitasking and (for all practical purposes) stateless. OTOH it might be more accurate to say their state is formally unpredictable.
A system like the one being described would be more like a multi-threaded critical-path flowchart, where multiple processes are active at a given time. And at any time a high-level linear programming result might mandate a change of strategy based on available resources, even though individual processes continued to follow the tactical flowchart.
So even though a state machine approach looks attractive (as it always does), it's a matter of deciding how many states and how many levels. Because of the nature of the original problem and the number of connections with everyday reality, the fact that it was a state machine might escape the attention of even a careful observer.
Basically, many of the solutions proposed are more or less specialized state machines (decision trees, markov chains, rete algorithm).
Never mind the fact that you can throw in black swan type of events into the mix or just unknown unknowns you could never think of (maybe a cow has a frog phobia and panics when it sees the frog and starts a stampede or whatever it is that cattle do).
Philip Ball's (former editor of Nature) book Critical Mass[2] is an excellent read about the interesting effects that happen when you look at large number of complex interacting actors. He discusses the effects in traffic, pedestrian models, finance, plant growth etc. I highly recommend it.
[1]http://www.youtube.com/watch?v=8SmRBTJ-jeU This is just a video I picked out quickly, there are much better resources, I just can't find them on my phone.
[2]http://www.amazon.co.uk/Critical-Mass-Thing-Leads-Another/dp...
Expert systems were particularly big in AI in the '80s, and considerably less hot now, but still widely used in industry. There are a lot of issues that come up, most of which aren't really purely technical, such as: 1) how you extract knowledge from people who might know it; and 2) how you validate that the knowledge you've extracted is actually what they know, for example by validating that it produces the same decisions that they would make; and 3) how you allow updates/revisions to the knowledge base over time. Once you have the rules and some reason to believe that they're any good, actually managing and applying them can be done through one of several rule engines, such as Drools or Jess.
The keyword "knowledge engineering" may also turn up relevant info.
What do the states of the cows and the landscape look like? What is changed by the if-then-else results. Does he already have his rules? Is this for a biology project or a video game, etc.
You could use a finite automaton system, an array of cow-states, a cow DSL or something else depending on the answers to these and other questions.
[insert joke about "till the cows come home"]
"How can one manage thousands of IF…THEN…ELSE rules? By developing a drinking problem"
Even something as simple as a Decision Tree might be enough?
http://en.wikipedia.org/wiki/Decision_tree
It's basically thousands of if-this-then-that statements, but dressed up into something you can reason about and most importantly train and build automagically.
I'd consider taking a look at recurrent neural networks if you're looking at your data as a time series or if its more of a static problem that doesn't take into account the last N things that came before, you might consider tree based methods or even DBNs if you can get a lot of data together (say 50000-100000 samples)
Potential pitfall: if you're using a NN based approach, you will judge results based on test performance, but you won't get as much insight into the "rules" your network has learned.
I have modeled a logistics lookup system (assign "best" courier for an ecommerce setup) using a search solution. The rules were modeled as documents in a search index and looked up using weights. Fundamentally, what I did was flatten an if-then-else hierarchy and assign weights based on (roughly) level of nesting.
The con of this model is obvious - it is at best a heuristic. However, with clever overrides built in (as a separate search index?), you can get pretty close to the ideal solution.
The pro of this model is scalability - when your rules are in millions, this system scales beautifully.
The more modern Rete based software projects are probably also easy to work with.