comp.lang.ada
 help / color / mirror / Atom feed
From: montgrimpulo <aghte@hotlinemail.com>
Subject: Re: Function definitions - with clarification
Date: Sun, 22 Jun 2014 07:25:43 -0700 (PDT)
Date: 2014-06-22T07:25:43-07:00	[thread overview]
Message-ID: <aac0fc6b-684b-4dd1-9bdd-fc07cb69e17f@googlegroups.com> (raw)
In-Reply-To: <f12eba4c-2757-4496-861b-101cb7e355d6@googlegroups.com>

Simon Clubley wrote:

> Have you read the answers (and questions) we have posted ? 

Yes.

> Did they not answer your questions or did you not understand the 
> responses you received ?

Same question to you in return.

> Before we can help you any further, I think you need to explain why 
> the responses posted so far don't help you.

Am I talking to a robot program like "Eliza" ? 

> Is this part of a student assignment or is this something you are 
> investigating on your own ?

Irrelevant question 

> I am wondering if we are giving you answers that you don't yet 
> 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 which
can be misinterpreted, and show no phantasy to tackle the core of my questions.

You can assume that everything you wrote is understood. I did not explicitly instantiated
the procedure search, as I want to do it later in a different file than search.adb. However, there are still
open questions, where your answer would show how you would have solved the problem
in your own understanding.

> Simon. 


On Sunday, June 22, 2014 1:34:09 PM UTC+2, montgrimpulo wrote:
> Here is another try to describe my problem. 
> 
> 
> 
> I want to conduct a genetic search-program. There is a function F (the objective function), 
> 
> and a function G (the constraint function) which I want to define only at runtime. The search-program handles individuals within a population. The size of an individual as well as the size of the population is dynamic and is known at runtime. 
> 
> 
> 
> There is a proposed solution to define (in search.ads)
> 
> 
> 
> ...
> 
> generic 
> 
> with function F (V : Individual) return Float; 
> 
> with function G (V : Individual; M : Positive) return Float; 
> 
> procedure Search (V : Individual); 
> 
> 
> 
> which seems to be an appropriate solution for that part. 
> 
> 
> 
> The search program handles individuals from a population. 
> 
> 
> 
> type x_array is array (positive range <>) of Float; 
> 
> type y_array is array (positive range <>) of Integer; 
> 
> type z_array is array (positive range <>) of Boolean; 
> 
> 
> 
> type Individual (P, Q, R : Natural) is record 
> 
> X : x_array (0..P); 
> 
> Y : y_array (0..Q); 
> 
> Z : z_array (0..R); 
> 
> end record; 
> 
> 
> 
> P,Q and R are only known at runtime. 
> 
> 
> 
> A population has a number (Popsize) of individuals (definition see above), which is also only known at runtime. 
> 
> 
> 
> Due to some reading, I learned that dynamic arrays in Ada 
> 
> 
> 
> - can be declared in blocks, meaning no inheritance 
> 
> - by limits passed as parameters in subprograms 
> 
> - by use of linked lists 
> 
> - by use of containers ? 
> 
> - by use of discriminated records ? 
> 
> 
> 
> Using  the proposed record type from above, 
> 
> my search-program may look like: (in search.adb)
> 
> 
> 
> procedure Search (V : Individual) is 
> 
> 
> 
> P : Natural := V.P; 
> 
> Q : Natural := V.Q; 
> 
> R : Natural := V.R; 
> 
> Vi : Individual := V; 
> 
> 
> 
> 
> 
> -- type population is array (1 .. Popsize) of Individual; 
> 
> -- gives: unconstrained element in array declaration 
> 
> 
> 
> ... 
> 
> begin 
> 
> -- fill Vi with distinct values and put it into an (array?, container ?, List ?, whatever) 
> 
> -- to get a population with size Popsize
> 
> -- work on all individuals within that population 
> 
> ... 
> 
> end Search; 
> 
> 
> 
> What I still need is a definition for the population (a collection of Individuals) of size Popsize, which is only defined at runtime.
> 
> 
> 
> I want to use my search program for a specific objective- and for a specific 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 modified objective- or constraint-functions. 
> 
> 
> 
> After I have found a solution or not, I want to use the same search program with a new and different objective- and a new and different constraint function with a different size of an individual and  different population size.



  parent reply	other threads:[~2014-06-22 14:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-22 11:34 Function definitions - with clarification montgrimpulo
2014-06-22 12:04 ` Simon Clubley
2014-06-22 14:25 ` montgrimpulo [this message]
2014-06-22 15:30 ` Georg Bauhaus
2014-06-22 17:29 ` montgrimpulo
2014-06-22 17:45 ` Shark8
2014-06-22 18:03   ` montgrimpulo
2014-06-22 18:45     ` Simon Clubley
2014-06-22 19:28       ` montgrimpulo
2014-06-22 21:04         ` Simon Wright
2014-06-22 21:17       ` Jeffrey Carter
2014-06-22 19:55     ` Shark8
2014-06-23 16:26 ` Adam Beneschan
2014-06-29 15:31 ` cotswold
2014-06-29 19:20 ` montgrimpulo
2014-06-30  9:29   ` G.B.
2014-06-30 17:55     ` Shark8
2014-07-01  8:58       ` Georg Bauhaus
2014-07-04  6:45         ` J-P. Rosen
2014-06-30 13:23 ` montgrimpulo
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox