Skip to main content
Glama
cvxpy_models.py1.3 kB
from enum import Enum from typing import Any from pydantic import BaseModel class ObjectiveType(str, Enum): """Enum for objective types in CVXPY.""" MINIMIZE = "minimize" MAXIMIZE = "maximize" class CVXPYVariable(BaseModel): """Model representing a CVXPY variable.""" name: str shape: int | tuple[int, ...] # Can be scalar (int) or vector/matrix (tuple) class CVXPYConstraint(BaseModel): """Model representing a CVXPY constraint.""" expression: str # String representation of the constraint description: str = "" class CVXPYObjective(BaseModel): """Model representing a CVXPY objective.""" type: ObjectiveType expression: str # String representation of the objective function class CVXPYProblem(BaseModel): """Model representing a complete CVXPY optimization problem.""" variables: list[CVXPYVariable] objective: CVXPYObjective constraints: list[CVXPYConstraint] parameters: dict[str, Any] = {} # For A, b, etc. description: str = "" class CVXPYSolution(BaseModel): """Model representing a solution to a CVXPY problem.""" values: dict[str, Any] # Variable values objective_value: float | None status: str dual_values: dict[int, Any] | None = None # Constraint index to dual value

Implementation Reference

Latest Blog Posts

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