CLOSE
YouTube // poprhythm
YouTube // poprhythm

Solving the Traveling Salesman Problem

YouTube // poprhythm
YouTube // poprhythm

The Traveling Salesman Problem (TSP for short) is a classic problem in computer science. Wikipedia succinctly states the problem like so:

Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?

First formalized in 1930, the TSP has been studied and fiddled with ever since. There are lots of ways to try solving the problem, but the devil is in the details. Most of us start with a simple assumption: Let's pick a starting city, then just start walking around the map, choosing the nearest city every time. Rinse, repeat. This algorithm is called "Greedy," and while it does a reasonable job for very short routes, it often fails to make the overall route the shortest, because it doesn't consider the entire route. (It "greedily" chooses the optimal choice in each leg of the route, at the possible expense of the larger route.)

Take a look at this video, illustrating several algorithms for solving the TSP, and compare the complexity of the solutions. Computers are rad.

Read more about this video from its creator, James "poprhythm" Kolpack. For a lot more on this problem and why it matters, check out this lecture.

[h/t: Kottke.]

nextArticle.image_alt|e
iStock
arrow
Live Smarter
How To Get Past the iPhone-Crashing 'Death Emoji'
iStock
iStock

The rapid churn of new smart phone hardware and software gives consumers more tech choices at a faster clip. Unfortunately, that schedule can also mean glitches slip through the cracks.

TechRadar is circulating word of the latest bug to affect iPhone and iPad models running iOS 11 software. If a user receives a text message containing a black dot sandwiched between the less-than and greater-than symbols (< >) followed by a left-facing pointing finger emoji, the Messages app will freeze. Quitting and re-opening the app will just return you to the last message viewed.

The bug originated on WhatsApp but migrated to iMessage. If someone with malice on their mind sends you the emoji string, your phone’s text functioning shuts down.

A screen shot of an iPhone with a corrupt emoji message
EverythingApplePro, YouTube

The software gives up because this unique emoji string contains a very long run of invisible Unicode that it simply can’t process all at once.

Fortunately, there's a solution. After your Messages app crashes, use 3D Touch on the Messages icon on your home screen. From there, you can select New Messages and bypass the corrupt emoji string. When you swipe left from the main Messages menu, you’ll be given the option of deleting the problem text. That should restore function.

The bug isn’t strictly limited to iPhones and iPads. Some Macs could be temporarily corrupted by the string as well. Now that Apple is aware of the issue, users can expect a fix shortly.

[h/t TechRadar]

nextArticle.image_alt|e
iStock
arrow
Live Smarter
5 Tips for Cleaning Your Laptop, Both Inside and Out
iStock
iStock

While you may occasionally clear off your desk and take a Lysol wipe to it, chances are you don't often do the same for your laptop. One 2016 swab-test by an IT training website found that its computer keyboards were home to as many germs as a toilet seat, and its laptop track pads were home to as many as paper money. So yeah, your computer could probably use a wipe down. And while you're at it, clean up a few files, too, as WIRED recommends.

First, before you do anything, make sure to turn your computer off and unplug any external keyboards or computer mice you intend to clean.

THE LAPTOP CASE

Once everything is powered down, you can take a damp cloth or sponge to the exteriors. Don't use anything stronger than a diluted soap, and make sure that you're using as little liquid as possible on a wrung-out microfiber cloth or a sponge. Dummies recommends five parts water, one part mild dish detergent for the job, while Apple cautions against using window cleaners, household cleaners, aerosol sprays, solvents, ammonia, abrasives, or cleaners containing hydrogen peroxide to clean a display screen, as well as spraying anything directly onto your device. After you clean the outside of the laptop case with a damp cloth, wipe everything down again with a dry one to make sure you get rid of any excess liquid.

THE SCREEN

You want to be extra-careful while cleaning your screen, ensuring that you neither scratch it nor damage it with liquid. To do so, you’ll want to start out with just a dry, microfiber cloth before moving on to anything damp. If that doesn't do the trick, try a microfiber cloth dampened with just water. If all else fails, you can buy specific screen-cleaning wipes designed for the task, or use that same diluted soap mixture as CNET recommends. Again, if you're going to use water, make sure to wring out as much liquid as you can from the sponge or towel so that you don't get your screen all wet. (This will work for your TV screen as well.)

THE KEYBOARD

When it comes to cleaning your keyboard, you need to be very cautious about not letting water get in under the keys. Use a can of compressed air or a small vacuum to get rid of any crumbs that might have gotten in between the keys. Hold your keyboard up at a 75° angle while you spray the compressed air inside, rotating the keyboard as you go, to get the most crumbs to fall out. (It should be not-quite vertical, Apple says.) Then, break out a bottle of rubbing alcohol, which evaporates faster than water and won't leave any traces of oil. Use an alcohol-dampened cloth to clean the grease from your keyboard keys, then use Q-tips to clean the areas between the keys. Again, you want to keep things pretty dry, so don't overdo it with the liquid, and don't stick the Q-tip inside the keys—just scrub in the areas between them.

THE TRACKPAD AND MOUSE

Next, you should tackle the trackpad with another damp, lint-free cloth, cleaning off the oils that have accumulated there with alcohol or water. If you're using a mouse with a sensor (rather than a ball), you can use compressed air to clean out any debris. Then, just wipe the exterior down as you did the rest of your devices.

CLUTTERED FILES

Once your laptop's outsides are squeaky clean, you may want to clean up some digital junk to keep your computer running smoothly. Delete all the useless screenshots from your desktop, clear out your downloads folder, and empty your trash can. Take a look in your applications, and delete programs that you never use. If you have Mac's latest OS, High Sierra, your laptop will actually do some of this cleanup for you—there is a "reduce clutter" option if you go to About This Mac > Storage. As a last step, you may want to update your operating system and applications.

SECTIONS

arrow
LIVE SMARTER
More from mental floss studios