Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

/prog/ CHALLENGE 2011

Name: Anonymous 2011-01-15 7:15

Given a set V of N 2 dimensional points and a number k (0 < k < N) find k circles which have the same radius r and the centers in V and cover all the N points in V and r must be the smallest possible.

An equivalent formulation of the problem would be given a point x and a finite set of points S we have dist(x, S) = min{dist(x,y) | y ∈ S} and radius(S) = max{dist(x, S) | x ∈ V}. You must determine a subset S ⊆ V, |S| = k which minimizes radius(S).

Name: Anonymous 2011-01-15 8:16

Forget it, it's NP-complete.

Name: Anonymous 2011-01-15 13:41

Given a set V
Still waiting on V.

Name: Anonymous 2011-01-15 14:25

(define V (read))
+]=>

Name: Anonymous 2011-01-15 15:54

>>4
Type check failure. Way to go, that's quite a feat!

Name: Anonymous 2011-01-15 16:10

>>3
That's just an excuse not to do this!

Name: Anonymous 2011-01-15 16:28

implying that wasn't the challenge for that programming contest, with V = {(x, y) | x, y ∈ ℤ}

Name: Anonymous 2011-01-15 19:14

I swear I've seen this before, perhaps on Euler or something.

Name: Anonymous 2011-01-15 20:18

Forget it, it's EXPTIME-complete.

Name: Anonymous 2011-01-15 23:25

>>1
Points aren't two-dimensional, they're zero-dimensional.

Name: Anonymous 2011-01-16 4:23

I'm disappointed in you /prog/.

Name: Anonymous 2011-01-16 4:34

Name: Anonymous 2011-01-16 10:56

>>12
That's different.

Anyway, OP, I think you forgot to give us the upper bounds on N.

Name: Anonymous 2011-01-16 12:05

>>13
Let's say 1000.

Name: Anonymous 2011-01-16 13:48

http://www.vworker.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=1575773
WTF? I've seen better looking Myspace pages, the layout makes me sick.
Is this homework or something?

Anyway, you could do a binary search on r. Just see if you can find a k-vertex cover for the graph for each r.

Name: Anonymous 2011-01-16 14:53

>>15
Is this homework or something?
Yes, but I didn't post that. Someone at my school must be really desperate. Plus I'll probably write the solution in Racket. I just don't have any idea yet how to do this whole thing.

Name: Anonymous 2011-01-16 16:18

>>16
I don't think you'll find an efficient algorithm that is guaranteed to find the optimal solution. The approximation follow-up question hints at that, too. You'll just have to brute force it somehow.

Name: Anonymous 2011-01-17 4:46

Forget it, it's troll-complete

Name: Anonymous 2011-01-17 6:29

>>18
It's troll-hard, actually.

Name: Anonymous 2011-01-17 17:04

>>17
I doubt it's a trick question. Now the greedy algorithm is simple but finding the optimal solution every time, I can't figure it out :(

Name: Anonymous 2011-01-18 0:02

Given a set V of N 2 dimensional points and a number k (0 < k < N) find k circles which have the same radius r and the centers in V and cover all the N points in V and r must be the smallest possible.

assume |v| > 1.
Text solution:
K-1 circles. Min radius = min distance between two points of set V.

FOIC solution

min_distance = your_mom.weight
for p1, p2 in zip(V,V):
   t = p1 - p2
   min_distance =  min(min_distance, sqrt(t.x*t.x + t.y*t.y))

# print radius
print "Min radius: %f" % min_distance

# print N-1 circles
for i,p in enumerate(V[1:])
   print "%d st/nd/th circle: %s" % (i,p)


This solution is optimal.
Proof:

1) At most N-1 circles possible
2) This mean that at least one circle should cover two points.
3) This mean that at least one circle will have point in center and point on at least radius distance.
4) Since we have N-1 circles, each point is either center of circle or covered by other circle
5) Radius can not be decreased: we can not add another circle and we decreasing radius will mean that one point(which is not center of circle) is not covered.
QED

Name: Anonymous 2011-01-18 0:04

>FOIC

OMFG. What have I done? I've mistyped FIOC!

Name: Anonymous 2011-01-18 2:56

>>22
It's just the FORCE OF INTENDED CODE

Name: Anonymous 2011-01-18 3:47

>>21
You're given the number K. For example if K = 4 you have 4 circles that must cover all other points and the radius must be minimal.

Name: Anonymous 2011-01-18 3:57

>>23
FUCK OFF IMAGEBOARD COCKSUCKER

Name: Anonymous 2011-01-18 4:14

>>25
You got mad!

Name: Anonymous 2011-01-18 4:21

>>26
FOIC.

Name: Anonymous 2011-01-18 6:16

Poit.

Name: deleted !RMbnClAiRE 2011-01-18 8:33

Binary search on R.
After that you can do some exponential DP or some shit, hell if I know.  I'm fairly sure the problem of determining whether you can solve this with a fixed R is not equivalent to the vertex cover problem, though.

In particular, I was thinking of the graph G=(V,E) where V=V from the problem statement and E={(v1,v2) in VxV | dist(v1,v2)<=R}.  If you look for a k-vertex cover on this graph you will get the wrong answer for the following input:
V = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0)} K=2.
The right answer is R=1 with circles at (1,0) and (4,0), but if we think about the problem as a quest for a k-vertex cover we'll fail because the edge ((2,0),(3,0)) won't be incident on either of our chosen vertices.

If the guy who suggested k-vertex cover had something else in mind I'd love to hear it.

Name: Anonymous 2011-01-18 8:55

>>29
But all I say in your post is "HERP DERP HUARHU".

Name: Anonymous 2011-01-18 10:46

>>30
*HARUHI

Name: Anonymous 2011-01-18 10:56

>>29
Binary search on R.

Isn't R the radius? How would you do a binary search on it?

Name: Anonymous 2011-01-18 14:39

>>29
I can do a binary search on R but I have to choose k points. I can find the optimal R for those k points but how do I know those points are the best I could have possibly chose?

Name: Anonymous 2011-01-19 6:11

>>29
Well fuck me, you're right. It's actually a dominating set of an unit disk graph.

Name: Anonymous 2011-01-19 6:18

Didn't mean to sage that; bumping to inform >>29 and to ruin >>1's education.

Name: Anonymous 2011-01-19 12:54

>>35
I'll pass anyway. Seems I can just brute force it anyway (the teacher doesn't care).

Don't change these.
Name: Email:
Entire Thread Thread List