GCBCover¶
sgptools.methods.GCBCover
¶
Bases: GreedyCover
GCB coverage selection with an optional path-length budget.
This class extends GreedyCover by adding a travel constraint: it
greedily selects sensing locations that improve GP-coverage, but only keeps
additions whose resulting path (computed by a TSP solver) stays within a
user-specified distance_budget.
Algorithm summary
- Precompute boolean coverages for all candidate/objective pairs.
- Initialize with the single candidate covering the most objective points.
- Iteratively propose candidates using a generalized cost/benefit score: score = (newly-covered points) / (additional distance).
- For each proposal, re-solve a TSP over the selected points and accept
the new point only if the path length is <=
distance_budget. - Stop when target coverage is met, the sensing budget is met, or no feasible improvements remain.
Notes
- Current implementation assumes
num_robots == 1. - The method may return fewer than
num_sensingpoints due to the distance budget or early attainment of the coverage target. - If
start_nodesare provided (kwargs), they are prepended to the output route; ensure the distance budget logic accounts for them (see code notes).
Source code in sgptools/methods.py
2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 | |
__init__(num_sensing, X_objective, kernel, noise_variance, transform=None, num_robots=1, X_candidates=None, num_dim=None, height=None, width=None, pbounds=None, **kwargs)
¶
Initialize the method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_sensing
|
int
|
Maximum number of sensing locations (not strictly enforced; the tiling determines the actual number of points). |
required |
X_objective
|
ndarray
|
Environment points. Used only to infer the bounding rectangle
(min/max in the first two dimensions) when |
required |
kernel
|
Kernel
|
GP kernel (assumed to have a |
required |
noise_variance
|
float
|
Observation noise variance. |
required |
transform
|
Transform | None
|
Reserved for compatibility with other methods. |
None
|
num_robots
|
int
|
Must be 1. Multi-robot tilings are not supported. |
1
|
X_candidates
|
ndarray | None
|
Ignored. Present for API compatibility with other methods. |
None
|
num_dim
|
int | None
|
Dimensionality of points. Defaults to |
None
|
height
|
float | None
|
Environment height in the y-direction. If None, inferred from
|
None
|
width
|
float | None
|
Environment width in the x-direction. If None, inferred from
|
None
|
pbounds
|
ndarray | None
|
Coordinates of the environment boundry polygon, used to ensure all sensing locations are inside the environment. |
None
|
**kwargs
|
Any
|
Ignored. Accepted for forward compatibility. |
{}
|
Source code in sgptools/methods.py
1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 | |
get_hyperparameters()
¶
Return current kernel and noise variance as (kernel, noise_variance).
Returns:
| Type | Description |
|---|---|
Tuple[Kernel, float]
|
Tuple[gpflow.kernels.Kernel, float]: A tuple containing the kernel instance and noise variance. |
Source code in sgptools/methods.py
optimize(post_var_threshold=0.7, target_fraction=100, distance_budget=float('inf'), return_fovs=False, slack_ratio=None, candidate_method='Hex', X_warm_start=[], **kwargs)
¶
Run the GCB selection with a path-length constraint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
post_var_threshold
|
float
|
Posterior variance upper bound used to binarize coverage (same meaning
as in :meth: |
0.7
|
target_fraction
|
int
|
Desired percent coverage in [0, 100]. The method stops once the number
of covered objective points reaches |
100
|
distance_budget
|
float
|
Maximum allowed path length for the selected sensing locations (after
TSP re-ordering). Use |
float('inf')
|
return_fovs
|
bool
|
If True, also return polygon FoVs derived from covered objective points. |
False
|
slack_ratio
|
float | None
|
Non-negative slack used to lower the post_var_threshold when generating the candidate set, generating extra candidates and improving the chance of reaching the target coverage. |
None
|
candidate_method
|
str
|
Method used to generate the candidate set. Available options: |
'Hex'
|
X_warm_start
|
ndarray
|
Initial candidate locations to force inclusion. |
[]
|
**kwargs
|
Any
|
Extra arguments forwarded to the TSP solver. |
{}
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray | Tuple[np.ndarray, List[shapely.geometry.Polygon]]: X_sol: Array shaped (num_robots, k, d) with k <= num_sensing selected points. (X_sol, fovs): If return_fovs is True, also returns a list of shapely Polygons. |
Source code in sgptools/methods.py
2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 | |
update(kernel, noise_variance)
¶
Update kernel and noise variance hyperparameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kernel
|
Kernel
|
New GPflow kernel instance. |
required |
noise_variance
|
float
|
New observation noise variance. |
required |