HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Christmas Light Route Efficiency

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
lightrouteefficiencychristmas

Problem

This is a real situation (I hope it's ok that I post this here. If not, please suggest a better home). I have little knowledge of algorithms, but I know I can use one to solve this problem.

I'm looking for an answer, or an online resource that can help, or an algorithm I should research to help me find the route with the least overlap.

I have an enclosed structure with rafters. I want to hang christmas lights inside it, and I'm trying to figure out how to cover all the ceiling beams with lights while minimizing overlap.

Here's a rudimentary schematic of the structure:

  • The pink circles are places I can hang the lights from



  • The yellow dots are where the lights should be



  • "Start" is the only available electrical outlet



  • Each strand of lights is aprox 234 inches (droop and empty sections have been accounted for)



What is the most efficient path(s) to minimize overlap?

Here's some things to keep in mind:

  • Assume I have an infinite number of lights



  • The beginning of a strand of lights has a male electric connector. The end has a female.



  • The start (male) of one strand must intersect with the end (female) of another strand (for electricity).



  • Multiple strands can start from the same point



Here's the XML of the diagram (you can use this in draw.io):

```

7V1Lk6M4Ev4tc3DE9KEckngf29Xd24fZiImtjdjpo8rINtsYebHq4fn1KwHiIYGLcoNM2XYdClKyBF9+SqVSCZ5Z99vXf6R4t/knDUk8QyB8nVlfZghB2/L4PyE5FBLgglyyTqOwkFWCh+hvIisW0qcoJPtGRUZpzKJdU7ikSUKWrCHDaUpfmtVWNG72usNrogkeljjWpf+JQrbJpb4DKvl3Eq03smcIipJHvPy5TulTUvQ3Q9Yq++TFWyzbKurvNzikLzWR9XVm3aeUsvxo+3pPYgGuhC3/3reO0vK6U5KwPl9w8i884/iJyCvOrosdJBbZ3RBRH8ysxcsmYuRhh5ei9IWrn8s2bBvzM8gPi+ZIyshr5yXB8kY5gwjdEpYeeJXiC34BzaF5+lLpAUo2beo6kEJc6H5dtlzdPz8oIGiHw50eHMg+Ix7e9PCwwRnx8KeHh+OeEY9gengo5qMcPkbwkPPXhAEpx48ZQOD0AIGoiUg5guqIoNEQQdNHxENGEbGmj4jfZlbHQ8SeHiKqH2LYsE7QUVU9EcOITNBXVX0Rs4igCU6+6qgxO/uiCc6+6qgxjMgEZ1911BhGZIKzrzpqWj208RCZ4OyrjhrDiExw9lVHjWFEJjj7qqOm1YsfD5EPECsyjMgHiBYZRmSC8SItvmo0gGZN0GfVIqxmEZmgz6rFWM0iovusnjOXc3INFn6D

Solution

The problem you're trying to solve is called the route inspection problem (a.k.a. Chinese postman problem, from back in the days when it seemed normal to call something "Chinese" because the first person to study it was Chinese). Good news – there's an efficient algorithm, described in the Wikipedia article.

Context

StackExchange Computer Science Q#80134, answer score: 2

Revisions (0)

No revisions yet.