[Haskell-beginners] Genetic algorithm for knapsack problem

Federico Mastellone fmaste at gmail.com
Fri May 13 17:10:30 CEST 2011


When I was a student I built genetic algorithms in C and Java. I know
that building them in Haskell would be easy, with some little and very
descriptive code, but I have no experience with Haskell's performance.
It would be easy to tweak the algorithm and that's were you should
make you first attempts towards a faster implementation, but the
difficult part may be memory consumption, strict and lazy evaluation
strategies, etc (see
http://users.aber.ac.uk/afc/stricthaskell.html#seq).

On Fri, May 13, 2011 at 3:43 AM, Karol Samborski <edv.karol at gmail.com> wrote:
> Thank you for your answer.
> I'll try it and then put some code for comments ;)
>
> Best regards,
> Karol Samborski
>
> 2011/5/12 AJ Sherbondy <aj.sherbondy at gmail.com>:
>> Karol,
>> I don't know if you have looked at this module on Hackage or whether it will
>> even help you, but there is an evolution algorithm the individual functions
>> of which might be useful to you and is described as follows:
>> AI.SimpleEA
>>
>> A framework for simple evolutionary algorithms. Provided with a function for
>> evaluating a genome's fitness, a function for probabilistic selection among
>> a pool of genomes, and recombination and mutation operators, runEA will run
>> an EA that lazily produces an infinite list of generations.
>>
>> AI.SimpleEA.Utils contains utilitify functions that makes it easier to write
>> the genetic operators.
>>
>> ajsher
>>
>> On Thu, May 12, 2011 at 10:24 AM, Karol Samborski <edv.karol at gmail.com>
>> wrote:
>>>
>>> Hi all,
>>>
>>> I'm a student and I got recently a task to do (and I want to do it in
>>> haskell). I have to implement "genetic algorithm for knapsack problem"
>>> and it would be nice if it will be fast.  So my question is: what
>>> haskell datatypes, modules etc. should I use for this algorithm to
>>> achieve this goal? I mean fast as compared to implementation in
>>> imperative languages like C.
>>>
>>> Any advices ?
>>>
>>> Best regards,
>>> Karol Samborski
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners at haskell.org
>>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>>
>> --
>> AJ Sherbondy
>>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
Federico Mastellone
Computer Science Engineer - ITBA
".. there are two ways of constructing a software design: One way is
to make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."

Tony Hoare, 1980 ACM Turing Award Lecture.



More information about the Beginners mailing list