The Knapsack Problem & Genetic Algorithms - Computerphile

  Рет қаралды 226,571

Computerphile

Computerphile

3 жыл бұрын

Tournament selection, roulette selection, mutation, crossover - all processes used in genetic algorithms. Dr Alex Turner explains using the Knapsack Problem.
/ computerphile
/ computer_phile
This video was filmed and edited by Sean Riley.
Computer Science at the University of Nottingham: bit.ly/nottscomputer
Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

Пікірлер: 268
@Kydos37
@Kydos37 3 жыл бұрын
Finally I can work out what loot to take in Skyrim.
@Ziferten
@Ziferten 3 жыл бұрын
Skyrim? Son, if I knew about this in 1999 I'd SOJs on SOJs in D2...
@steveb1243
@steveb1243 3 жыл бұрын
Shiniest stuff first. Always. After that then apply a genetic algorithm, obviously, but not until the shiny stuff is all taken, even if that means you have to walk all the way back to Whiterun.
@thesteve4235
@thesteve4235 3 жыл бұрын
15 forks, a wheel of cheese, some clothes you cant wear, and a cabbage.
@gJonii
@gJonii 3 жыл бұрын
This problem is simpler than skyrim tho. With skyrim, you won't know all the items ahead of time, rather you get item and have to keep or discard without knowing future items.
@BangsarRia
@BangsarRia 3 жыл бұрын
Take the calipers, only the calipers; leave everything else. Problem solved. (Still looking for calipers in Skyrim.)
@Brunoenribeiro
@Brunoenribeiro 3 жыл бұрын
Usually it takes me two hours to pack my bags Now it'll take hundreds of generations
@opkp
@opkp 3 жыл бұрын
you are Bruno Ribeiro
@ranggakd
@ranggakd 2 жыл бұрын
hahahahahhah
@LeaderOfMetal93
@LeaderOfMetal93 2 жыл бұрын
@@opkp yyyup.....?
@OfficialFraq
@OfficialFraq 3 жыл бұрын
I was taught by Alex in my first year at the University of Hull; he was always such a kind, interesting, and intelligent lecturer. I'm glad to see his prowess shown off to the world here.
@DieMiinz
@DieMiinz 3 жыл бұрын
Genetic algorithms are cool. I wrote one in college to find patterns in Conway's game of life that resulted in the densest and longest lasting sequences. It's horribly slow, even on 10 threads, and I've never seen it reach the ideal on anything bigger than a 15x15 grid, but it always produces fun results.
@gerritgovaerts8443
@gerritgovaerts8443 3 жыл бұрын
evolution also takes millions of years . GA will converge to a global optimum , given enough time and a very big population
@noamlima9402
@noamlima9402 3 жыл бұрын
@@gerritgovaerts8443 hm
@noamlima9402
@noamlima9402 3 жыл бұрын
@@gerritgovaerts8443 hm
@ismailsahbane1783
@ismailsahbane1783 3 жыл бұрын
Oh my I am litterally trying exactly that right now, I didn't imagine anyone else had the same idea before
@jafarOTS
@jafarOTS 3 жыл бұрын
@@gerritgovaerts8443 not really, if the mutation rate and crossover is not well selected it might reach a local optimum and never reach a global optimum
@essem2Plays
@essem2Plays 3 жыл бұрын
5:18 that dying sound :,D
@squishmastah4682
@squishmastah4682 3 жыл бұрын
Right?
@Ensorcle
@Ensorcle 3 жыл бұрын
Bergen: a special backpack used by the Brittish military. Looks like a daypack. From the name of the manufacturer. "As for the nickname, “Bergan” is an adaptation of the name of the Norwegian backpack manufacturer Bergans,"
@bengilbert2780
@bengilbert2780 3 жыл бұрын
I needed this
@ButzPunk
@ButzPunk 3 жыл бұрын
Thank you! I re-listened to that bit like 5 times trying to figure out what he was saying.
@TofranBohk
@TofranBohk 3 жыл бұрын
Thank you.
@Nilguiri
@Nilguiri 3 жыл бұрын
Ah! The famous Bergan. Never heard of it, so thanks!
@allwhatyouwant
@allwhatyouwant 3 жыл бұрын
source?
@NathanTAK
@NathanTAK 3 жыл бұрын
"You have a knapsack" ? "Which is like a rucksack" ??? "Or a Bergen" ?????????????!???!
@liltonyabc
@liltonyabc 3 жыл бұрын
Backpack
@recklessroges
@recklessroges 3 жыл бұрын
It's like a cloth portmanteau that closes with a zip rather than buckles. ;-)
@TofranBohk
@TofranBohk 3 жыл бұрын
@@violet_flower Heyooooo!
@auto_ego
@auto_ego 3 жыл бұрын
Don't worry, I sent him a note informing him of a more general, if somewhat obscure term: "Bag"
@ShankarSivarajan
@ShankarSivarajan 3 жыл бұрын
It's like a haversack.
@Kingsly9802
@Kingsly9802 3 жыл бұрын
It'd be nice to have a second episode on this discussing GA and local maxima.
@user-vn7ce5ig1z
@user-vn7ce5ig1z 3 жыл бұрын
8:57 - Sean took the words out of my mouth (or thought out of my head 🤔); this makes more sense when dealing with a large number of items and variables, otherwise it's more efficient to just brute-force the permutations. Back in the day, when I was trying to figure out the best way to put files on floppy disks (and later, CDs) to minimize wasted space, I just did it manually.
@harryganz1
@harryganz1 3 жыл бұрын
I mean, the standard solution is to use dynamic programming and a memo. The worst case is still no better than brute force, but it usually does pretty well.
@richardspillman2363
@richardspillman2363 2 жыл бұрын
Great presentation. You are so right about ga’s. They are fun to work with and sometimes can find interesting solutions to hard problems. Around 20 years ago I published a series of articles developing ga’s to break ciphers. One was a paper on using ga’s to break the knapsack cipher which true to form showed some promising results.
@KilgoreTroutAsf
@KilgoreTroutAsf 3 жыл бұрын
The main problem with all these heuristic algorithms is the vast number of metaparameters that need to be adjusted for them to be efficient and the fact that there is no a priori way to make an informed decision on which initial values are likely to be ok for the specific problem at hand.
@piotrarturklos
@piotrarturklos 3 жыл бұрын
You are right but incidentally you are also defining a problem for which a genetic algorithm would be excellent solution (assuming that it was faster to compute, perhaps not a genetic algorithm itself).
@simjans7633
@simjans7633 3 жыл бұрын
I was wondering about genetic algorithms this week! Glad to see a computerphile episode about it now!
@ShubhamBhushanCC
@ShubhamBhushanCC 3 жыл бұрын
Knapsack? You can do it with Dynamic Programming. Also, computerphile you need to do an entire series on Dynamic Programming
@theycallme_nightmaster
@theycallme_nightmaster 2 жыл бұрын
I thought he was about to write out a table and do the classic dynamic solution to the napsack problem lol
@jamjam3448
@jamjam3448 Жыл бұрын
I thought same
@illens08
@illens08 Жыл бұрын
You can also tell whos a compsci undergrad, prolly 3rd-4th year with this problem. They all scream DYNAMIC PROGRAMMING!!! 😂 He picked a problem that worked well for the type of solution he provided. The point of this isn't "how to solve the knapsack problem"
@bensmith9253
@bensmith9253 3 жыл бұрын
This was GREAT! I'm currently teaching Binary Search & Bitwise operations - tgis seems an IDEAL problem to hack in Python before attempting it in Assembly then attempting to establish its time complexity.
@Honest_Reply900
@Honest_Reply900 2 жыл бұрын
One of the best explanation so far. Thanks a lot for your time and efforts.
@Yupppi
@Yupppi 3 жыл бұрын
This sounds like an alternative for what I learned on optimizing course for mechanical engineers. Simplex algorithm which conveniently matlab was happy to do for me if I presented a couple of base functions like objective function. Very interesting stuff.
@benlouden7897
@benlouden7897 3 жыл бұрын
I'll believe anything that a man holding a Crayola pen tells me.
@noamlima9402
@noamlima9402 3 жыл бұрын
so funny abd simple
@Jay-so8se
@Jay-so8se 3 жыл бұрын
Alex, legend. Best lecturer I've been taught by.
@Falla1s
@Falla1s 3 жыл бұрын
Hey Alex! Glad to see your doing well in nottingham, missing you here in hull! Best wishes Alex, from Alex :P
@jordan6266
@jordan6266 3 жыл бұрын
Self brag here. Got 100% grade in Alex's AI module last year. Was super fun, had to program our very own GA to address the coupled inverted pendulum stabilization problem. Looking forward to going to a PG level and studying more AI!
@AS-we9xi
@AS-we9xi 3 жыл бұрын
Why would you not calvulate a value density for each one, order them from highest to lowest then pack it from the top down? For instance the 1:7 has the highest value per unit of mass, then 2:4, 7:5 and 9:2 last. Pack them in that order until you are just under the limit then reorder and recalculate from there? Eliminate any that are over the remainder, then from there down pair any that are between .5 and 1.0x of the remainder and calculate the density of the pairings, iterate over this process until there are no more under the remainder.
@ArturoVelazquez3
@ArturoVelazquez3 3 жыл бұрын
00:16 "I think that's pretty NEAT" I see what you did there ;)
@Lodinn
@Lodinn 3 жыл бұрын
NEAT is such a cool thing!
@DanielKarbach
@DanielKarbach 3 жыл бұрын
That tournament sound effect, love it :D
@timothyleffel3186
@timothyleffel3186 3 жыл бұрын
this guy is a masterful explainer. great work
@drjoyjit
@drjoyjit 3 жыл бұрын
A very nice video and explanation of GAs. I am so happy and proud to have Alex as the co-supervisor of my PhD :-) Thanks for the brilliant tutorial Alex and Computerphile.
@petesansom5737
@petesansom5737 2 жыл бұрын
Nice to see GAs being used. I used them in my dissertation back in 1994, never used them since.
@rohscx
@rohscx 3 жыл бұрын
This is a wonderful explanation, thank you.
@thepaulanator100
@thepaulanator100 3 жыл бұрын
I did my dissertation project on evolutionary algorithms in python and I can say this video is very well done thank you guys 😁
@shimadabr
@shimadabr 10 ай бұрын
What's your opinion about using Python for this kind of algorithm? I'm just starting a research (as an undergraduate) on GA and I'm picking up a project were my colleague left off, but is is in Python. It's a very slow language and my research will involve parallelizing some algorithms to make a comparative study.
@johnkesich8696
@johnkesich8696 3 жыл бұрын
Why do tournament selection instead of picking the two randomly generated solutions with the best scores?
@Tassdo
@Tassdo 3 жыл бұрын
I think it generally leads to more diversity in the population. Otherwise you might end up with only very similar individuals in the population, which then have very similar ofspring. This is bad because you get "stuck" in a small area of the solution space, while the best solution might be in another area of the solution space entirely. If you only take the best individuals you never select mutations which temporarily give bad solutions but might lead to better ones in the long run. Hope that makes sense.
@gingeh1
@gingeh1 3 жыл бұрын
Tassle So is it basically to avoid the equivalent of inbreeding?
@Tassdo
@Tassdo 3 жыл бұрын
@@gingeh1 You could frame it that way (except that inbreeding in this context doesn't really produce worse results, but can prevent producing better ones)
@drd4059
@drd4059 3 жыл бұрын
How does the convergence rate of the genetic algorithm compare with a straight mutation algorithm in which a random bit is flipped (small change) with occasional multiple bits flipped (big change) where the tournament is between the parent and child? I am thinking about data vectors of size > 1000.
@AndreaArturoGiuseppeGrossi
@AndreaArturoGiuseppeGrossi 3 жыл бұрын
I remember, ages ago, some softwares that I used to fill the floppy disks at their maximum capacity. They used the Knapsack algorithm. Nice memories!
@tcritt
@tcritt 2 жыл бұрын
Knapsack is a problem, not an algorithm. There are loads of algorithms that can approximate an answer to the knapsack problem.
@jamesduncan6687
@jamesduncan6687 3 жыл бұрын
Hey Alex 👋👋 Cheers for helping me with my dissertation 🎉🎉
@bengilbert2780
@bengilbert2780 3 жыл бұрын
Me being in aladdin's cave and just sitting down to do maths...
@bokkenka
@bokkenka 3 жыл бұрын
Hopefully, you have access to, and time on, a supercomputer to calculate it all out.
@benmaghsoodi2067
@benmaghsoodi2067 3 жыл бұрын
It's Alibaba
@sadhappy8860
@sadhappy8860 3 жыл бұрын
Wonderfully well explained
@padmaprabagaran367
@padmaprabagaran367 2 жыл бұрын
Hi I really enjoyed this video and was wondering if you could point me to any resources you would recommend to get a better understanding of some real-world applications. Thanks!
@PrasadIndi
@PrasadIndi 3 жыл бұрын
Nicely explained. I did use GA in my master's thesis.
@peterantonaros6461
@peterantonaros6461 3 жыл бұрын
Interesting what did it include?
@TylerWasick
@TylerWasick 3 жыл бұрын
I would love if you guys did a video explaining CHAP!
@sagaradoshi
@sagaradoshi Жыл бұрын
Thanks for the wonderful presentation. .. I got to the point that from example you considered the initial population and each iteration you went generating 8 or 16 children observing increasing in fitness values of population...What I didn't get was what was the final results? what is that your bag was finally filed with (for instance considering example you took which one items ended up in the bag)?
@yensteel
@yensteel 3 жыл бұрын
How is GA vs particle swarm optimization? Is NSGA ii still recommended? Mostly for multi objective optimization usage :) . Is there a technique that is more deterministic yet reliable enough to avoid local minima? How about one that is computationally efficient for quick and dirty estimates?
@forthrightgambitia1032
@forthrightgambitia1032 3 жыл бұрын
I see Dr. Ferrante Neri is at Nottingham now. I did a course with him on Optimisation when I was at DMU, you should ask him about memetic algorithms!
@KanaalMTS
@KanaalMTS 3 жыл бұрын
Could this be done with the 3D Bin Packing Problem as well? Seems like a better solution than brute forcing
@raadal-husban654
@raadal-husban654 3 жыл бұрын
Fascinating and somehow related to simulated annealing - at least in how neighbors are created by manipulaing random bits of the candidate solution . I found that the latter gives a solution within 3% of the optimal ones for big knapsack problems with 1000+ items
@architlatkar2503
@architlatkar2503 3 жыл бұрын
But in which scenarios should we use it?
@Stl71
@Stl71 2 жыл бұрын
I've been struggling a lot with the minimum set cover problem...If anyone has another fast and efficient algorithm, except the greedy one, I will be happy to see it.
@wodniktoja8452
@wodniktoja8452 3 жыл бұрын
QUESTION Wouldn't it be the same as we just type algorithm that calculate every value one by one combination and compare with the variable MAX?
@pippinjunior2109
@pippinjunior2109 3 жыл бұрын
Struggling with this, in the given scenario wouldn't simple loops checking the actual criteria allow us to score the "Loot" with absolute accuracy?
@interested_in_everything
@interested_in_everything 3 жыл бұрын
Nice Animations Brady!
@Zonno5
@Zonno5 Жыл бұрын
Is it correct for crossover you need the input parameters to be independent?
@DailyFrankPeter
@DailyFrankPeter Жыл бұрын
How would you formally explain why this problem should be solved with GA and not a neural network? Would you agree it's because the fitness function is not a continuous function? Also, can you recommend a book on GAs?
@eduardoandrescastilloperer4810
@eduardoandrescastilloperer4810 3 жыл бұрын
- This problem is trivial DP Students: 😭
@TVIDS123
@TVIDS123 3 жыл бұрын
What's DP? I heard my mum mention it to my dad and uncle.
@xfxxgj7086
@xfxxgj7086 3 жыл бұрын
@@TVIDS123 dynamic programming
@anderson7671
@anderson7671 3 жыл бұрын
@@xfxxgj7086 He was joking hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha
@OliverUnderTheMoon
@OliverUnderTheMoon 3 жыл бұрын
I once worked with a developer whose boss had asked him not to use the word "trivial" because it was giving clients the wrong idea.
@carlturland
@carlturland 3 жыл бұрын
@@xfxxgj7086 Actually... I think DP in this case is Diploma. The IB DP computer science exam is on genetic algorithms next year.
@RedMcPsycho
@RedMcPsycho 2 жыл бұрын
Please please please do a video on other population based optimization algorithms such as particle swarm optimization, differential evolution and artificial immune system!
@domc2452
@domc2452 3 жыл бұрын
This video makes me want to revisit Boxcar2D :)
@fennecbesixdouze1794
@fennecbesixdouze1794 3 жыл бұрын
@9:00 that feeling when the guy just said a problem which is provably as hard as any NP-complete problem is "trivial".
@ark5458
@ark5458 3 жыл бұрын
Is it possible to simulate a simple rna organism with code?
@domsau2
@domsau2 3 жыл бұрын
Try it! ;-)
@Slithy
@Slithy 3 жыл бұрын
It's probably pretty easy for a knowledgeable person. With some approximations, of course.
@rohanraonallani561
@rohanraonallani561 3 жыл бұрын
Yes
@dianamuniz1990
@dianamuniz1990 3 жыл бұрын
You might be interested in artificial life, the CS field that aims to emulate life in computers
@JinKee
@JinKee 3 жыл бұрын
If you're talking about a RNA virus that makes a bunch of proteins that then need to deliver the RNA payload into new cells to infect, you'll need some way to estimate how well those proteins work. You might need to find a solution to or a way to bypass the "folding problem" which is that a protein with a specific sequence of amino acids in water always folds into the same shape, but predicting the shape it will take out of all possible shapes it could take is very hard. The shape it folds into determines how well the protein works.
@sembutininverse
@sembutininverse 3 жыл бұрын
thank you, it helped me a lot 🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@pedrofurla
@pedrofurla 3 жыл бұрын
Now I want to hear more about it.
@nathantaylor1434
@nathantaylor1434 3 жыл бұрын
So im curious what is best solution to this problem being explained?
@corvo1068
@corvo1068 3 жыл бұрын
1110 is the best, with a value of 16 and a weight of 10. We can't have all 4 pieces (that would be 19 kg), but if we remove the least valuable piece, we are already under 15 kg.
@coolgamer12377
@coolgamer12377 3 жыл бұрын
dynamic programming
@bensmith9253
@bensmith9253 3 жыл бұрын
I think the "solution" is the generalized algorithm - solving this SPECIFIC problem is not really the point.
@DavidKing-wk1ws
@DavidKing-wk1ws 3 жыл бұрын
You would think ideas like this would be applied to computer language compilers to create better machine language code to reduce file sizes. However it could loose some abstraction.
@u2lover10
@u2lover10 11 ай бұрын
I think it's the ost fun algorithm I've learned so far. Thanks :)
@jonathancronqvist9960
@jonathancronqvist9960 3 жыл бұрын
hazy or is it like no sompile is not hey dough?
@levyroth
@levyroth 3 жыл бұрын
What's a fast alternative to this algorithm? Something suitable for near real time sorting? Great explanation otherwise, you summarised in a few minutes an entire class I took for a semester.
@pauligrossinoz
@pauligrossinoz 3 жыл бұрын
This type of algorithm is used when there is no obvious alternative - meaning that there is no known 'faster' way, and also if a brute force search is impossible due to the huge number of possible solutions (aka 'combinatorial explosion').
@pauligrossinoz
@pauligrossinoz 2 жыл бұрын
@ambassador - a simple loop that requires an astronomical number of iterations isn't feasible, unless you have an astronomical amount of time. This problem is known as the combinatorial explosion.
@k10forgotten
@k10forgotten 3 жыл бұрын
yay for combinatorial optimization! :DD
@NateYaquinto
@NateYaquinto 2 жыл бұрын
Imagine getting the birds and the bees talk from this guy. 'Well you see, there's a knapsack problem.... and through an evolutionary ranking, weighting, and robustness selection system, parents with the best scores are chosen, then half of the genetic ones and zeros from each parent is taken and combined to form a child, toss in a little random mutation here or there and repeat the process until you reach an optimal point in the population distribution curve and BOOM, out pops a baby from "Aladdin's cave'.
@pvd4170
@pvd4170 2 жыл бұрын
Thank you for perfect explanation!)
@mileshkumar3666
@mileshkumar3666 2 жыл бұрын
Is there a special name for the kind of paper used? I love it😍
@vholes2803
@vholes2803 2 жыл бұрын
Look up pictures of "fan fold paper" and "line printers". Oh, the memories. Nottingham seems to have infinite supplies of this paper. :)
@silviogames
@silviogames 3 жыл бұрын
it may be because of the simple example but why is this genetic algorithm 'better' than just creating a list with all possible permutations and then finding the best one in there?
@aakifaslam6098
@aakifaslam6098 3 жыл бұрын
It works well for even more complicated problems, where listing all permutations is not possible. Stuff with many continuous variables. Check out CaryKH's evolution simulator on KZfaq for another example
@cavalrycome
@cavalrycome 3 жыл бұрын
They're only useful when it's not practical to do a brute force search (i.e., when evaluating every possible permutation would take a very long time).
@mihir2012
@mihir2012 3 жыл бұрын
Remember the last part of the video. Even for 100 boxes, each solution is 100 bits long and as such there are 2^100 solutions to search through. That's already a massive amount of data to search through by brute force. Also consider that the solution space for this problem was discrete and finite, it could be made infinitely big by a very small change in the problem. If you had liquids instead of boxes, you would need to consider taking 0.5 units or pi units or 2.2852 units of liquid. Basically it would be fundamentally impossible to list all solutions.
@LukePluto
@LukePluto 3 жыл бұрын
Usually, knapsack problems are solved with dynamic programming which caches previous computations to reduce the time complexity to polynomial time. Idk how it works with random mutations
@PopeLando
@PopeLando 3 жыл бұрын
It's NP-hard.
@martinmickels1478
@martinmickels1478 Жыл бұрын
the animations help make it more comprehensible
@NoctLightCloud
@NoctLightCloud 3 жыл бұрын
excellent! thank you
@maheshkarigoudar117
@maheshkarigoudar117 3 жыл бұрын
Omg what a clear explanation
@shandou5276
@shandou5276 3 жыл бұрын
Superbly lucid!
@abdullahamrsobh
@abdullahamrsobh 3 жыл бұрын
can't this problem be solved using nomral optimization algorithms?
@jursamaj
@jursamaj 3 жыл бұрын
Yes, and probably done better than with a GA.
@allahwetrust9626
@allahwetrust9626 7 ай бұрын
yo why not just runing it a while loop that reads preinstalled binaries of the cases ..... if the nmber is max it break if not it continues processing the all the possible cases
@kyleallain5923
@kyleallain5923 3 жыл бұрын
What is the alternative to no crossover? Randomly select a parent and make the child as a copy?
@jursamaj
@jursamaj 3 жыл бұрын
If that's all you're going to do, then you're done on the 1st round. You'd never generate any *new* combinations, so the best solution on the 1st round is the best you'll ever have.
@kyleallain5923
@kyleallain5923 3 жыл бұрын
@@jursamaj yea, I implemented a random pivot point for my crossover. I was just curious because he mentions a crossover rate and I was assuming that meant a % chance for crossover to occur.
@jursamaj
@jursamaj 3 жыл бұрын
@@kyleallain5923 Possibly that, or a random point along the length for crossover, which is more like what happens with real genetics. Every chromosome gets at least 1 crossover per reproduction, and can get more.
@TheCoryKid
@TheCoryKid 3 жыл бұрын
This guy is great.
@nagesh007
@nagesh007 2 жыл бұрын
Amazing thanks
@BytebroUK
@BytebroUK 3 жыл бұрын
Utterly irrelant to your lovely video but... I have tried like a mad Google-searching thing and I cannot find proper 123-column line-printer paper, preferably with the kindo of 'music-ruled' stuff on every other line like you were using in this! Pretty-please tell me where I can buy that? I want to educate some of my younger colleagues about debugging from a hex dump using just a source listing, a core dump, and a highighter pen - and we all know you can only do that on 'proper listing paper' :)
@BytebroUK
@BytebroUK 3 жыл бұрын
s/irrelant/irrelevant/ sorry!
@Computerphile
@Computerphile 3 жыл бұрын
In the UK I just search "music lined tractor feed printer paper" or "continuous stationery" - last two batches were bought from a company called Paperstone hth -Sean
@BytebroUK
@BytebroUK 3 жыл бұрын
@@Computerphile Hah! Just found them, and I think it's wonderful that the paper size is "11 inch x 362mm"!! Get your units sorted out people! (And thank you for the pointer)
@eldizo_
@eldizo_ 3 жыл бұрын
They are definitely great for blocking!
@marco.nascimento
@marco.nascimento 3 жыл бұрын
awesome, quite interesting
@morkovija
@morkovija 3 жыл бұрын
The problem with this sort of algorithms is that sometimes most efficient solution is not necessarily the most complex one
@jursamaj
@jursamaj 3 жыл бұрын
But the algorithm isn't looking for complexity…
@morkovija
@morkovija 3 жыл бұрын
@@jursamaj i know, its just that if you're looking for complex solutions to problems - this might not be it.
@jiteshjhawar1106
@jiteshjhawar1106 3 жыл бұрын
How does github work???
@p-aluneau5136
@p-aluneau5136 3 жыл бұрын
How do you assure that your solutions respect the weight constraint? Do you eliminate children that violate it?
@massimookissed1023
@massimookissed1023 3 жыл бұрын
Yep, they're culled. They would be the Darwinistic equivalent of dying before reproducing.
@andrewtaylor9433
@andrewtaylor9433 3 жыл бұрын
How do you know when to stop?
@pauligrossinoz
@pauligrossinoz 3 жыл бұрын
When to stop: Keep track of the overall population average fitness, and if several generations pass without the population fitness improving, call it quits and present the currently fittest solution as the final answer.
@massimookissed1023
@massimookissed1023 3 жыл бұрын
8:52 ...
@ranggakd
@ranggakd 2 жыл бұрын
9:48 what can be useful?
@Jkauppa
@Jkauppa 2 жыл бұрын
have you ever calculated specific energies, ie, kwh/kg, maximize that
@Jkauppa
@Jkauppa 2 жыл бұрын
minimize the weight, dont try to fill the knapsack
@Jkauppa
@Jkauppa 2 жыл бұрын
sorting a set of new (pca) variables, 0.72, 2, 7, 0.22, should give you a preferred order of selected items of [3,2,1,4], then just add up weights, it will be (breadth first search, quaranteed best solution fast, ie, always take the best item you can fit, then skip over if it does not fit, ie, always the best), in order of [3,2,1,4] w=0->1->3->10->19, so this algorithm gives a selection of set [1,2,3], with a weight of 10, which is under 15, but is it the optimum
@Jkauppa
@Jkauppa 2 жыл бұрын
the first suggested algorithm gives value of 16, not NP complete, at all, mostly radix ratios
@Jkauppa
@Jkauppa 2 жыл бұрын
try solving go with local focus zones, having a tractable 2^n size, times the total number of same size focus zones (like visual neuron focus zones), so not 2^n in one focus zone, but N*2^n is approximately linear with the number N size of the zones that fit the go game board
@Jkauppa
@Jkauppa 2 жыл бұрын
pca the other dimensions, down to one sortable number, ie, value against weight and size, ie k-sort-value = value/(weight*size)
@resinsmp
@resinsmp 3 жыл бұрын
Mentally this is similar to picking the best first car to begin with in a racing game.
@midhunrajr372
@midhunrajr372 3 жыл бұрын
It would have reeeaaaaallly helped if you said the complexity comparison with other algorithms like dynamic programming on knapsack problem.
@mikolajwojnicki2169
@mikolajwojnicki2169 3 жыл бұрын
It's probably much worse in simple cases like with just weight and value, but I can imagine that if the problem becomes more complex, it will get more and more difficult to solve it with dynamic programming
@thom_wye
@thom_wye 3 жыл бұрын
it appears I was already working on the knapsack problem without knowing it while playing skyrim. You just loot only gold itself, gemstones and jewellery )
@tokeeptrackofrandomsubs5899
@tokeeptrackofrandomsubs5899 3 жыл бұрын
That would optimise the total value of one haul, but maybe you should make it more complex and take "effort to bring this home or sell it" into it as well. If there is for example cheese or a bucket to be looted next to your house or a vendor that could be worth taking, but if it's a longer trip then that additional effort would not make it worthwhile.
@arik_dev
@arik_dev 3 жыл бұрын
My way of doing it was always to only pick up items with a gold/weight ratio of over 10, which was easy to calculate in my head. Remove the last digit from the value, if it's greater than the weight, keep it. Once I got full, I'd make more room by dropping the items with the lowest value/weight ratio until I could pick up the new item. If I wanted to optimize it completely for value, then I shouldn't have discriminated against ratios of less than 10, but then you spent to much time picking up and dropping things, so I optimized partially for my quality of life haha.
@nickb3164
@nickb3164 3 ай бұрын
this problem seems like a bad example for the method being discussed to me? I imagine a much better solution would be to find value divided by weight for each item and choose the highest until you run out of room.
@lucasgabrielmalheiros5589
@lucasgabrielmalheiros5589 3 ай бұрын
It is a great example. What you have proposed is called a greedy heuristic, and is not guaranteed to provide an optimal solution for the knapsack problem. Knapsack problems (it leads to many applications, think about any decision under capacity or budget constraints) are highly complex and there are no known algorithms or heuristics that are just "the best" to solve all instances of them.
@nickb3164
@nickb3164 3 ай бұрын
@@lucasgabrielmalheiros5589thank you for the clarification that makes sense, i can see how multiple parameters would make it a lot harder
@WimmelJan
@WimmelJan 3 жыл бұрын
Can we have a video on "off the record messaging"? This was the technology used in EncroChat, the cryptographic communications system used by criminals and cracked by law enforcement agencies.
@squishmastah4682
@squishmastah4682 3 жыл бұрын
It's a quick read. I believe the Signal protocol was based on it, or at least inspired by it
@dannygjk
@dannygjk 3 жыл бұрын
Oh you confused me when you called a match a tournament because a match is a series of games, (or one game in the simplest case), played between two players. One game between two players is not a tournament. A tourney is when 3 or more players are involved.
@noamlima9402
@noamlima9402 3 жыл бұрын
C418 - match cut (dna music)
@dannygjk
@dannygjk 3 жыл бұрын
@@noamlima9402 Huh??
@noamlima9402
@noamlima9402 3 жыл бұрын
@@dannygjk something similar
@dannygjk
@dannygjk 3 жыл бұрын
@@noamlima9402 I have no idea what you mean.
@noamlima9402
@noamlima9402 3 жыл бұрын
@@dannygjk cognition
@N3omega
@N3omega 3 ай бұрын
Guys, he’s talking about what ASML is
@optimization9040
@optimization9040 3 жыл бұрын
Who could not fully focus on the tutorial because the professor is TOO handsome? By the way, I really like the knapsack simulation.
@BAD_CONSUMER
@BAD_CONSUMER 3 жыл бұрын
Just call it a bag!
@Yezpahr
@Yezpahr 3 жыл бұрын
Ah, so that's how you stack your items in Diablo most efficiently. Thanks.
@iamr0b0tx
@iamr0b0tx 10 ай бұрын
Kudos to the animators and voice over 😂
@asailijhijr
@asailijhijr 3 жыл бұрын
It seems like you can solve this knapsack problem using calculus.
@benjamincrawford750
@benjamincrawford750 3 жыл бұрын
Dont get all the elemental frequencies. It will twist on the outside.
@mehmetdemir-lf2vm
@mehmetdemir-lf2vm 3 жыл бұрын
first you had to mention about the reason for not using a better algorithm that gives optimal solution.
@LeandroFRobledo
@LeandroFRobledo 3 жыл бұрын
QUIERO SUBTITULOS !
@kstergiou3
@kstergiou3 3 жыл бұрын
Gotta love the 'No Views'
@HenryLoenwind
@HenryLoenwind 3 жыл бұрын
lol, and now everyone's talking about the problem that was picked to show how the algorithm works instead of the algorithm itself...
Dijkstra's Algorithm - Computerphile
10:43
Computerphile
Рет қаралды 1,3 МЛН
Gym belt !! 😂😂  @kauermtt
00:10
Tibo InShape
Рет қаралды 16 МЛН
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 14 МЛН
Programming Loops vs Recursion - Computerphile
12:32
Computerphile
Рет қаралды 1,5 МЛН
The 0/1 Knapsack Problem (Demystifying Dynamic Programming)
20:30
Back To Back SWE
Рет қаралды 203 М.
What are Genetic Algorithms?
12:13
argonaut
Рет қаралды 35 М.
13. Learning: Genetic Algorithms
47:16
MIT OpenCourseWare
Рет қаралды 519 М.
Genetic Algorithms in Python - Evolution For Optimization
26:10
NeuralNine
Рет қаралды 12 М.
Maze Solving - Computerphile
17:15
Computerphile
Рет қаралды 1,1 МЛН
Has Generative AI Already Peaked? - Computerphile
12:48
Computerphile
Рет қаралды 899 М.
Random Boolean Networks - Computerphile
11:51
Computerphile
Рет қаралды 62 М.
SHA: Secure Hashing Algorithm - Computerphile
10:21
Computerphile
Рет қаралды 1,2 МЛН
Gym belt !! 😂😂  @kauermtt
00:10
Tibo InShape
Рет қаралды 16 МЛН