Starlink Beam Planner
Learn this problemProblem statement
You are given the positions of users and satellites as three-dimensional vectors relative to the center of a spherical Earth at (0, 0, 0). Construct a set of satellite beams that serves at least minimumServed distinct users.
Practice Contract
Implement planBeams. Return an integer matrix in which every row is [userIndex, satelliteIndex, color]:
userIndexandsatelliteIndexare zero-based.coloris one of1,2,3, or4.- The order of the returned rows does not matter.
Your assignment must satisfy all of the following rules:
- One beam per user: a user may appear in at most one returned row.
- User visibility: for user vector
Uand satellite vectorS, the angle betweenUandS - Umust be at most45degrees. - Satellite capacity: one satellite may serve at most
32users. - Frequency separation: consider two users assigned to the same satellite. If their beams use the same color, the angle between the vectors from that satellite to the two users must be at least
10degrees. - Coverage: the matrix must contain at least
minimumServedrows.
Any assignment satisfying these rules is accepted. It does not have to equal the reference output shown in an example, and it may serve more than minimumServed users.
Function
planBeams(users: double[][], satellites: double[][], minimumServed: int) → int[][]Examples
Example 1
users = [[1,0,0],[0,1,0]]satellites = [[2,0,0],[0,2,0]]minimumServed = 2return = [[0,0,1],[1,1,1]]User 0 is directly below satellite 0, and user 1 is directly below satellite 1. Both users are served, so the minimum of 2 is met.
Example 2
users = [[1,0,0],[0.996194698,0.087155743,0]]satellites = [[2,0,0]]minimumServed = 2return = [[0,0,1],[1,0,2]]The two beams are less than 10 degrees apart at satellite 0, so the reference plan gives them different colors. Any other feasible colors are also accepted.
Example 3
users = [[1,0,0],[0,1,0]]satellites = [[2,0,0]]minimumServed = 1return = [[0,0,1]]User 0 is visible from the satellite. Serving that user alone satisfies minimumServed = 1; user 1 may be omitted.
Constraints
1 <= users.length <= 5001 <= satellites.length <= 100- Every user and satellite entry contains exactly three finite coordinates.
- Every user and satellite vector is nonzero, and every coordinate has absolute value at most
10^9. 0 <= minimumServed <= users.length- At least one valid assignment serves
minimumServedusers.