Re: [eclipse-clp-users] Minimizing a parameter that depends on global state

From: Marco Gavanelli <marco.gavanelli_at_...17...>
Date: Fri, 07 Oct 2011 16:03:42 +0200
On 06/10/11 21:48, Sergey Dymchenko wrote:
> BTW, could you explain:
> term_variables(States,StatesList), % I should not do that, but I'm too
> lazy to do it better ;-)

well, sorry for this comment. You are pointing my laziness to the whole 
list! ;-)
As also Thorsten pointed out, I just tried to get quickly an IP model, 
without trying to get a good formulation or a good code.

Here States is a one-dimensional array, and I needed to convert it into 
a list. I should have used some other operator (e.g., =.. ) but the 
first thing that came to my mind was term_variables.

In this particular example, it works as long as States is an array of 
variables. But States is also a parameter of the main predicate, so you 
never know how the user will actually use this predicate. If States is 
used only as an output parameter, the code is ok.

But what if the user calls the goal:

	solve(3, [](1, 2, 1), [](4, X, Y))

Is the result correct?
The answer is left as an exercise to the reader ;-)


Marco Gavanelli, Ph.D. in Computer Science
Dept of Engineering
University of Ferrara
Tel/Fax  +39-0532-97-4833
Received on Fri Oct 07 2011 - 14:03:54 CEST

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST