-
Notifications
You must be signed in to change notification settings - Fork 69
Feature/solver features registry #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/solver features registry #528
Conversation
|
AI Based research Solver Feature Research: SOS and Quadratic ConstraintsThis document summarizes research on solver support for SOS (Special Ordered Sets) and quadratic constraints. SOS1/SOS2 SupportSpecial Ordered Sets are used in branch and bound methods for branching on sets of variables, rather than individual variables. They help speed up the search procedure by giving the algorithm more intelligent ways to explore the solution space.
File Format SupportBoth LP and MPS file formats support SOS constraints: LP Format (Gurobi LP format): MPS Format (CPLEX MPS format):
Solver Support Matrix
Sources
Quadratic Constraints (QCP/QCQP)Quadratically Constrained Programs (QCP) and Quadratically Constrained Quadratic Programs (QCQP) involve constraints with quadratic terms. Support varies significantly:
Performance NotesFrom benchmark studies:
Sources
Current Linopy StatusAs of now, linopy does not support quadratic constraints. The def to_constraint(self, sign: SignLike, rhs: SideLike) -> NotImplementedType:
raise NotImplementedError(
"Quadratic expressions cannot be used in constraints."
)SOS constraints are also not currently implemented in linopy. Recommended Registry FeaturesBased on this research, the following features should be added to the solver capabilities registry: SOS ConstraintsSOS1 = auto() # Special Ordered Set Type 1
SOS2 = auto() # Special Ordered Set Type 2Quadratic ConstraintsQUADRATIC_CONSTRAINTS = auto() # Convex quadratic constraints (QCP)
NONCONVEX_QUADRATIC_CONSTRAINTS = auto() # Non-convex/bilinear constraintsSummary Table for Registry
Note: ❓ indicates features that need verification before adding to the registry. |
FabianHofmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FBumann wonderful. this is why I love open-source. I really like that abstraction. let's pull it in as soon as you are ready (you can give me a go and I have a final look)
| if ( | ||
| solver_supports(solver_name, SolverFeature.SOLUTION_FILE_NOT_NEEDED) | ||
| and not keep_files | ||
| ): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess here we could initialize the solver instance and support the features functions on it, instead of relying on helper functions with solver_name passed. but happy to keep it like this for now.
|
Thank you, i was just not getting around to it. |
Add a registry for solver features in preparation for both quadratic constraints and SOS constraints
Also for future proofing and documentation
This is a proof of concept and should be discussed regarding the design and how far we should go regarding solver features (only features needed in linopy or more)
Look into the
dev-scripts/for details and usage for nowImportant catch:
We should separate Solver supported features and if we implemented them. DIRECT_API might be better located in the IO of each solver, as its more of an implementation thing.
Checklist
doc.doc/release_notes.rstof the upcoming release is included.