ワンクリックで
run-solver
运行数学模型求解器。在本地 Python/MATLAB 环境执行求解代码,收集结果,超时保护。当用户说'运行求解'、'run solver'、'跑代码'时使用。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
运行数学模型求解器。在本地 Python/MATLAB 环境执行求解代码,收集结果,超时保护。当用户说'运行求解'、'run solver'、'跑代码'时使用。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
数据清洗、EDA、缺失值处理、异常值检测、相关性分析。触发词: 数据预处理、数据清洗、EDA、缺失值、异常值、data preprocessing、数据探索。
模型验证:交叉验证、留出法、残差分析、与已知解对比、假设检验。触发词: 模型验证、交叉验证、残差分析、model validation、留出法、误差分析、假设检验。
多子问题拆解与依赖分析。触发词: 子问题拆解、拆题、problem decomposition、依赖关系、求解顺序、时间分配、并行安排。
灵敏度分析:参数扰动、单因素/多因素分析、Monte Carlo 模拟、龙卷风图/蛛网图。触发词: 灵敏度分析、参数敏感性、sensitivity analysis、Monte Carlo、鲁棒性测试、参数扰动。
自动多轮评审优化循环。通过 Codex MCP 反复评审→修改→重新评审,直到达标或达到最大轮数。当用户说'自动优化循环'、'auto optimize'、'评审到通过'时使用。
Autonomously improve a generated paper via GPT-5.4 xhigh review → implement fixes → recompile, for 2 rounds. Use when user says "改论文", "improve paper", "论文润色循环", "auto improve", or wants to iteratively polish a generated paper.
| name | run-solver |
| description | 运行数学模型求解器。在本地 Python/MATLAB 环境执行求解代码,收集结果,超时保护。当用户说'运行求解'、'run solver'、'跑代码'时使用。 |
| argument-hint | ["solver-script-or-description"] |
| allowed-tools | Bash(*), Read, Grep, Glob, Edit, Write, Agent |
在本地环境执行数模求解代码: $ARGUMENTS
Read the project's CLAUDE.md to determine the compute environment:
If no environment info is found in CLAUDE.md, auto-detect:
# Check Python
python3 --version 2>/dev/null || python --version 2>/dev/null
pip list 2>/dev/null | grep -E "numpy|scipy|matplotlib|pandas|sklearn|pulp|cvxpy"
# Check MATLAB
which matlab 2>/dev/null && matlab -batch "disp('MATLAB OK')" 2>/dev/null
Check compute environment readiness:
# Check available memory
python3 -c "import psutil; print(f'RAM: {psutil.virtual_memory().total/1e9:.1f} GB, Available: {psutil.virtual_memory().available/1e9:.1f} GB')"
# Check required packages
python3 -c "
import importlib, sys
required = ['numpy', 'scipy', 'matplotlib', 'pandas']
missing = [p for p in required if importlib.util.find_spec(p) is None]
if missing: print(f'Missing: {missing}'); sys.exit(1)
print('All required packages available')
"
If packages are missing, install them:
pip install numpy scipy matplotlib pandas scikit-learn
SOLVE_PLAN.md or refine-logs/SOLVE_PLAN.md for the execution orderGlob: **/*.py, **/*.m
python3 -m py_compile <script>
Ensure the solver scripts have proper logging:
Check if logging is already in the script — look for import logging or print statements with progress info. If present, skip to Step 4.
If not present, add basic logging to the solver script:
import logging, time
logging.basicConfig(filename='solve_log.txt', level=logging.INFO,
format='%(asctime)s - %(message)s')
# Inside solving loop:
logging.info(f"Iteration {i}: objective={obj_value:.6f}, residual={residual:.6e}")
# After completion:
logging.info(f"Solving complete. Total time: {time.time()-start:.1f}s")
Metrics to log (add whichever apply to the solver):
iteration — current iteration numberobjective — objective function valueresidual — convergence residualelapsed_time — time since startR², RMSE, or other relevant metricsLog files are saved to the project directory for later inspection by
/monitor-solverand/analyze-results.
# Run solver with timeout protection
timeout 3600 python3 <script> <args> 2>&1 | tee solve_log.txt
# For long-running solvers, use background execution
python3 <script> <args> > solve_log.txt 2>&1 &
echo $! > solver_pid.txt
# Run MATLAB script
timeout 3600 matlab -batch "run('<script>')" 2>&1 | tee solve_log.txt
For long-running jobs, use run_in_background: true to keep the conversation responsive.
Check process is running and producing output:
# Check if process is still running
ps aux | grep -E "python|matlab" | grep -v grep
# Check if log file is growing
ls -la solve_log.txt
tail -5 solve_log.txt
After solver completes:
echo "=== 求解完成 ==="
echo "退出码: $?"
echo "耗时: $(cat solve_log.txt | grep 'Total time' | tail -1)"
echo "输出文件:"
ls -la results/ output/ figures/ 2>/dev/null
cat << 'EOF' > file) to write in chunks. Do NOT ask the user for permission — just do it silently.tee to save logs for later inspectionrun_in_background: true to keep conversation responsiveUsers should add their environment info to their project's CLAUDE.md:
## 计算环境
- Python: 3.10+ with numpy, scipy, matplotlib, pandas, scikit-learn
- MATLAB: R2024a (optional)
- 额外包: cvxpy (for optimization), networkx (for graph problems)
- 超时限制: 60 minutes per solver
- 数据目录: data/
- 结果目录: results/
环境配置: Ensure all required packages are installed before running. The skill will auto-detect and install missing Python packages, but MATLAB toolboxes must be pre-installed.