Tag Info

Hot answers tagged

117

Tackling the if web problem you can create a rule engine where each specific rule is coded independently. A further refinement for this would be to create a domain specific language (DSL) to create the rules, however a DSL alone only displaces the problem from one code base (main) to another (DSL). Without structure the DSL will not fare any better than ...


82

It sounds like all these conditional statements that you're talking about should really be data that configures your program rather than part of your program itself. If you can treat them that way, then you'll be free to modify the way your program works by just changing its configuration instead of having to modify your code and recompile every time you ...


47

The logic programming language Prolog may be what you're looking for. Your problem statement is not specific enough for me to assess if it's a good fit but it's rather similar to what you say. A Prolog program consists of facts and rules that are applied. Here's a simple example rule that states "A cow moves to a location if the cow is hungry and there is ...


42

No one has mentioned this, so I thought I'd say it explicitly: Thousands of "If .. Then .. Else" rules is a sign of a badly designed application. While the domain specific data representation might look like these rules, are you absolutely certain that your implementation should resemble the domain specific representation?


20

I took an introduction to AI course in my undergrad that used Prolog to have us implement an expert system. An expert system is a piece of software that is used to solve a very specific problem whose solution is dependent on a high number of rules and variables. For instance, you could imagine an expert system that tells you whether you should take an ...


19

The AI course I participated in online, taught at Stanford, recommended that Python be used for the homework. I believe Georgia Tech still uses LISP. The fallacy here is "new" is "good". AI research is one of the oldest computing research disciplines. It keeps calving off subfields as people realize that techniques from it can be used elsewhere. Language ...


18

I believe this is primarily historical thing. SQL was primarily used in businesses for making business applications. Some companies build their livelyhood on selling SQL solutions and they used their money to advertise and push SQL into minds of many. This was especially empowered by how important data is for business people. This is why SQL won over it's ...


14

From the preface to Prolog Programming for Artificial Intelligence: Prolog is a programming language centred around a small set of basic mechanisms, including pattern matching, tree-based data structuring and automatic backtracking. This small set constitutes a surprisingly powerful and flexible programming framework. Prolog is especially well suited for ...


13

Please, use software/computer languages that are fit for the task. Matlab is used very often to model complex systems, where you can have indeed literally thousands of conditions. Not using if/then/else clauses, but by numerical analysis. R is an open source computer language that is filled with tools and packages to do the same. But this means you also have ...


13

Rules engines might help because if there are so many if/then rules it might be helpful to get them all in one place outside the program where users can edit them without needing to know a programming language. Also, visualization tools might be available. You could also look at logic programming solutions (like Prolog). You can quickly modify the list ...


12

In my view, learning the basics of Prolog is very worthwhile, irrespective of whether you'll ever use it in the real world. It's also very worthwhile to understand the basic ideas underlying unification, and how a (trivial and inefficient) implementation might be handled. If you have a problem that would be best solved using declarative logic, you should ...


11

It's suddenly dawned on me: You need to use a Decision Learning Tree (ID3 Algorithm). Its highly likely that's someone has implemented it in your language. If not you could port an existing library


11

The difference is a bit like using SQL for database queries rather than writing a program in, say, C. In SQL, you say what you want - but you don't (directly) have to specify the algorithm used to derive it. A Prolog program is sometimes called a database, but it's really a set of predicate logic statements. The evaluation mechanism takes the query and ...


10

This wasn't me, but assuming the question could be "did anyone implement something serious with prolog?" this might count: http://asmarterplanet.com/blog/2011/02/the-watson-research-team-answers-your-questions.html Watson is powered by 10 racks of IBM Power 750 servers running Linux, and uses 15 terabytes of RAM, 2,880 processor cores and is ...


8

Every large application contains thousands of if-then-else statements, not counting other flow controls, and those applications are still debugged and maintained, despite their complexity. Also, the number of statements does not make the flow unpredictable. Asynchronous programming does. If you use deterministic algorithms synchronously, you'll have a 100% ...


8

