Skip to main content
Glama

USolver

by sdiehl

solve_cvxpy_problem

Solve CVXPY optimization problems by defining variables, objectives, and constraints. Returns solutions for linear, quadratic, and convex optimization tasks efficiently.

Instructions

Solve a CVXPY optimization problem.

This tool takes a CVXPY optimization problem defined with variables, objective, and constraints, and returns a solution if one exists. Example: Solve the following problem: minimize ||Ax - b||₂² subject to: 0 ≤ x ≤ 1 where A = [1.0, -0.5; 0.5, 2.0; 0.0, 1.0] and b = [2.0, 1.0, -1.0] Should be this tool call: simple_cvxpy_solver( variables=[{"name": "x", "shape": 2}], objective_type="minimize", objective_expr="cp.sum_squares(np.array(A) @ x - np.array(b))", constraints=["x >= 0", "x <= 1"], parameters={"A": [[1.0, -0.5], [0.5, 2.0], [0.0, 1.0]], "b": [2.0, 1.0, -1.0]} ) Args: problem: The problem definition with variables, objective, and constraints Returns: A list of TextContent containing the solution or an error message

Input Schema

NameRequiredDescriptionDefault
problemYes

Input Schema (JSON Schema)

{ "$defs": { "CVXPYConstraint": { "description": "Model representing a CVXPY constraint.", "properties": { "description": { "default": "", "title": "Description", "type": "string" }, "expression": { "title": "Expression", "type": "string" } }, "required": [ "expression" ], "title": "CVXPYConstraint", "type": "object" }, "CVXPYObjective": { "description": "Model representing a CVXPY objective.", "properties": { "expression": { "title": "Expression", "type": "string" }, "type": { "$ref": "#/$defs/ObjectiveType" } }, "required": [ "type", "expression" ], "title": "CVXPYObjective", "type": "object" }, "CVXPYProblem": { "description": "Model representing a complete CVXPY optimization problem.", "properties": { "constraints": { "items": { "$ref": "#/$defs/CVXPYConstraint" }, "title": "Constraints", "type": "array" }, "description": { "default": "", "title": "Description", "type": "string" }, "objective": { "$ref": "#/$defs/CVXPYObjective" }, "parameters": { "default": {}, "title": "Parameters", "type": "object" }, "variables": { "items": { "$ref": "#/$defs/CVXPYVariable" }, "title": "Variables", "type": "array" } }, "required": [ "variables", "objective", "constraints" ], "title": "CVXPYProblem", "type": "object" }, "CVXPYVariable": { "description": "Model representing a CVXPY variable.", "properties": { "name": { "title": "Name", "type": "string" }, "shape": { "anyOf": [ { "type": "integer" }, { "items": { "type": "integer" }, "type": "array" } ], "title": "Shape" } }, "required": [ "name", "shape" ], "title": "CVXPYVariable", "type": "object" }, "ObjectiveType": { "description": "Enum for objective types in CVXPY.", "enum": [ "minimize", "maximize" ], "title": "ObjectiveType", "type": "string" } }, "properties": { "problem": { "$ref": "#/$defs/CVXPYProblem" } }, "required": [ "problem" ], "title": "solve_cvxpy_problem_toolArguments", "type": "object" }

You must be authenticated.

Other Tools from USolver

Related Tools

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sdiehl/usolver'

If you have feedback or need assistance with the MCP directory API, please join our Discord server