Re: List partitioning



Boris Borcic a écrit :
Mhh, please forgive me, I'll indulge in stating a few opinions...
[...]

No problem at all, I find all this very interesting.

Concerning Python, yeah I've heard a lot of good things about it, I know it's a very good language. However, now that I'm really used to coding in Perl, I feel less motivation for learning another interpreted language (note that I don't think Perl is better, since I don't even know Python enough to be able to compare them). Anyway, as you said below, I'm using CLP for solving my problem, not only Prolog. I failed at explaining that but that's what I meant, and that's why I though Prolog would be more suitable.

I think I see what you mean concerning Prolog illusion. I felt this even with the little Prolog program I just did (had to refactor the internal variables structure just in order to apply the constraints "efficiently"...). I'm far from being a Prolog expert though, so maybe I did it totally wrong...

For information, here is the entire problem I'm trying to solve:

[snip]

I am sorry but I've already diverted too much time away for this, from more pressing tasks.

Don't feel sorry, I've just put it for information, to explain why I though Prolog was suitable for it. I'm already happy to see some people have spent some time helping me ;)

A few remarks, though :

- In my sense, what you mean to apply is not just Prolog, but CLP. Now if your problem really requires constraint propagation to achieve efficiency as the case may be, Python isn't competitive with specialized languages.

Exactly.

- But my tendency whatever the programming language, would be to first seek the most efficient algorithms that use only generate and test over a well thought out partial solutions construction mechanism, and let CLP enter the scene, only if that reveals not to be efficient enough.

- You mention heuristics : this implies fine control over search deepening, where Prolog's built-in search strategy tends to get in the way rather than help (although maybe you can find some library to deal with the complexity).

Well, I though that when trying to minimize some variables through CLP, Prolog would optimize its research tree and use these variables as sort of heuristics, but from what I understand now it doesn't ?

- Your problem statement isn't wholly crystal-clear, eg the role of +Sizes and the relationship of "item Size" to "group Size" and "group Weight"; but never mind since I don't intend to work on it.

group size = sum of its items sizes
group weight = sum of its items weights
In my example all items have a size of 1 (which is the most common situation anyway).

- For a strategy, it appears that the relative value of a complete solution (partition) might be expressed as the sum of the (eg stable) relative value of each component set (or some slightly relaxed property equivalent for the purpose). This suggests you should first generate (possibly lazily (...heuristics)) a sequence of component sets ordered by decreasing value, and then from that list, eagerly pick candidate components to incrementally construct a complete solution (much like nCombis is used in partEvenly() of my initial Python program).

I'm not sure to get exactly what you mean right now, given that I have two values assigned to each solution (Balance and Dispersion), and that I need first to get the solution with {min(Dispersion) and min(Balance)], then {Balance < 10 and min(Dispersion)} if the first solution had a Balance > 10 for example. I will try to take a look at your initial Python program to figure it out when I have some time.

Anyway, thanks again.
.



Relevant Pages

  • Re: why python?
    ... > I've just known about Python language recently for a research project. ... For Prolog, ...
    (comp.lang.python)
  • Re: Favorite non-python language trick?
    ... And -- why isn't it in Python? ... I use constraints programming at work, ... It would be great if this style of programming could be added to ... is an example written in Cadence's Specman 'e' language: ...
    (comp.lang.python)
  • Re: List partitioning
    ... the fact that I'm looking for the best solution based on heuristics and constraints made me think Prolog was the best choice. ... However, I almost don't know anything about Python, so maybe you're right, maybe Python is as good as/better than Prolog for my problem... ... minimize the differences between all groups weight ...
    (comp.lang.prolog)
  • Re: Real World Applications
    ... That is not new and not unique to Prolog. ... I don't think that is a real issue with the language. ... That will not kill Prolog either. ... But Python have a lot of users. ...
    (comp.lang.prolog)
  • Re: Chestnut Lisp translator
    ... I like the freedom that the extra level of abstraction and mathematical ... every language that I used before ... put constraints on the ease with which I could construct and manipulate ... Oh, and it's a lot faster than Python, which was one of the the hooks ...
    (comp.lang.lisp)