markowitz.optimizer.solvers¶
markowitz.optimizer.solvers
¶
Thin wrapper around CVXPY's Problem.solve with typed error mapping.
The wrapper exists for three reasons:
- Centralise the mapping from CVXPY's free-form status strings to our
typed exception hierarchy (so the optimizer body never needs to
grow a sprawling
if status == ...chain). - Provide a single place to plumb solver options through (default
CLARABELwith sensible tolerances, override via kwargs). - Provide a tiny
SolverResultcontainer so callers can introspect objective value / iteration count without poking at private attributes of the CVXPY problem.
SolverResult(status: str, objective_value: float, solver_name: str)
dataclass
¶
Outcome of a successful solve.
solve_problem(problem: cp.Problem, *, solver: str = 'CLARABEL', solver_options: dict[str, Any] | None = None) -> SolverResult
¶
Solve problem and translate failures to typed exceptions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
Problem
|
The CVXPY problem to solve. |
required |
solver
|
str
|
Solver name passed straight through to |
'CLARABEL'
|
solver_options
|
dict[str, Any] | None
|
Additional keyword arguments forwarded to the solver backend. |
None
|