run_solver
Run constrained optimization on Excel cell references: adjust variable cells to minimize or maximize an objective expression, with optional constraints and bounds.
Instructions
Run constrained optimisation using scipy to minimise (or maximise) an objective built from cell references.
Args: file_path: Workbook path. sheet_name: Worksheet providing objective or referenced cells. objective_expression: Arithmetic expression using cell refs (e.g. "B2 * B3 - B4"). variable_cells: Mapping of cell_ref to bounds, e.g. {"B2": {"lower": 0, "upper": 100}}. constraints: Optional list of solver constraints, each with 'expression' and 'type' ('ineq' or 'eq'). maximize: If True, the objective is maximised instead of minimised. tolerance: Convergence tolerance. max_iterations: Maximum solver iterations.
Returns: SolverResult: Contains solution, status, and diagnostics.
Notes: - May write back solution values into the workbook depending on implementation — document write semantics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| maximize | No | ||
| file_path | Yes | ||
| tolerance | No | ||
| sheet_name | Yes | ||
| constraints | No | ||
| max_iterations | No | ||
| variable_cells | Yes | ||
| objective_expression | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | ||
| converged | Yes | ||
| iterations | Yes | ||
| found_values | Yes | ||
| objective_value | Yes |