一键导入
optimize
Solve constrained optimization problems using Z3. Supports minimization and maximization of objective functions over integer, real, and bitvector domains.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Solve constrained optimization problems using Z3. Supports minimization and maximization of objective functions over integer, real, and bitvector domains.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Conversational skill that interviews users to design new agentic workflows
Route gh-aw workflow design/create/debug/upgrade requests to the right prompts.
Run AddressSanitizer and UndefinedBehaviorSanitizer on the Z3 test suite to detect memory errors, undefined behavior, and leaks. Logs each finding to z3agent.db.
Run Clang Static Analyzer (scan-build) on Z3 source and log structured findings to z3agent.db.
Measure Z3 performance on a formula or file. Collects wall-clock time, theory solver statistics, memory usage, and conflict counts. Results are logged to z3agent.db for longitudinal tracking.
Translate constraint problems into SMT-LIB2 or Z3 Python API code. Handles common problem classes including scheduling, graph coloring, arithmetic puzzles, and verification conditions.
基于 SOC 职业分类
| name | optimize |
| description | Solve constrained optimization problems using Z3. Supports minimization and maximization of objective functions over integer, real, and bitvector domains. |
Given a set of constraints and an objective function, find the optimal value. Z3 supports both hard constraints (must hold) and soft constraints (weighted preferences), as well as lexicographic multi-objective optimization.
Action:
Write constraints and an objective using (minimize ...) or
(maximize ...) directives, followed by (check-sat) and (get-model).
Expectation: A valid SMT-LIB2 formula with at least one optimization directive and all variables declared.
Result: If the formula is well-formed, proceed to Step 2. For multi-objective problems, list directives in priority order for lexicographic optimization.
Example: minimize x + y subject to x >= 1, y >= 2, x + y <= 10:
(declare-const x Int)
(declare-const y Int)
(assert (>= x 1))
(assert (>= y 2))
(assert (<= (+ x y) 10))
(minimize (+ x y))
(check-sat)
(get-model)
Action: Invoke optimize.py with the formula or file path.
Expectation:
The script prints sat with the optimal assignment, unsat, unknown,
or timeout. A run entry is logged to z3agent.db.
Result:
On sat: proceed to Step 3 to read the optimal values.
On unsat or timeout: check constraints for contradictions or simplify.
python3 scripts/optimize.py --file scheduling.smt2
python3 scripts/optimize.py --formula "<inline smt-lib2>" --debug
Action: Parse the objective value and satisfying assignment from the output.
Expectation:
sat with a model containing the optimal value, unsat indicating
infeasibility, or unknown/timeout.
Result:
On sat: report the optimal value and assignment.
On unsat: the constraints are contradictory, no feasible solution exists.
On unknown/timeout: relax constraints or try simplify.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| formula | string | no | SMT-LIB2 formula with minimize/maximize | |
| file | path | no | path to .smt2 file | |
| timeout | int | no | 60 | seconds |
| z3 | path | no | auto | path to z3 binary |
| debug | flag | no | off | verbose tracing |
| db | path | no | .z3-agent/z3agent.db | logging database |