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

From: Sergey Dymchenko <kit1980_at_...6...>
Date: Fri, 7 Oct 2011 17:09:56 +0300
Thank you for the explanation.

I believe I saw this construction with term_variables in several other
models on the Internet and I was thinking it's kind of a common
pattern.

On Fri, Oct 7, 2011 at 5:03 PM, Marco Gavanelli
<marco.gavanelli_at_...17...> wrote:
> 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 ;-)
>
> Cheers,
> Marco
>
> --
> Marco Gavanelli, Ph.D. in Computer Science
> Dept of Engineering
> University of Ferrara
> Tel/Fax  +39-0532-97-4833
> http://www.ing.unife.it/docenti/MarcoGavanelli/
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
>
Received on Fri Oct 07 2011 - 14:10:03 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST