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 X-Received: by 10.182.125.4 with SMTP id mm4mr791980obb.49.1403447143630; Sun, 22 Jun 2014 07:25:43 -0700 (PDT) X-Received: by 10.140.85.241 with SMTP id n104mr2070qgd.23.1403447143602; Sun, 22 Jun 2014 07:25:43 -0700 (PDT) Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!uq10no4093446igb.0!news-out.google.com!a8ni10892qaq.1!nntp.google.com!w8no9436808qac.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 22 Jun 2014 07:25:43 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=109.233.148.43; posting-account=ZoAlyAoAAACOOtSiXyaM8n3y8T4ScfeH NNTP-Posting-Host: 109.233.148.43 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Function definitions - with clarification From: montgrimpulo Injection-Date: Sun, 22 Jun 2014 14:25:43 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Original-Bytes: 6118 Xref: number.nntp.dca.giganews.com comp.lang.ada:187152 Date: 2014-06-22T07:25:43-07:00 List-Id: Simon Clubley wrote: > Have you read the answers (and questions) we have posted ?=20 Yes. > Did they not answer your questions or did you not understand the=20 > responses you received ? Same question to you in return. > Before we can help you any further, I think you need to explain why=20 > the responses posted so far don't help you. Am I talking to a robot program like "Eliza" ?=20 > Is this part of a student assignment or is this something you are=20 > investigating on your own ? Irrelevant question=20 > I am wondering if we are giving you answers that you don't yet=20 > understand because you have not yet covered this material in class. Irrelevant question. "you" means here some people in the rest of the group. "You" seem to prefer to give answers to questions which I have never asked. Furthermore, "you" seem to deliberately search for those of my statements w= hich can be misinterpreted, and show no phantasy to tackle the core of my questi= ons. You can assume that everything you wrote is understood. I did not explicitl= y instantiated the procedure search, as I want to do it later in a different file than sea= rch.adb. However, there are still open questions, where your answer would show how you would have solved the = problem in your own understanding. > Simon.=20 On Sunday, June 22, 2014 1:34:09 PM UTC+2, montgrimpulo wrote: > Here is another try to describe my problem.=20 >=20 >=20 >=20 > I want to conduct a genetic search-program. There is a function F (the ob= jective function),=20 >=20 > and a function G (the constraint function) which I want to define only at= runtime. The search-program handles individuals within a population. The s= ize of an individual as well as the size of the population is dynamic and i= s known at runtime.=20 >=20 >=20 >=20 > There is a proposed solution to define (in search.ads) >=20 >=20 >=20 > ... >=20 > generic=20 >=20 > with function F (V : Individual) return Float;=20 >=20 > with function G (V : Individual; M : Positive) return Float;=20 >=20 > procedure Search (V : Individual);=20 >=20 >=20 >=20 > which seems to be an appropriate solution for that part.=20 >=20 >=20 >=20 > The search program handles individuals from a population.=20 >=20 >=20 >=20 > type x_array is array (positive range <>) of Float;=20 >=20 > type y_array is array (positive range <>) of Integer;=20 >=20 > type z_array is array (positive range <>) of Boolean;=20 >=20 >=20 >=20 > type Individual (P, Q, R : Natural) is record=20 >=20 > X : x_array (0..P);=20 >=20 > Y : y_array (0..Q);=20 >=20 > Z : z_array (0..R);=20 >=20 > end record;=20 >=20 >=20 >=20 > P,Q and R are only known at runtime.=20 >=20 >=20 >=20 > A population has a number (Popsize) of individuals (definition see above)= , which is also only known at runtime.=20 >=20 >=20 >=20 > Due to some reading, I learned that dynamic arrays in Ada=20 >=20 >=20 >=20 > - can be declared in blocks, meaning no inheritance=20 >=20 > - by limits passed as parameters in subprograms=20 >=20 > - by use of linked lists=20 >=20 > - by use of containers ?=20 >=20 > - by use of discriminated records ?=20 >=20 >=20 >=20 > Using the proposed record type from above,=20 >=20 > my search-program may look like: (in search.adb) >=20 >=20 >=20 > procedure Search (V : Individual) is=20 >=20 >=20 >=20 > P : Natural :=3D V.P;=20 >=20 > Q : Natural :=3D V.Q;=20 >=20 > R : Natural :=3D V.R;=20 >=20 > Vi : Individual :=3D V;=20 >=20 >=20 >=20 >=20 >=20 > -- type population is array (1 .. Popsize) of Individual;=20 >=20 > -- gives: unconstrained element in array declaration=20 >=20 >=20 >=20 > ...=20 >=20 > begin=20 >=20 > -- fill Vi with distinct values and put it into an (array?, container ?, = List ?, whatever)=20 >=20 > -- to get a population with size Popsize >=20 > -- work on all individuals within that population=20 >=20 > ...=20 >=20 > end Search;=20 >=20 >=20 >=20 > What I still need is a definition for the population (a collection of Ind= ividuals) of size Popsize, which is only defined at runtime. >=20 >=20 >=20 > I want to use my search program for a specific objective- and for a speci= fic constraint-function with a certain size for an individual and a certain= size of population. If I do not find a solution then I want to change some= elements, eg. size of the population, size of an individual, or to try mod= ified objective- or constraint-functions.=20 >=20 >=20 >=20 > After I have found a solution or not, I want to use the same search progr= am with a new and different objective- and a new and different constraint f= unction with a different size of an individual and different population si= ze.