skills/tabular/squeeze-compact-local-search/SKILL.md
Three-stage packing refinement — uniform squeeze toward centroid, greedy compaction per object, then multi-directional local search — to tighten solutions after metaheuristic optimization
npx skillsauth add wenmin-wu/ds-skills tabular-squeeze-compact-local-searchInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
After simulated annealing or another metaheuristic finds a feasible packing, three refinement stages can squeeze out additional density: (1) Squeeze — uniformly scale all objects toward the centroid until overlap occurs, (2) Compact — greedily move each object toward the center, accepting if no collision, (3) Local search — try small translations and rotations in 8 directions at decreasing step sizes. Run in sequence; each stage feeds its output to the next.
def squeeze(state, score_fn, overlap_fn, steps=100):
center = state.centroid()
for scale in [1 - i * 0.0005 for i in range(steps)]:
trial = state.scale_toward(center, scale)
if not overlap_fn(trial):
state = trial
else:
break
return state
def compact(state, score_fn, overlap_fn, rounds=50):
center = state.centroid()
for _ in range(rounds):
for i in range(len(state)):
direction = center - state.position(i)
step = direction * 0.01
trial = state.move(i, step)
if not overlap_fn(trial):
state = trial
return state
def local_search(state, score_fn, overlap_fn, rounds=80):
dirs = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1),(1,-1),(-1,1)]
for step_size in [0.1, 0.05, 0.01, 0.005]:
for _ in range(rounds):
for i in range(len(state)):
for dx, dy in dirs:
trial = state.move(i, (dx*step_size, dy*step_size))
if not overlap_fn(trial) and score_fn(trial) < score_fn(state):
state = trial
return state
result = local_search(compact(squeeze(sa_result, score, overlap), score, overlap), score, overlap)
squeeze → compact → local_search, optionally repeatdata-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF