Skip to content

Conversation

Shurikal
Copy link

I added a first draft how quadratic solvers could be implemented. As an example I took the clarabel solver which is able to solve Quadratic Programs of the form:

$$ \begin{aligned} \min & \tfrac{1}{2}\ x^\top P x + q^\top x \\ \text{subject to}\quad & A x + s = b, \\ & s \in \mathcal{K}. \end{aligned} $$

K is a composition of convex cones.

Currently only linear constraints are supported for the clarabel quadratic solver.

To enable the quadratic features, I added a flag called enable_quadratic to not change the default behavior.
I added some tests in quadratic_solver_tests.rs.

Full disclaimer, I used Claude to help me, because I'm not a good rust programmer...

If there are any suggestion how to improve this, I'm happy to implement them :) .

…andling

- Introduced `IntoQuadraticExpression` trait for converting various types (e.g., `Expression`, `Variable`, numeric constants) into quadratic expressions.
- Removed the `QuadraticUnsolvedProblem` struct and integrated its functionality into the existing `UnsolvedProblem` struct.
- Updated solvers (`clarabel`, `coin_cbc`, `lp_solve`, `microlp`) to handle quadratic objectives appropriately, with checks and panic messages for unsupported cases.
- Refactored the `clarabel` solver to support both linear and quadratic objectives, consolidating the logic for building the objective matrix.
- Enhanced the `ProblemVariables` struct with new methods for creating optimization problems with quadratic objectives.
- Updated tests to validate the new quadratic functionality and ensure compatibility with existing linear problem-solving methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant