validate_optimization_problem
Checks an optimization problem before solving: reports semantic errors with recommended actions, warnings, and compiled variable count estimate to avoid wasting remote solver quota.
Instructions
Check a structured optimization problem without solving it.
Returns semantic errors (each with a recommended_action), advisory
warnings, and an estimate of the compiled variable count including slack
bits. Call this before solve_optimization when planning to use a remote
backend, so problems can be fixed before spending quota, or when the
problem is large (many variables, wide integer ranges). On a local backend
solve_optimization can be called directly: an invalid document returns
status invalid_problem with the same errors and recommended_action.
Nothing is compiled or solved and no network requests are made.
solve_optimization reports the same warnings for the same backend, so
skipping this call never hides them; calling it first only saves the
solve.
A field the schema does not declare is a tool error naming its path,
never ignored: check the schema (get_optimization_capabilities with
include_schema: true returns it as problem_json_schema) before inventing
one.
The estimate follows the model type the chosen backend compiles to. On a
bqm backend it counts the slack bits of every inequality constraint plus
the binary-encoding bits of every integer variable, so a wider
lower_bound..upper_bound range costs more compiled variables. On a cqm
backend integer variables are native and no encoding bits are counted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| problem | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| valid | Yes | Decided by errors alone. Warnings are advisory and never make a problem invalid. | |
| errors | No | Every error found in one pass — validation does not stop at the first. Empty means the problem is safe to compile. | |
| warnings | No | Advisory findings that do not block a solve. Only produced when there are no errors. | |
| model_type | No | Which compiler path the estimate assumed. Null when the problem is invalid. | |
| objective_scale | No | The upper bound on the objective's range, used to size hard penalties and to judge whether a soft weight is meaningful. Null when the problem is invalid. | |
| estimated_compiled_variables | No | Compiled size without building a model: on the BQM path, binary variables + integer-encoding bits + slack bits; on the CQM path, variables + integer slacks. Null when the problem is invalid. |