From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Function definitions Date: Sat, 21 Jun 2014 10:57:53 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <610b9d5b-a9a5-464d-9de3-b2f754f58cff@googlegroups.com> <2aa95b6a-951f-4e1d-adbb-612521fdbe9e@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 21 Jun 2014 17:57:54 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="ba346f17b503f6aa8ecbfd6d1e2a9f59"; logging-data="32608"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18S7H/spVY/EpChZQK1iVIC2VWCF5Tqe20=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <2aa95b6a-951f-4e1d-adbb-612521fdbe9e@googlegroups.com> Cancel-Lock: sha1:AKa90P4ysVcPeLUEgncC8M0xSSk= X-Original-Bytes: 2495 Xref: number.nntp.dca.giganews.com comp.lang.ada:187113 Date: 2014-06-21T10:57:53-07:00 List-Id: On 06/21/2014 05:27 AM, montgrimpulo wrote: > > I want to conduct a genetic optimisation-program. You probably want to do something like this: subtype Probability is Float range 0.0 .. 1.0; generic -- Search type Gene is private; with function Random return Gene; -- For an initial random population with function Fitness (Individual : Gene) return Float; -- To evaluate Individual with function Mate (Left : Gene; Right : Gene) return Gene; -- Combines 2 individuals to produce an offspring with procedure Mutate (Individual : in out Gene); -- Randomly mutate Individual procedure Search (Population_Size : in Positive; Num_Generations : in Positive; Mutation_Probability : in Probability; Best : out Gene; Fit : out Float); You can look at PragmARC.Genetic_Algorithm for an example http://pragmada.x10hosting.com/pragmarc.htm -- Jeff Carter "If you don't get the President of the United States on that phone, ... you're going to have to answer to the Coca-Cola Company." Dr. Strangelove 32