Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^4: knapsack problem solved by regex

by rubasov (Friar)
on Mar 14, 2010 at 18:29 UTC ( #828602=note: print w/replies, xml ) Need Help??


in reply to Re^3: knapsack problem solved by regex
in thread knapsack problem solved by regex

Think of the following: a solution to the 0-1 knapsack problem can be easily generalized to the bounded case, you just have to explicitly list the items with nr>1. Think of my previous example as this (just written abbreviated there):
w v v/w 3 3.1 31/30 # case a 2 2 1 # case b (together with the following line) 2 2 1 # case b

Replies are listed 'Best First'.
Re^5: knapsack problem solved by regex
by BrowserUk (Pope) on Mar 14, 2010 at 18:34 UTC

    I see. Two different items with the same values and weights. Gotcha.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://828602]
help
Chatterbox?
[shmem]: no. You're right.
[msh210]: About time... last time I was right was... I don't even remember when.
[shmem]: perl -e 'warn "test$/", ^@^ '
[Eily]: well, at least it's right about warn doing the same thing as die :)
[shmem]: same with undef as last element
[msh210]: oh, good point. It's the best kind of correct
[shmem]: msh210: but I'd not call it a lie outright. That's when you do know the truth.
[msh210]: I don't have sendmail (I'm on MS Windows), so does one of you think you can report the bug?
[shmem]: msh210: 'tis about time to tell the sad truth to perl5porters - via perlbug
[msh210]: probably whoever wrote that actually knows the truth

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (16)
As of 2017-04-24 12:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (439 votes). Check out past polls.