This is more of a community wiki answer, aggregating the various modelling tools suggested by other answers, I've just added additional links to resources. I don't think there's any need to restate that you should be using a different approach to thousands of hard-coded if/else statements. DSL Programming (Domain Specific Language) Markov Model/Markov ...


7

"The Art Of Prolog" by Leon Sterling & Ehud Shapiro is one of the best books about computer programming I've ever read.


7

I know A.I. programmers use it.....because I did a Prolog course in my A.I. class but besides that I haven't seen much else said about it. here is a similar question with lotsa answers! http://stackoverflow.com/questions/130097/real-world-prolog-usage


7

I think the argument for many commercial Business Rules Systems using forward chaining engines (eg. Drools) vs backward chaining (Prolog) is that many "Joe programmers" are used to dealing with IF/THEN/ELSE logic - and this makes it a whole lot easier to market to the masses. I don't think technical merit has anything to do with it. I'm posting this as ...


7

Tongue-in-cheek answer: because if the creators of Rules Engines knew about Prolog (or Mercury or PLANNER or …) they wouldn't be writing Rules Engines, they'd be using Prolog.


6

Prolog is great for a fast prototyping. For example, in http://www.cri.ensmp.fr/classement/doc/A-381.pdf an SSA-transform for GCC is first implemented in Prolog, and then in C. I am using Prolog inside compilers for a quick and dirty implementation of type systems, certain optimisations and semantic checks, and I rewrite that Prolog code into something ...


6

Outside of academia... I've heard of it used more in AI, sometimes in games (I heard it drove the AI in the Black & White series). I've also heard of variations used to run rules-engines for certain businesses and economic simulations. My guesses for lack of widespread adoption are: It's weird - most people aren't used to programming in it, and they ...


6

You may find answers to your questions in a recent special issue “Sprachen der KI” (“Languages of AI”) of the German AI journal KI - Künstliche Intelligenz, Volume 26, Number 1 / February 2012, published by Springer. I am the co-author of one part of a discussion paper included in it: “What Language Do You Use To Create Your AI Programs and Why?” Here is a ...


5

We used it to build parsers. It was easier to work with than lex/yacc. Why is it not getting any detectable industry usage? This is unanswerable. What does "detectable" mean? Who needs to get the detection memo? http://www.meridiansystems.com/landing/ppc/prolog/getvideo.asp Ask Meridian Software about their prolog offering if you want facts. ...


5

Rules engines in their infancy were written almost exclusively in Prolog--it was the logical language. For a small set of rules they worked great. However, it turned out they didn't scale very well. I don't have a definitive reference, but my understanding is that the way Prolog handles the chaining of rules is inefficient--the recursive model made for ...


5

The reason is actually pretty simple. It has nothing to do with how useful the language is for a given task and everything to do with how maintainable the code is. Reading an SQL statement, many developers will be able to determine what most basic queries do without knowing the language. They might have a harder time in the case of complex examples but ...


4

I took 2 Prolog modules at University and very much enjoyed developing in the language. Its particularly good for expert systems, I wrote a medical symtom diagnosis one. The way it was explained to me was that Lisp tends to be used more in certain countries and Prolog in the others. In terms of which is best, I only covered Lisp briefly when I did lambda ...


4

Generally, the point of a rules engine is that it is a part of another application. It is rather rare to see applications written in Prolog, and there isn't a commonly available interface to connect Prolog to applications written in other languages. One rule-based tool for rule engines, that is written to be added to other applications, is CLIPS. CLIPS was ...


4

There is another reason. Practically speaking, SQL is useful for data persisted on disk. So databases are used to store data for a "long" time (several months). Every SQL database (e.g. PostgreSQL, MySQL, Oracle, ....) is managing data on disks (or SSDs, i.e. hardware which could keep data if properly powered down). However, most Prolog implementations I am ...


3

Drools recently adding backward chaining, seamlessly into the drl language. So now you get the benefits of both words. It doesn't yet quite have all the features of prolog, for instance no 'cut'. But it's unification and deriviation tree results will work as prolog people expect, i.e. full support for transititive closures. And features will continue to ...



Only top voted, non community-wiki answers of a minimum length are eligible