Loading...
Loading...
Explore and optimize simulation parameters via design of experiments (DOE), sensitivity analysis, and optimizer selection — generate Latin Hypercube, quasi-random, or factorial sample plans, rank parameter influence with sensitivity scores, recommend Bayesian optimization, CMA-ES, or gradient- based methods based on dimension and budget, and fit surrogate models for expensive evaluations. Use when calibrating material properties against experimental data, planning a parameter sweep, performing uncertainty quantification, or choosing an optimization strategy for a simulation with a limited evaluation budget, even if the user only says "which parameters matter most" or "how do I calibrate my model."
npx skill4agent add heshamfs/materials-simulation-skills parameter-optimization| Input | Description | Example |
|---|---|---|
| Parameter bounds | Min/max for each parameter with units | |
| Evaluation budget | Max number of simulations allowed | |
| Noise level | Stochasticity of simulation outputs | |
| Constraints | Feasibility rules or forbidden regions | |
Is dimension <= 3 AND full coverage needed?
├── YES → Use factorial
└── NO → Is sensitivity analysis the goal?
├── YES → Use quasi-random (preferred; "sobol" is accepted but deprecated)
└── NO → Use lhs (Latin Hypercube)| Method | Best For | Avoid When |
|---|---|---|
| General exploration, moderate dimensions (3-20) | Need exact grid coverage |
| Sensitivity analysis, uniform coverage (preferred) | Very high dimensions (>20) |
| Deprecated alias of | New code (use |
| Low dimension (<4), need all corners | High dimension (exponential growth) |
Factorial sizing: the factorial grid isevenly spaced values per parameter, producing exactlylevelssamples. Set the resolution explicitly withlevels ** params(e.g.--levels-> 16 samples). If you use--params 2 --levels 4instead, the script back-computes--budgetand warns whenever the realized sample count differs from the requested budget (e.g.levels = round(budget ** (1/params))realizes 16 samples). For an exact design, pass a perfect power (--budget 20 --params 2) or, preferably,--budget 16.--levels
Is dimension <= 10 AND budget <= 100?
├── YES → Bayesian Optimization
└── NO → Is dimension <= 20?
├── YES → CMA-ES
└── NO → Random Search with screening| Noise Level | Recommendation |
|---|---|
| Low | Gradient-based if derivatives available, else Bayesian Optimization |
| Medium | Bayesian Optimization with noise model |
| High | Evolutionary algorithms or robust Bayesian Optimization |
| Script | Output Fields |
|---|---|
| |
| |
| |
| |
scripts/doe_generator.pyscripts/sensitivity_summary.pyscripts/optimizer_selector.pyscripts/surrogate_builder.py# Generate 20 LHS samples for 3 parameters
python3 scripts/doe_generator.py --params 3 --budget 20 --method lhs --json
# Full factorial with 4 levels per parameter (2 params -> 16 samples)
python3 scripts/doe_generator.py --params 2 --levels 4 --method factorial --json
# Rank parameters by sensitivity scores
python3 scripts/sensitivity_summary.py --scores 0.2,0.5,0.3 --names kappa,mobility,W --json
# Get optimizer recommendation for 3D problem with 50 eval budget
python3 scripts/optimizer_selector.py --dim 3 --budget 50 --noise low --json
# Build surrogate model from simulation data
python3 scripts/surrogate_builder.py --x 0,1,2 --y 10,12,15 --model rbf --json--params 2--budget 30python3 scripts/doe_generator.py --params 2 --budget 30 --method lhs --jsonpython3 scripts/sensitivity_summary.py --scores 0.7,0.3 --names conductivity,diffusivity --jsonpython3 scripts/optimizer_selector.py --dim 2 --budget 30 --noise low --json| Error | Cause | Resolution |
|---|---|---|
| Zero or negative dimension | Ask user for valid parameter count |
| Zero or negative budget | Ask user for realistic simulation budget |
| Invalid method (argparse) | Use decision guidance to pick a valid method |
| Non-numeric value in | Reformat as |
| Empty | Provide at least one numeric score |
doe_generator.pycoverage.countfactorialcount == levels ** paramsnoterequested_budget--methodquasi-randomsobolDeprecationWarningoptimizer_selector.pyrecommendedexpected_evalsexpected_evals <= budgetsensitivity_summary.pyranking< 0.1metrics.cv_errormserbfmsecv_errormetrics.output_variancecv_errorNaNpolyn > degree+1rbfn >= 3| Tempting shortcut | Why it's wrong / what to do |
|---|---|
"RBF surrogate | RBF is an exact interpolant — in-sample |
"I asked for | Factorial honors |
" | |
| "The optimizer recommendation is just advice — budget doesn't matter." | The recommendation is gated on dimension AND budget (BO only for |
| "One sensitivity score is highest, so that parameter dominates." | The script only sorts the scores you pass in; it computes no sensitivity itself. If the top score is |
| "It printed JSON without erroring, so the result is valid." | Exit success only means inputs parsed. Verify the design size, |
sensitivity_summary.py--names[a-zA-Z_][a-zA-Z0-9_ .-]*NaNInfdoe_generator.pyoptimizer_selector.py--methodlhsquasi-randomsobolfactorialsobolquasi-random--noiselowmediumhigh--modelrbfpoly--levels[2, 1000]allowed-toolsBasheval()exec()shell=Truesurrogate_builder.pypolyrbfmsecv_erroroutput_variancerbfmsecv_errorreferences/doe_methods.mdreferences/optimizer_selection.mdreferences/sensitivity_guidelines.mdreferences/surrogate_guidelines.mdpolyrbfmsecv_erroroutput_variance--levels