Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add hajibabaie/combinatorial-optimization-skills --skill numpy-vectorization-for-optimizationgit clone --depth 1 https://github.com/hajibabaie/combinatorial-optimization-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/numpy-vectorization-for-optimization)<a href="https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/numpy-vectorization-for-optimization"><img src="https://agentmods.dev/badge/skills/hajibabaie/combinatorial-optimization-skills/numpy-vectorization-for-optimization/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/numpy-vectorization-for-optimization"><img src="https://agentmods.dev/badge/skills/hajibabaie/combinatorial-optimization-skills/numpy-vectorization-for-optimization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00125 | $0.10543 |
| Opus 5.5 | $0.00050 | $0.04217 |
| Sonnet 5.5 | $0.00025 | $0.02109 |
| Haiku 4.5 | $0.00013 | $0.01054 |
Grade B, and why
numpy-vectorization-for-optimization scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Strips warnings and disclaimersmediumAnti-refusal
Omitting safety caveats hides risk from the user and is a common jailbreak preamble.
around without any warning (NumPy fixed-width ints are modular). Promote to int64 or float64 How it starts
The opening of the file, as written. The whole thing — 787 lines — stays where its author put it; the contents beside it link to each section on GitHub.
NumPy Vectorization for Optimization
You are an expert in high-performance scientific Python for combinatorial optimization. This skill
covers turning loop-based metaheuristic code into vectorized NumPy: population-level operations,
batch fitness evaluation, distance matrices, broadcasting, argsort/argpartition idioms, the
default_rng Generator API, and memory layout — plus the profiling discipline that decides which
loops are worth removing. Use the pattern catalog below to deliver 10-1000x constant-factor
speedups without changing what the algorithm computes.
Initial Assessment
Establish these facts before rewriting any loop:
- Profile evidence. Ask for (or produce) a
cProfileor timing breakdown. Never vectorize a loop that consumes 3% of runtime; Amdahl's law caps the whole-run gain at 1.03x. - Algorithm class. Population methods (GA, DE, PSO, EDA) vectorize naturally: one array axis is the population. Trajectory methods (SA, tabu, ILS) have sequentially dependent iterations; only their inner evaluations and neighborhood scans vectorize.
- Loop inventory. Classify every hot loop: over individuals, over genes within an individual, over parent pairs, over neighborhood moves, over generations, over restarts. Each class has a different replacement pattern (see the decision table below).
- Array sizes. NumPy pays a fixed ~1 µs dispatch cost per call. Arrays under a few hundred
elements rarely amortize it; a
(pop_size, n)batch almost always does. - Objective structure. Can the objective be written as gathers (fancy indexing), elementwise ops, reductions, and matrix products? Sums of local terms vectorize; recursions with data-dependent state (e.g., makespan propagation) resist and may need a JIT instead.
- Branchiness. Data-dependent
if/elseper element converts to masks andnp.where; deep nested control flow may produce unreadable mask algebra — consider Numba for those kernels. - Memory headroom. Broadcasting materializes temporaries:
(n, n, d)for pairwise differences,(p, n, n)for batched matrix gathers. Check RAM before promising speed. - dtype and value ranges. Integer products overflow silently in NumPy fixed-width ints; float32 halves bandwidth but costs precision. Decide dtypes up front.
- Reproducibility contract. Vectorizing changes the RNG draw order, so results differ from the loop version even with the same seed. Agree on equivalence: bit-identical (rarely possible), numerically identical given the same inputs, or statistically equivalent.
- Dependency policy. NumPy only, or are SciPy (
cdist), Numba, and threadpoolctl allowed? - Hardware and BLAS. Core count and BLAS backend (OpenBLAS/MKL) matter for
@-heavy code, and BLAS threading interacts badly withmultiprocessingworkers. - Target throughput. Evaluations/second needed for the experiment budget. Stop optimizing when the budget fits; refactoring time is also research time.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 787 lines · 125 tokens per session scan B cdc100e930ea
numpy-vectorization-for-optimization is a skill published in the GitHub repository hajibabaie/combinatorial-optimization-skills (23 stars, last pushed 5mo ago), licensed MIT. It adds 125 tokens to every session and 10,543 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it B with 1 finding (strips warnings and disclaimers). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
numpy-vectorization-for-optimization compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| numpy-vectorization-for-optimizationhajibabaie/combinatorial-optimization-skills | Skill | 23 | 5mo ago | MIT | B | 125 | Claude Code |
| python-backend-expertmathisk2095/jko-claude-plugins | Skill | 3 | 1mo ago | MIT | A | 183 | Claude Code |
| backend-developmentmartian56/claude-engineer | Skill | 15 | 5mo ago | MIT | A | 63 | Claude Code |
| odoo-pythonomas-odoo/odoo-superpowers | Skill | 1 | 5mo ago | none | A | 64 | Claude Code |
| odoo-pythonassoumaaa/odoo-superpowers | Skill | 1 | 5mo ago | none | A | 64 | Claude Code |
| astropyK-Dense-AI/scientific-agent-skills | Skill | 59k | 3d ago | MIT | A | 56 | Claude Code, Codex |
| matlabK-Dense-AI/scientific-agent-skills | Skill | 59k | 3d ago | MIT | A | 44 | Claude Code |