solve_convex_optimization
Solve convex optimization problems with CVXPY by defining variables, objectives, and constraints for linear, quadratic, and semidefinite programming.
Instructions
Solve convex optimization problems using CVXPY.
This tool is ideal for mathematical optimization problems with convex objectives
and constraints, including linear programming, quadratic programming, and
semidefinite programming.
Args:
variables: List of variable definitions with 'name' and 'shape'
objective_type: Either 'minimize' or 'maximize'
objective_expr: The objective function expression as a string
constraints: List of constraint expressions as strings
parameters: Dictionary of parameter values (e.g., matrices A, b)
description: Optional problem description
Returns:
Solution results including variable values and objective value
Example:
variables = [{"name": "x", "shape": 2}]
objective_type = "minimize"
objective_expr = "cp.sum_squares(x)"
constraints = ["x >= 0", "cp.sum(x) == 1"]
Input Schema
Name | Required | Description | Default |
---|---|---|---|
constraints | Yes | ||
description | No | ||
objective_expr | Yes | ||
objective_type | Yes | ||
parameters | No | ||
variables | Yes |
Input Schema (JSON Schema)
{
"properties": {
"constraints": {
"items": {
"type": "string"
},
"title": "Constraints",
"type": "array"
},
"description": {
"default": "",
"title": "Description",
"type": "string"
},
"objective_expr": {
"title": "Objective Expr",
"type": "string"
},
"objective_type": {
"title": "Objective Type",
"type": "string"
},
"parameters": {
"default": null,
"title": "Parameters",
"type": "object"
},
"variables": {
"items": {
"type": "object"
},
"title": "Variables",
"type": "array"
}
},
"required": [
"variables",
"objective_type",
"objective_expr",
"constraints"
],
"type": "object"
}