[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7C2VA6ZG8802BDR4K5KEX68":3,"skill-same:01M7C2VA6ZG8802BDR4K5KEX68":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7C2VA6ZG8802BDR4K5KEX68","map-optimization-strategy",null,"Strategy for solving constraint optimization problems on spatial maps. Use when you need to place items on a grid\u002Fmap to maximize some objective while satisfying constraints.","linyouxue\u002Fskill-repair-benchmark","linyouxue","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F216151464?v=4","01M7BJEVCXKD74KH6FG9CBVSQB","林宥学","01M7BJEVE02NP217V93BKZFC0J",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FWML\u002Ftasks\u002Fciv6-adjacency-optimizer\u002Frepaired_skill\u002Fmap-optimization-strategy\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: map-optimization-strategy\ndescription: Strategy for solving constraint optimization problems on spatial maps. Use when you need to place items on a grid\u002Fmap to maximize some objective while satisfying constraints.\n---\n\n# Map-Based Constraint Optimization Strategy\n\nA systematic approach to solving placement optimization problems on spatial maps. This applies to any problem where you must place items on a grid to maximize an objective while respecting placement constraints.\n\n## Why Exhaustive Search Fails\n\nExhaustive search (brute-force enumeration of all possible placements) is the **worst approach**:\n\n- Combinatorial explosion: Placing N items on M valid tiles = O(M^N) combinations\n- Even small maps become intractable (e.g., 50 tiles, 5 items = 312 million combinations)\n- Most combinations are clearly suboptimal or invalid\n\n## The Three-Phase Strategy\n\n### Phase 1: Prune the Search Space\n\n**Goal:** Eliminate tiles that cannot contribute to a good solution.\n\nRemove tiles that are:\n1. **Invalid for any placement** - Violate hard constraints (wrong terrain, out of range, blocked)\n2. **Dominated** - Another tile is strictly better in all respects\n3. **Isolated** - Too far from other valid tiles to form useful clusters\n\n```\nBefore: 100 tiles in consideration\nAfter pruning: 20-30 candidate tiles\n```\n\nThis alone can reduce search space by 70-90%.\n\n### Phase 2: Identify High-Value Spots\n\n**Goal:** Find tiles that offer exceptional value for your objective.\n\nScore each remaining tile by:\n1. **Intrinsic value** - What does this tile contribute on its own?\n2. **Adjacency potential** - What bonuses from neighboring tiles?\n3. **Cluster potential** - Can this tile anchor a high-value group?\n\nRank tiles and identify the top candidates. These are your **priority tiles** - any good solution likely includes several of them.\n\n```\nExample scoring:\n- Tile A: +4 base, +3 adjacency potential = 7 points (HIGH)\n- Tile B: +1 base, +1 adjacency potential = 2 points (LOW)\n```\n\n### Phase 3: Anchor Point Search\n\n**Goal:** Find placements that capture as many high-value spots as possible.\n\n1. **Select anchor candidates** - Tiles that enable access to multiple high-value spots\n2. **Expand from anchors** - Greedily add placements that maximize marginal value\n3. **Validate constraints** - Ensure all placements satisfy requirements\n4. **Local search** - Try swapping\u002Fmoving placements to improve the solution\n\nFor problems with a \"center\" constraint (e.g., all placements within range of a central point):\n- The anchor IS the center - try different center positions\n- For each center, the reachable high-value tiles are fixed\n- Optimize placement within each center's reach\n\n#### Make Phase 3 Operational (bounded search loop)\n\nWhen maximizing an objective (not just finding *any* valid placement), do **not** stop after validating a single plausible configuration. Instead, run a **bounded** anchor search plus a small local-improvement loop.\n\n1) **Enumerate anchor candidates (centers) in a bounded way**\n- Build a set of feasible anchors from Phase 1 constraints.\n- If this set is large, restrict to **top-K** anchors using a cheap proxy score (e.g., count of high-value tiles within the allowed radius, or sum of their tile scores).\n\n2) **For each anchor, solve placements with a greedy pass**\n- Fix the anchor.\n- Recompute the candidate set within the anchor’s allowed range.\n- Place items one-by-one by **marginal gain** (objective delta) while enforcing hard constraints after each addition (constraint propagation).\n\n3) **Local improvement (small neighborhood search)**\nPerform a limited number of improvement attempts so runtime stays predictable:\n- Consider single-tile moves for one placed item to another candidate tile.\n- Consider pairwise swaps of two placed items.\n- Keep a change only if it improves the objective and remains valid.\n\nSuggested bounds (tune to map size):\n- `K_anchors = 10–30`\n- `max_local_iters = 50–200`\n- `max_neighbors_per_item = 10–30` (e.g., evaluate only the top-N alternative tiles by heuristic)\n\n4) **Track best-so-far with a strict validator**\nMaintain `best_solution` across anchors and local steps. Every time you accept a new best:\n- Re-validate all placements against the hard constraints.\n- Recompute the objective from the authoritative scoring rules.\n\n**Fallback\u002Fverification step:** If the search budget is exhausted, return the best validated solution found so far (never an unvalidated intermediate). If results are unexpectedly low or unstable, increase K slightly or widen the local neighborhood, but keep the search bounded.\n\n## Algorithm Skeleton\n\n```python\ndef optimize_placements(map_tiles, constraints, num_placements):\n    # Phase 1: Prune\n    candidates = [t for t in map_tiles if is_valid_tile(t, constraints)]\n\n    # Phase 2: Score and rank\n    scored = [(tile, score_tile(tile, candidates)) for tile in candidates]\n    scored.sort(key=lambda x: -x[1])  # Descending by score\n    high_value = scored[:top_k]\n\n    # Phase 3: Anchor search\n    best_solution = None\n    best_score = 0\n\n    for anchor in get_anchor_candidates(high_value, constraints):\n        solution = greedy_expand(anchor, candidates, num_placements, constraints)\n        solution = local_search(solution, candidates, constraints)\n\n        if solution.score > best_score:\n            best_solution = solution\n            best_score = solution.score\n\n    return best_solution\n```\n\n## Key Insights\n\n1. **Prune early, prune aggressively** - Every tile removed saves exponential work later\n\n2. **High-value tiles cluster** - Good placements tend to be near other good placements (adjacency bonuses compound)\n\n3. **Anchors constrain the search** - Once you fix an anchor, many other decisions follow logically\n\n4. **Greedy + local search is often sufficient** - You don't need the global optimum; a good local optimum found quickly beats a perfect solution found slowly\n\n5. **Constraint propagation** - When you place one item, update what's valid for remaining items immediately\n\n## Common Pitfalls\n\n- **Ignoring interactions** - Placing item A may change the value of placing item B (adjacency effects, mutual exclusion)\n- **Over-optimizing one metric** - Balance intrinsic value with flexibility for remaining placements\n- **Forgetting to validate** - Always verify final solution satisfies ALL constraints\n\n- **Single-shot confirmation** - Validating one hand-picked layout is not an optimization strategy. Use a bounded anchor loop + local improvements to reliably find a better (or best-found) solution under a fixed time budget.\n\n- **Shell heredoc + chaining mistakes** - If your executor\u002Ftool has a single-command constraint, either (a) write the output in one command and verify in a second command, or (b) chain only with operators that are part of the same shell command. When using a heredoc (`\u003C\u003C'PY'`), ensure the terminator line ends the command cleanly—do not append extra tokens on the terminator line.\n","# Map-Based Constraint Optimization Strategy\n\nA systematic approach to solving placement optimization problems on spatial maps. This applies to any problem where you must place items on a grid to maximize an objective while respecting placement constraints.\n\n## Why Exhaustive Search Fails\n\nExhaustive search (brute-force enumeration of all possible placements) is the **worst approach**:\n\n- Combinatorial explosion: Placing N items on M valid tiles = O(M^N) combinations\n- Even small maps become intractable (e.g., 50 tiles, 5 items = 312 million combinations)\n- Most combinations are clearly suboptimal or invalid\n\n## The Three-Phase Strategy\n\n### Phase 1: Prune the Search Space\n\n**Goal:** Eliminate tiles that cannot contribute to a good solution.\n\nRemove tiles that are:\n1. **Invalid for any placement** - Violate hard constraints (wrong terrain, out of range, blocked)\n2. **Dominated** - Another tile is strictly better in all respects\n3. **Isolated** - Too far from other valid tiles to form useful clusters\n\n```\nBefore: 100 tiles in consideration\nAfter pruning: 20-30 candidate tiles\n```\n\nThis alone can reduce search space by 70-90%.\n\n### Phase 2: Identify High-Value Spots\n\n**Goal:** Find tiles that offer exceptional value for your objective.\n\nScore each remaining tile by:\n1. **Intrinsic value** - What does this tile contribute on its own?\n2. **Adjacency potential** - What bonuses from neighboring tiles?\n3. **Cluster potential** - Can this tile anchor a high-value group?\n\nRank tiles and identify the top candidates. These are your **priority tiles** - any good solution likely includes several of them.\n\n```\nExample scoring:\n- Tile A: +4 base, +3 adjacency potential = 7 points (HIGH)\n- Tile B: +1 base, +1 adjacency potential = 2 points (LOW)\n```\n\n### Phase 3: Anchor Point Search\n\n**Goal:** Find placements that capture as many high-value spots as possible.\n\n1. **Select anchor candidates** - Tiles that enable access to multiple high-value spots\n2. **Expand from anchors** - Greedily add placements that maximize marginal value\n3. **Validate constraints** - Ensure all placements satisfy requirements\n4. **Local search** - Try swapping\u002Fmoving placements to improve the solution\n\nFor problems with a \"center\" constraint (e.g., all placements within range of a central point):\n- The anchor IS the center - try different center positions\n- For each center, the reachable high-value tiles are fixed\n- Optimize placement within each center's reach\n\n#### Make Phase 3 Operational (bounded search loop)\n\nWhen maximizing an objective (not just finding *any* valid placement), do **not** stop after validating a single plausible configuration. Instead, run a **bounded** anchor search plus a small local-improvement loop.\n\n1) **Enumerate anchor candidates (centers) in a bounded way**\n- Build a set of feasible anchors from Phase 1 constraints.\n- If this set is large, restrict to **top-K** anchors using a cheap proxy score (e.g., count of high-value tiles within the allowed radius, or sum of their tile scores).\n\n2) **For each anchor, solve placements with a greedy pass**\n- Fix the anchor.\n- Recompute the candidate set within the anchor’s allowed range.\n- Place items one-by-one by **marginal gain** (objective delta) while enforcing hard constraints after each addition (constraint propagation).\n\n3) **Local improvement (small neighborhood search)**\nPerform a limited number of improvement attempts so runtime stays predictable:\n- Consider single-tile moves for one placed item to another candidate tile.\n- Consider pairwise swaps of two placed items.\n- Keep a change only if it improves the objective and remains valid.\n\nSuggested bounds (tune to map size):\n- `K_anchors = 10–30`\n- `max_local_iters = 50–200`\n- `max_neighbors_per_item = 10–30` (e.g., evaluate only the top-N alternative tiles by heuristic)\n\n4) **Track best-so-far with a strict validator**\nMaintain `best_solution` across anchors and local steps. Every time you accept a new best:\n- Re-validate all placements against the hard constraints.\n- Recompute the objective from the authoritative scoring rules.\n\n**Fallback\u002Fverification step:** If the search budget is exhausted, return the best validated solution found so far (never an unvalidated intermediate). If results are unexpectedly low or unstable, increase K slightly or widen the local neighborhood, but keep the search bounded.\n\n## Algorithm Skeleton\n\n```python\ndef optimize_placements(map_tiles, constraints, num_placements):\n    # Phase 1: Prune\n    candidates = [t for t in map_tiles if is_valid_tile(t, constraints)]\n\n    # Phase 2: Score and rank\n    scored = [(tile, score_tile(tile, candidates)) for tile in candidates]\n    scored.sort(key=lambda x: -x[1])  # Descending by score\n    high_value = scored[:top_k]\n\n    # Phase 3: Anchor search\n    best_solution = None\n    best_score = 0\n\n    for anchor in get_anchor_candidates(high_value, constraints):\n        solution = greedy_expand(anchor, candidates, num_placements, constraints)\n        solution = local_search(solution, candidates, constraints)\n\n        if solution.score > best_score:\n            best_solution = solution\n            best_score = solution.score\n\n    return best_solution\n```\n\n## Key Insights\n\n1. **Prune early, prune aggressively** - Every tile removed saves exponential work later\n\n2. **High-value tiles cluster** - Good placements tend to be near other good placements (adjacency bonuses compound)\n\n3. **Anchors constrain the search** - Once you fix an anchor, many other decisions follow logically\n\n4. **Greedy + local search is often sufficient** - You don't need the global optimum; a good local optimum found quickly beats a perfect solution found slowly\n\n5. **Constraint propagation** - When you place one item, update what's valid for remaining items immediately\n\n## Common Pitfalls\n\n- **Ignoring interactions** - Placing item A may change the value of placing item B (adjacency effects, mutual exclusion)\n- **Over-optimizing one metric** - Balance intrinsic value with flexibility for remaining placements\n- **Forgetting to validate** - Always verify final solution satisfies ALL constraints\n\n- **Single-shot confirmation** - Validating one hand-picked layout is not an optimization strategy. Use a bounded anchor loop + local improvements to reliably find a better (or best-found) solution under a fixed time budget.\n\n- **Shell heredoc + chaining mistakes** - If your executor\u002Ftool has a single-command constraint, either (a) write the output in one command and verify in a second command, or (b) chain only with operators that are part of the same shell command. When using a heredoc (`\u003C\u003C'PY'`), ensure the terminator line ends the command cleanly—do not append extra tokens on the terminator line.\n",{"name":5,"description":7},"main","cdcb6d230f3b15c3c33f8a2bdd16439f43602cbe","evaluation\u002Fresults\u002FWML\u002Ftasks\u002Fciv6-adjacency-optimizer\u002Frepaired_skill\u002Fmap-optimization-strategy",1,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark","https:\u002F\u002Fgithub.com\u002Flinyouxue","2026-11-14 20:28:35",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add linyouxue\u002Fskill-repair-benchmark --skill map-optimization-strategy",{"tool":37,"command":38},"bunx","bunx skills add linyouxue\u002Fskill-repair-benchmark --skill map-optimization-strategy",{"tool":40,"command":41},"pnpm","pnpm dlx skills add linyouxue\u002Fskill-repair-benchmark --skill map-optimization-strategy","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FWML\u002Ftasks\u002Fciv6-adjacency-optimizer\u002Frepaired_skill\u002Fmap-optimization-strategy\u002FSKILL.md",true,[],[46,53,60,67,72,77],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M7E1HGVRY73NBJ022CJG13X6","video-frame-extraction","Extract frames from video files and save them as images using OpenCV","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7E1HAG5R7CJ9C8NYJS771MB","openai-vision","Analyze images and multi-frame sequences using OpenAI GPT vision models","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7E1H7DADKB6QBWKC2KQ63SZ","image-ocr","Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[],{"skillNo":68,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7E1H0WBNT43TENGQY7AVZHD","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":73,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7E1GTC7D4N4Q2EF03875J9E","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":78,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7E1GQ92CWFMGH53KSSE4WER","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[]]