F# and Fuzzy Logic
Asked Answered
G

2

11

I know it might sound strange but I would like to know one thing in this new world where Microsoft Visual F# is getting into. There are many application of this language, I am going to learn, regarding parsing, functional programming, structured programming... But what about artificial intelligence?

Are there any applications for Fuzzy Logic? Is F# a good language to be used for Fuzzy Logic applications?

At university we are studying Prolog and similar languages. Prolog is able to create complex query in a very plain and short expresisons (by taking advantage of predicates and facts). Is F# able to do this?

Thank you in advance.

Grangerize answered 29/11, 2010 at 0:17 Comment(0)
C
9

Fuzzy Logic. F# doesn't provide any types for implementing fuzzy logic calculations out of the box, but it is certainly possible to use F# in this domain. The succinctness of F# and the ability to define custom overloaded operators should make code based on fuzzy logic quite nice. I did a quick search and discovered a few articles implementing fuzzy logic in F#:

Prolog is a bit different question. The power (and also the weakness) of Prolog come from the fact that it has backtracking built directly in the language. This makes it very nice for implementing search algorithms based on backtracking, but it also a limitation.

F# doesn't have any direct support for backtracking, but it is quite easy to write algorithms based on backtracking using recursion (which is the main control flow mechanism in both F# and Prolog).

Also, it is possible to implement domain specific language for logical programming in F#. This means that you'd implement something like Prolog within F# and then write your search algorithms using this mini-language in F# (possibly using other F# features as needed). You can find more information about similar problems in this question.

Cleanup answered 29/11, 2010 at 0:34 Comment(4)
Thank you... I already saw the articles you found, but just wanted an opinion from someone else about this argument. I also think F# is a very powerful tool as I'm going to discover in it these days... :) Well, thank you for your references and effort in answering my question.Grangerize
Ah, sorry, one more question... What do you mean by using mini-languages?Grangerize
I'd like to add that, although I don't explore it in my blog, F# would be an excellent choice for experimenting with parallel implementations of fuzzy logic, including implementations using graphics adapters. F# is not unique in this respect, but it does provide excellent opportunities for combining parallelism with domain-specific languages.Schist
Also, you might want to have a look on my Fuzzy library on GitHub: github.com/dsevastianov/FSharp.FuzzyWafer
M
3

F# is a general purpose language with some nice language features, such as computation expression/Monad and quotation. You can assume that it has about the same power as C#.

It is not like Matlab or R, where a lot of pre-implemented libraries are built-in. If you want to implement a Fuzzy Logic library or other AI algorithms from scratch, F# is a very good language for you as its language features make life easier.

But if you just want to use a Fuzzy logic library, then using other languages or specialized systems will be more appropriate because F# or .Net in general does not have very good quality libraries in this aspect.

Marsiella answered 29/11, 2010 at 1:44 Comment(1)
Thank you Yin Zhu... I expected F# having some libraries for fuzzy, but it is ok even if it does not... the good thing is that I can make anyway many algorithms in f# for fuzzy. Well, I'll try. Thanks again.Grangerize

© 2022 - 2024 — McMap. All rights reserved.