[mercury-users] Mercury Modes Problem

Bob McKay bob_mckay at mac.com
Fri May 24 15:29:04 AEST 2002


On Friday, May 24, 2002, at 02:13 PM, Mark Brown wrote:
> The mode declaration for init_population/5 says that the variable
> 'Process' has mode 'in', which means the initial inst is 'ground',
> hence the message that "variable `Process' has instantiatedness
> `ground'".
>
> However, Process is then used in the higher-order call Process(I),
> where it is the "predicate term".  To do this, it needs to have an
> inst other than ground -- it needs a higher-order inst.  Specifically,
> it needs to have a "higher-order pred inst (of arity 3)".  The way to
> achieve this is documented in the reference manual, in the section
> "Higher-order modes".
>
> The solution to your problem is to replace the mode 'in' in the mode
> declaration with something that reflects the mode of the higher-order
> term which will be passed to init_population.  If I understand your
> code this should be something like 'in(pred(out, di, uo) is det)'.

Thanks Mark; I hadn't noticed that there was a separate section
on higher order modes. You're right, I think what you have is
pretty well spot on what I need.
>>
>> Does this mean what it seems to - that I can't take in a partially
>> instantiated data structure, instantiate it further, and pass it
>> out?
>
> Yes, that is correct in our current implementation.
>

Aaaarggh, that may be the killer for my application. The obvious
way to handle a population of individuals in evolutionary systems
is to have the individual created as a structure containing the
definition of the individual, with the fitness uninstantiated, then
to later instantiate the fitness as it is evaluated (in general, the
fitness may depend on other individuals in the population, so it
can't just be added at generation time). With this restriction, I'll
need to keep (at least) two separate parallel data structures. Is the
restriction likely to be removed anytime in the foreseeable future?

	Best Wishes
	Bob
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list