Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
You are discrete-event-simulator - a specialized skill for building and analyzing discrete event simulation models for complex systems with stochastic processes.
Overview
This skill enables AI-powered discrete event simulation including:
classManufacturingLine:
"""
Multi-stage manufacturing line with buffers
"""def__init__(self, env, config):
self.env = env
self.config = config
# Create resourcesself.stations = {
name: simpy.Resource(env, capacity=cap)
for name, cap in config['stations'].items()
}
# Buffers between stationsself.buffers = {
name: simpy.Container(env, capacity=cap, init=0)
for name, cap in config['buffers'].items()
}
# Statisticsself.stats = {
'throughput': 0,
'wip': [],
'utilization': {s: [] for s inself.stations}
}
defpart_flow(self, part_id):
"""Process a part through all stations"""for station_name inself.config['routing']:
station = self.stations[station_name]
with station.request() as req:
yield req
# Record utilizationself.stats['utilization'][station_name].append(
station.count / station.capacity
)
# Process time
process_time = self.config['process_times'][station_name]()
yieldself.env.timeout(process_time)
self.stats['throughput'] += 1defpart_arrivals(self):
"""Generate arriving parts"""
part_id = 0whileTrue:
yieldself.env.timeout(self.config['interarrival_time']())
part_id += 1self.env.process(self.part_flow(part_id))
self.stats['wip'].append(sum(s.count for s inself.stations.values()))
defwelch_warmup_detection(data, window_size=50):
"""
Welch's method for detecting warm-up period
"""
n = len(data)
moving_avg = []
for i inrange(n - window_size + 1):
moving_avg.append(np.mean(data[i:i+window_size]))
# Find convergence point
threshold = 0.01 * np.std(moving_avg)
converged = False
warmup_end = 0for i inrange(len(moving_avg) - 1):
ifabs(moving_avg[i+1] - moving_avg[i]) < threshold:
ifnot converged:
warmup_end = i
converged = Trueelse:
converged = Falsereturn warmup_end * window_size
defrun_with_warmup(env, model, warmup_time, run_time):
"""
Run simulation with warm-up period removal
"""
env.run(until=warmup_time)
model.reset_statistics()
env.run(until=warmup_time + run_time)
return model.get_statistics()
5. Output Analysis with Confidence Intervals
defreplicated_runs(model_func, num_replications, confidence=0.95):
"""
Run multiple replications and compute confidence intervals
"""
results = []
for rep inrange(num_replications):
env = simpy.Environment()
result = model_func(env, seed=rep)
results.append(result)
# Compute statistics
means = {key: np.mean([r[key] for r in results])
for key in results[0].keys()}
stds = {key: np.std([r[key] for r in results], ddof=1)
for key in results[0].keys()}
# Confidence intervalsfrom scipy import stats
t_value = stats.t.ppf((1 + confidence) / 2, num_replications - 1)
ci = {key: (means[key] - t_value * stds[key] / np.sqrt(num_replications),
means[key] + t_value * stds[key] / np.sqrt(num_replications))
for key in means.keys()}
return {
"means": means,
"std_devs": stds,
"confidence_intervals": ci,
"num_replications": num_replications
}
Process Integration
This skill integrates with the following processes:
discrete-event-simulation-modeling.js
queuing-system-analysis.js
capacity-planning-analysis.js
Output Format
{"model_name":"Manufacturing_Line","simulation_time":10000,"replications":30,"warmup_time":1000,"performance_measures":{"throughput":{"mean":245.3,"std":12.4,"ci_95":[240.1,250.5]},"avg_wait_time":{"mean":5.2,"std":0.8,"ci_95":[4.9,5.5]},"utilization":{"station_1":0.82,"station_2":0.91}},"bottleneck":"station_2","recommendations":["Consider adding capacity at station_2"]}
Tools/Libraries
Library
Description
Use Case
SimPy
DES framework
General simulation
Ciw
Queue networks
Service systems
salabim
Animation
Visual models
scipy.stats
Statistics
Output analysis
Best Practices
Validate with analytical results - Test against known solutions
Remove warm-up bias - Use proper initialization
Run sufficient replications - Target narrow CIs
Document assumptions - Record all distributions
Verify random streams - Use independent seeds
Analyze output carefully - Check for non-stationarity
Constraints
Report confidence intervals, not just point estimates