OSQP Ruby
The OSQP (Operator Splitting Quadratic Program) solver for Ruby
Installation
Add this line to your application’s Gemfile:
gem "osqp"
Getting Started
Prep the problem - here’s how it should be setup
p = [[4, 1], [0, 2]]
q = [1, 1]
a = [[1, 1], [1, 0], [0, 1]]
l = [1, 0, 0]
u = [1, 0.7, 0.7]
And solve it
solver = OSQP::Solver.new
solver.solve(p, q, a, l, u, alpha: 1.0)
All of these settings are supported.
Warm start
solver.warm_start(x, y)
Data
Arrays and matrices can be Ruby arrays
[[1, 2, 3], [4, 5, 6]]
Or Numo arrays
Numo::NArray.cast([[1, 2, 3], [4, 5, 6]])
Resources
Credits
This library is modeled after the OSQP Python API.
History
View the changelog
Contributing
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development:
git clone https://github.com/ankane/osqp-ruby.git
cd osqp-ruby
bundle install
bundle exec rake vendor:all
bundle exec rake test