simulation-experiment-designer
БесплатноБез исполняемых скриптовНе проверенSimulation experimental design skill for efficient scenario analysis and optimization.
от a5c-ai★ 1 947 звёзд на GitHubОб этом скилле
simulation-experiment-designer
You are simulation-experiment-designer - a specialized skill for designing and analyzing simulation experiments efficiently.
Overview
This skill enables AI-powered simulation experimentation including:
- Factorial experiment design for simulation
- Latin hypercube sampling
- Variance reduction techniques (common random numbers, antithetic variates)
- Ranking and selection procedures
- Metamodel fitting (response surface)
- OptQuest-style simulation optimization
- Scenario comparison with statistical tests
Prerequisites
- Python 3.8+ with pyDOE2, SALib, scipy
- SimPy or other DES framework
- Statistical analysis libraries
Capabilities
1. Factorial Experiment Design
import pyDOE2 as doe
import numpy as np
def create_factorial_design(factors, levels=2):
"""
Create full or fractional factorial design
factors: dict of {name: (low, high)}
"""
n_factors = len(factors)
factor_names = list(factors.keys())
if levels == 2:
# Full factorial
design_coded = doe.ff2n(n_factors)
# Fractional factorial for many factors
if n_factors > 5:
design_coded = doe.fracfact(
' '.join(['a', 'b', 'c', 'd', 'e'][:n_factors])
)
else:
# General full factorial
design_coded = doe.fullfact([levels] * n_factors)
# Convert to actual values
design = np.zeros_like(design_coded, dtype=float)
for i, (name, (low, high)) in enumerate(factors.items()):
if levels == 2:
design[:, i] = np.where(design_coded[:, i] == -1, low, high)
else:
step = (high - low) / (levels - 1)
design[:, i] = low + design_coded[:, i] * step
return {
"design_matrix": design,
"factor_names": factor_names,
"num_runs": len(design),
"coded_design": design_coded
}
2. Latin Hypercube Sampling
from scipy.stats import qmc
def latin_hypercube_design(factors, n_samples, seed=None):
"""
Create Latin Hypercube sample for simulation
factors: dict of {name: (low, high)}
"""
n_factors = len(factors)
factor_names = list(factors.keys())
bounds = list(factors.values())
# Create LHS sampler
sampler = qmc.LatinHypercube(d=n_factors, seed=seed)
sample = sampler.random(n=n_samples)
# Scale to factor ranges
l_bounds = [b[0] for b in bounds]
u_bounds = [b[1] for b in bounds]
design = qmc.scale(sample, l_bounds, u_bounds)
# Quality metrics
discrepancy = qmc.discrepancy(sample)
return {
"design_matrix": design,
"factor_names": factor_names,
"num_samples": n_samples,
"discrepancy": discrepancy,
"space_filling": "latin_hypercube"
}
3. Variance Reduction - Common Random Numbers
import numpy as np
class CommonRandomNumbers:
"""
Implement CRN for comparing system configurations
"""
def __init__(self, seed):
self.base_seed = seed
self.streams = {}
def get_stream(self, stream_id, replication):
"""Get deterministic random stream"""
key = (stream_id, replication)
if key not in self.streams:
seed = hash(key) % (2**32)
self.streams[key] = np.random.RandomState(seed)
return self.streams[key]
def compare_configurations(self, sim_func, configs, n_reps):
"""
Compare configurations using CRN
"""
results = {c: [] for c in configs}
for rep in range(n_reps):
for config in configs:
# Same random stream for each config in this rep
rng = self.get_stream('main', rep)
result = sim_func(config, rng)
results[config].append(result)
# Paired comparison
paired_diffs = []
for i in range(n_reps):
diff = results[configs[0]][i] - results[configs[1]][i]
paired_diffs.append(diff)
from scipy import stats
t_stat, p_value = stats.ttest_1samp(paired_diffs, 0)
return {
"config_means": {c: np.mean(results[c]) for c in configs},
"paired_difference_mean": np.mean(paired_diffs),
"variance_reduction": 1 - np.var(paired_diffs) / (
np.var(results[configs[0]]) + np.var(results[configs[1]])
),
"t_statistic": t_stat,
"p_value": p_value
}
4. Ranking and Selection
from scipy import stats
def rinott_procedure(configurations, sim_func, alpha=0.05, delta=1.0):
"""
Rinott's two-stage procedure for selecting best
delta: indifference zone parameter
"""
k = len(configurations)
n0 = 20 # Initial sample size
# Stage 1: Initial sampling
stage1_results = {c: [] for c in configurations}
for config in configurations:
for _ in range(n0):
result = sim_func(config)
Установить simulation-experiment-designer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Bash(*)ReadWriteEditGlobGrepWebFetchFAQ
Что делает скилл simulation-experiment-designer?
Simulation experimental design skill for efficient scenario analysis and optimization.
Как установить скилл simulation-experiment-designer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл simulation-experiment-designer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic