Package: tf-osqp
TF-OSQPTensorflow 2.x implementation ofOSQP.This is not an official OSQP implementation.You can find official versionshere.From their page:The OSQP (Operator Splitting Quadratic Program) solver is a numerical
optimization package for solving problems in the formminimize        0.5 x' P x + q' x

subject to      l <= A x <= uwherex in R^nis the optimization variable. The objective function
is defined by a positive semidefinite matrixP in S^n_+and vectorq in R^n. The linear constraints are defined by matrixA in R^{m x n}and vectorsl in R^m U {-inf}^m,u in R^m U {+inf}^m.MotivationThis project was created as a complement to a new TF2 implementation for the Revised Greedy Expansion algorithm used to find the convex hull of high dimensional vectors. Locating the distance of a point from a convex hull requires the solution of linearly constrained quadratic equations.Code for that project will be made available soon.FeaturesLive in latest releaseFull TF 2.x compatibility:All computations use native TF opsPython side effects absent:Every constant and variable coded as named instances oftf.constantandtf.VariableWell documented:Docstrings available for all function with constraints and meanings explained for parametersFuture releasesGraph mode execution:Leverage tf.function() to execute code in Graph mode on TF2Training parameter assignment:Ability to modify training parameters extended to every single parameterFull OSQP feature set:Remaining features like solution polishing addedDependenciesDependencyDescriptionVersionLicenseTensorFlowOpen source symbolic math library for ML>= 2.4rc3Apache 2.0pythonBase python software>= 3.6PSFnumpyUsed to define nan and inf constants>= 1.18NumPy LicenseInstallationLatest PyPI releasepip install tf_osqpUsageHaving definedtf.float32matrices P, q, A, l, u, use the code as follows:from tf_osqp.tf_osqp import solver

quad_solver = solver()
quad_solver.set_problem(P, q, A, l, u)

x, y = quad_solver.solve()Here, x will be the solution at optima, y will be the corresponding LagrangianContributeProduct backlogCurrent implementation is the skeletal engine written to get the work done. It is some way away from full potential.Refactor code to tf.function() to capitalize on speedups from Graph executionCurrent version uses Eager execution. This constrains performance and speeds are similar to numpy implementationAdd remaining OSQP functionality, e.g., solution polishingMake API freer to use, including option for warm starts and changing training parameters between iterationsCode styleCode is written with PEP-8 guidelines - recommended for PRs.CitationsG. Banjac, P. Goulart, B. Stellato, and S. Boyd, Infeasibility detection in the alternating direction method of multipliers for convex optimization, Journal of Optimization Theory and Applications 183(2019), no. 2, 490–519.G. Banjac, B. Stellato, N. Moehle, P. Goulart, A. Bemporad, and S. Boyd, Embedded codegeneration using the OSQP solver, IEEE Conference on Decision and Control (CDC), 2017.M. Schubiger, G. Banjac, and J. Lygeros, GPU acceleration of ADMM for large-scale quadratic programming, Journal of Parallel and Distributed Computing 144(2020), 55–67.B. Stellato, G. Banjac, P. Goulart, A. Bemporad, and S. Boyd, OSQP: an operator splitting solver for quadratic programs, Mathematical Programming Computation 12(2020), no. 4,637–672.B. Stellato, V. V. Naik, A. Bemporad, P. Goulart, and S. Boyd, Embedded mixed-integer quadratic optimization using the OSQP solver, European Control Conference (ECC), 2018The original pure python source code for OSQP can be found on their repohere.Current implementation in this repo can execute on GPUs but the code hasn't been optimized to offer large speed ups yet. To see better performance on GPUs, the recommendation is to OSQP's recommended CUDA implementation:cuosqpLicenseApache 2.0