Re: List partitioning



bim wrote:
Boris Borcic a écrit :
bim wrote:
pineapple.link@xxxxxxxxx wrote :
Sounds like a homework assignment.

It's not, I left studies years ago...
I just need a balancing algorithm for a program of mine, and I wonder if it wouldn't be easier to do it in Prolog.

Then maybe a Python version would serve.


Thank you for this Python version. However I'm really looking for a Prolog way of doing this.

I din't mention it because I wanted to keep it simple at start, but I have more constraints than what I explained initially (each item has a weight and each formed group should have quite the same total weight, some items are pre-grouped and these groups shouldn't be broken unless the balance isn't good enought...). So Prolog really seems to fit ;

Good you say this, makes your problem sound less like homework (since what need would you have for an complete list of possible partitions rather than just one ?).

This said - and while I don't mean to argue against Prolog (I am a lurker here for *some* reason) - I do not see that your conclusion follows clearly (that Prolog is a better fit). Witness that the most concise solutions provided in both languages to your initial simplified problem, have *exactly* the same syntactic complexity - what gives no reason to think that solutions to the complete problem would be different.

Cheers, BB
.



Relevant Pages

  • Re: List partitioning
    ... I just need a balancing algorithm for a program of mine, and I wonder if it wouldn't be easier to do it in Prolog. ... I din't mention it because I wanted to keep it simple at start, but I have more constraints than what I explained initially (each item has a weight and each formed group should have quite the same total weight, some items are pre-grouped and these groups shouldn't be broken unless the balance isn't good enought...). ...
    (comp.lang.prolog)
  • Re: Im giving (NOT?) this up (Re: solving riddle in prolog)
    ... > problem and found the answer (the way to reason about it), ... Every solution in Prolog is a translation and cannot be an original ... formulation, unless it is formulated purely logical. ...
    (comp.lang.prolog)
  • Newbie cant understand Prolog answer
    ... I can't understand the answer Prolog is giving me in the following simple little database. ... I decided I would play around with a simple database describing nodes being connected or not. ... I'm thinking it has something to do with the fact that I have the second path clause and Prolog is for whatever reason searching both of them. ...
    (comp.lang.prolog)
  • Re: Performance and findall
    ... This is the reason why I started ... looking for some general guidelines. ... more fit to a bottom-up deductive database, ... faster for your programs than a prolog system. ...
    (comp.lang.prolog)
  • Re: Why Do I Use Delphi?
    ... Prolog was great! ... Oliver Townshend ... Any reason why Object Pascal can't be the Pascal of ... Allied Data, Inc. http://www.allied-data.com ...
    (borland.public.delphi.non-technical)