Tumgik
#knapsackproblem
Text
Tumblr media
What is Sorting Network? . . . . for more information http://bit.ly/3Gr9QpT check the above link
0 notes
beautywithcodes · 4 years
Video
youtube
Optimization Problem using Greedy Algorithms || Knapsack Problem || Huff...
0 notes
Text
Everything I needed to know about trip planning I learned while getting my Master of Science degree
I’m a mathematician, so it’s not a huge surprise that I tend to view things through a mathematical lens, however I was shocked how much mathematics there is in planning a trip.
There is a well known math problem called the traveling salesman problem. In this problem, a travelling salesman has a bunch of cities he’d like to visit and wants to find the shortest path that allows him to visit all the cities exactly once. Don’t worry, I’m not going to rehash the choice of cities from my previous post. That’s all done. Mathematicians like to categorize things, and one thing that we do is categorize problems by how long it takes computers to solve them. The travelling salesman problem is a problem that takes a computer a very, very, long time to solve, or “NP”. You may have heard this language before in the “P vs NP” millennium problem. Problems that are “P” might take awhile for your computer to churn through (think uploading a large file to the internet), especially if you’re working with big files, but generally will at worst be “I have to leave my computer running overnight”. NP problems, if you want to do them on any kind of scale, quickly move into “this problem might be done before the sun runs out of fuel, if you’re lucky.” I’m massively oversimplifying a lot of very interesting mathematics here. Don’t at me Computability Theorists, I’m trying to make a joke.
But the travelling salesman problem has nothing on the travelling tourist problem. A tourist is not a salesman; she’s not on the clock, so she has a lot more flexibility. I can choose my landmarks, and I am going to prioritize some over others. For example I’m not looking for nightlife, so the hottest club would be low priority, however I really want to see the Curie Museum (yes, dork, I know). I also can choose how long I spend at each attraction (would you rather stay an extra hour at the Louvre, or climb the Eiffel Tower?). The more choices you have, the harder it gets to find the optimal solution. This is because there are more possible combinations which means more possibilities to check. Computers, they experience decision paralysis, just like us. Even so it might (MIGHT!) be possible to write an algorithm to optimize my path through each city, but it would involve as much effort as the average a PhD dissertation, and I just got OUT of school. On the other hand a group did find the optimal pub crawl through the entire United Kingdom (http://www.math.uwaterloo.ca/tsp/pubs/). Seeing as I leave in less than twenty four hours, and that project took them about 2 years it’s clear I’m a little behind schedule.
Okay, so no optimization algorithms for day planning. I guess I’m stuck making lists of places I absolutely must see, places I want to see, and places it would be nice to see, plotting them on maps and using ye olde eye test to do my best.
But what about packing? We spent two weeks in my mathematical optimization class studying the knapsack problem, which is literally about finding the optimal way to pack a bag for a trip. Due to the inductive magic of dynamic programming, and the fact that there’s less flexibility (each object is either in, or out) I probably would be actually able to solve this one. The problem would be that in order to do so I would have to have a database with the weight and dimensions of every object I might want to pack. And I have better things to do than sit around weighing and measuring all my possessions.
I guess I’ve got to give up my dream of finding the mathematically optimal solution to my vacation. I’ll just have to hope that even if my vacation isn’t mathematically optimal, it will still be a very good time.
2 notes · View notes
javavarshin-blog · 7 years
Photo
Tumblr media
#javacodes #javaprogramming #javadeveloper #knapsackproblem Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. In other words, given two integer arrays val[0..n-1] and wt[0..n-1] which represent values and weights associated with n items respectively. Also given an integer W which represents knapsack capacity, find out the maximum value subset of val[] such that sum of the weights of this subset is smaller than or equal to W. You cannot break an item, either pick the complete item, or don’t pick it (0-1 property).
0 notes
olmuycam · 13 years
Text
En sevdiğim diyalog :)
- What's the problem?
+ Knapsack problem :/
0 notes
Text
Tumblr media
What is Kruskal's Algorithm? . . . . for more information http://bit.ly/3Gr9QpT check the above link
0 notes
Text
Tumblr media
What is the Knapsack Problem? . . . . for more information http://bit.ly/3Gr9QpT check the above link
0 notes
olmuycam · 13 years
Video
youtube
Coldplay - Paradise (Peponi) African Style (Piano/Cello) Cover - The Piano Guys ft. Alex Boye (ThePianoGuys tarafından)
Yeniliklere açık olmalı insan :)
9 notes · View notes