osqp 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e721678e2eb8df7ff378a6e911a6529f375330a425d368eea7651431b98fff6b
4
+ data.tar.gz: a9ca333a0b41fc73a416a17120219319bd21ffd49ee1d8485d63139dedc4d6b3
5
+ SHA512:
6
+ metadata.gz: 95e1f12f1bcbd481df015f9c13c4f504dec97d1a64be0b3bc160943b84ab52f9a218a8ed6d0886d0442c8dbef86ccffc0ba41d78b46c095020ecaeca5b553ded
7
+ data.tar.gz: '09ef23d7238da57d9092afc5a537670a9607eca88acb628118b68b7da6d514d1a5762c802b5e28487c13c326c9a6e72edfc15f93e7f8f1ac1a17f56399c1772d'
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 (2019-11-16)
2
+
3
+ - First release
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2019 Andrew Kane
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # OSQP
2
+
3
+ The [OSQP](https://osqp.org/) (Operator Splitting Quadratic Program) solver for Ruby
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application’s Gemfile:
8
+
9
+ ```ruby
10
+ gem 'osqp'
11
+ ```
12
+
13
+ ## Getting Started
14
+
15
+ Prep the problem - here’s how it should be [setup](https://osqp.org/docs/examples/setup-and-solve.html)
16
+
17
+ ```ruby
18
+ p = [[4, 1], [0, 2]]
19
+ q = [1, 1]
20
+ a = [[1, 1], [1, 0], [0, 1]]
21
+ l = [1, 0, 0]
22
+ u = [1, 0.7, 0.7]
23
+ ```
24
+
25
+ And solve it
26
+
27
+ ```ruby
28
+ solver = OSQP::Solver.new
29
+ solver.solve(p, q, a, l, u, alpha: 1.0)
30
+ ```
31
+
32
+ All of [these settings](https://osqp.org/docs/interfaces/solver_settings.html#solver-settings) are supported.
33
+
34
+ Warm start
35
+
36
+ ```ruby
37
+ solver.warm_start(x, y)
38
+ ```
39
+
40
+ ## Data
41
+
42
+ Arrays and matrices can be Ruby arrays
43
+
44
+ ```ruby
45
+ [[1, 2, 3], [4, 5, 6]]
46
+ ```
47
+
48
+ Or a Numo NArrays
49
+
50
+ ```ruby
51
+ Numo::DFloat.new(3, 2).seq
52
+ ```
53
+
54
+ ## Resources
55
+
56
+ - [OSQP: An Operator Splitting Solver for Quadratic Programs](https://arxiv.org/pdf/1711.08013.pdf)
57
+ - [Benchmarks](https://github.com/oxfordcontrol/osqp_benchmarks)
58
+ - [Status values and errors](https://osqp.org/docs/interfaces/status_values.html)
59
+
60
+ ## Credits
61
+
62
+ This library is modeled after the OSQP [Python API](https://osqp.org/docs/interfaces/python.html).
63
+
64
+ ## History
65
+
66
+ View the [changelog](https://github.com/ankane/osqp/blob/master/CHANGELOG.md)
67
+
68
+ ## Contributing
69
+
70
+ Everyone is encouraged to help improve this project. Here are a few ways you can help:
71
+
72
+ - [Report bugs](https://github.com/ankane/osqp/issues)
73
+ - Fix bugs and [submit pull requests](https://github.com/ankane/osqp/pulls)
74
+ - Write, clarify, or fix documentation
75
+ - Suggest or add new features
76
+
77
+ To get started with development and testing:
78
+
79
+ ```sh
80
+ git clone https://github.com/ankane/osqp.git
81
+ cd osqp
82
+ bundle install
83
+ bundle exec rake test
84
+ ```
data/lib/osqp.rb ADDED
@@ -0,0 +1,15 @@
1
+ # stdlib
2
+ require "fiddle/import"
3
+
4
+ # modules
5
+ require "osqp/ffi"
6
+ require "osqp/solver"
7
+ require "osqp/version"
8
+
9
+ module OSQP
10
+ class Error < StandardError; end
11
+
12
+ def self.lib_version
13
+ FFI.osqp_version.to_s
14
+ end
15
+ end
data/lib/osqp/ffi.rb ADDED
@@ -0,0 +1,142 @@
1
+ module FFI
2
+ extend Fiddle::Importer
3
+
4
+ lib =
5
+ if Gem.win_platform?
6
+ "libosqp.dll"
7
+ elsif RbConfig::CONFIG["host_os"] =~ /darwin/i
8
+ "libosqp.dylib"
9
+ else
10
+ "libosqp.so"
11
+ end
12
+
13
+ dlload File.expand_path("../../vendor/#{lib}", __dir__)
14
+
15
+ typealias "c_float", "double"
16
+ typealias "c_int", "long long"
17
+ typealias "enum", "int"
18
+
19
+ Data = struct [
20
+ "c_int n",
21
+ "c_int m",
22
+ "csc *p",
23
+ "csc *a",
24
+ "c_float *q",
25
+ "c_float *l",
26
+ "c_float *u"
27
+ ]
28
+
29
+ Settings = struct [
30
+ "c_float rho",
31
+ "c_float sigma",
32
+ "c_int scaling",
33
+ "c_int adaptive_rho",
34
+ "c_int adaptive_rho_interval",
35
+ "c_float adaptive_rho_tolerance",
36
+ "c_float adaptive_rho_fraction",
37
+ "c_int max_iter",
38
+ "c_float eps_abs",
39
+ "c_float eps_rel",
40
+ "c_float eps_prim_inf",
41
+ "c_float eps_dual_inf",
42
+ "c_float alpha",
43
+ "enum linsys_solver_type linsys_solver",
44
+ "c_float delta",
45
+ "c_int polish",
46
+ "c_int polish_refine_iter",
47
+ "c_int verbose",
48
+ "c_int scaled_termination",
49
+ "c_int check_termination",
50
+ "c_int warm_start",
51
+ "c_float time_limit"
52
+ ]
53
+
54
+ Info = struct [
55
+ "c_int iter",
56
+ "char status[32]",
57
+ "c_int status_val",
58
+ "c_int status_polish",
59
+ "c_float obj_val",
60
+ "c_float pri_res",
61
+ "c_float dua_res",
62
+ "c_float setup_time",
63
+ "c_float solve_time",
64
+ "c_float update_time",
65
+ "c_float polish_time",
66
+ "c_float run_time",
67
+ "c_int rho_updates",
68
+ "c_float rho_estimate"
69
+ ]
70
+
71
+ Workspace = struct [
72
+ "OSQPData *data",
73
+ "LinSysSolver *linsys_solver",
74
+ "OSQPPolish *pol",
75
+ "c_float *rho_vec",
76
+ "c_float *rho_inv_vec",
77
+ "c_int *constr_type",
78
+ "c_float *x",
79
+ "c_float *y",
80
+ "c_float *z",
81
+ "c_float *xz_tilde",
82
+ "c_float *x_prev",
83
+ "c_float *z_prev",
84
+ "c_float *Ax",
85
+ "c_float *Px",
86
+ "c_float *Aty",
87
+ "c_float *delta_y",
88
+ "c_float *Atdelta_y",
89
+ "c_float *delta_x",
90
+ "c_float *Pdelta_x",
91
+ "c_float *Adelta_x",
92
+ "c_float *D_temp",
93
+ "c_float *D_temp_A",
94
+ "c_float *E_temp",
95
+ "OSQPSettings *settings",
96
+ "OSQPScaling *scaling",
97
+ "OSQPSolution *solution",
98
+ "OSQPInfo *info",
99
+ "OSQPTimer *timer",
100
+ "c_int first_run",
101
+ "c_int clear_update_time",
102
+ "c_int rho_update_from_solve",
103
+ "c_int summary_printed"
104
+ ]
105
+
106
+ # cs.h
107
+ extern "csc* csc_matrix(c_int m, c_int n, c_int nzmax, c_float *x, c_int *i, c_int *p)"
108
+
109
+ # osqp.h
110
+ extern "void osqp_set_default_settings(OSQPSettings *settings)"
111
+ extern "c_int osqp_setup(OSQPWorkspace** workp, OSQPData* data, OSQPSettings* settings)"
112
+ extern "c_int osqp_solve(OSQPWorkspace *work)"
113
+ extern "c_int osqp_cleanup(OSQPWorkspace *work)"
114
+ extern "c_int osqp_update_lin_cost(OSQPWorkspace *work, c_float *q_new)"
115
+ extern "c_int osqp_update_bounds(OSQPWorkspace *work, c_float *l_new, c_float *u_new)"
116
+ extern "c_int osqp_update_lower_bound(OSQPWorkspace *work, c_float *l_new)"
117
+ extern "c_int osqp_update_upper_bound(OSQPWorkspace *work, c_float *u_new)"
118
+ extern "c_int osqp_warm_start(OSQPWorkspace *work, c_float *x, c_float *y)"
119
+ extern "c_int osqp_warm_start_x(OSQPWorkspace *work, c_float *x)"
120
+ extern "c_int osqp_warm_start_y(OSQPWorkspace *work, c_float *y)"
121
+ extern "c_int osqp_update_P(OSQPWorkspace *work, c_float *Px_new, c_int *Px_new_idx, c_int P_new_n)"
122
+ extern "c_int osqp_update_A(OSQPWorkspace *work, c_float *Ax_new, c_int *Ax_new_idx, c_int A_new_n)"
123
+ extern "c_int osqp_update_P_A(OSQPWorkspace *work, c_float *Px_new, c_int *Px_new_idx, c_int P_new_n, c_float *Ax_new, c_int *Ax_new_idx, c_int A_new_n)"
124
+ extern "c_int osqp_update_rho(OSQPWorkspace *work, c_float rho_new)"
125
+ extern "c_int osqp_update_max_iter(OSQPWorkspace *work, c_int max_iter_new)"
126
+ extern "c_int osqp_update_eps_abs(OSQPWorkspace *work, c_float eps_abs_new)"
127
+ extern "c_int osqp_update_eps_rel(OSQPWorkspace *work, c_float eps_rel_new)"
128
+ extern "c_int osqp_update_eps_prim_inf(OSQPWorkspace *work, c_float eps_prim_inf_new)"
129
+ extern "c_int osqp_update_eps_dual_inf(OSQPWorkspace *work, c_float eps_dual_inf_new)"
130
+ extern "c_int osqp_update_alpha(OSQPWorkspace *work, c_float alpha_new)"
131
+ extern "c_int osqp_update_warm_start(OSQPWorkspace *work, c_int warm_start_new)"
132
+ extern "c_int osqp_update_scaled_termination(OSQPWorkspace *work, c_int scaled_termination_new)"
133
+ extern "c_int osqp_update_check_termination(OSQPWorkspace *work, c_int check_termination_new)"
134
+ extern "c_int osqp_update_delta(OSQPWorkspace *work, c_float delta_new)"
135
+ extern "c_int osqp_update_polish(OSQPWorkspace *work, c_int polish_new)"
136
+ extern "c_int osqp_update_polish_refine_iter(OSQPWorkspace *work, c_int polish_refine_iter_new)"
137
+ extern "c_int osqp_update_verbose(OSQPWorkspace *work, c_int verbose_new)"
138
+ extern "c_int osqp_update_time_limit(OSQPWorkspace *work, c_float time_limit_new)"
139
+
140
+ # util.h
141
+ extern "const char* osqp_version(void)"
142
+ end
@@ -0,0 +1,189 @@
1
+ module OSQP
2
+ class Solver
3
+ def setup(p, q, a, l, u, **settings)
4
+ # settings
5
+ set = FFI::Settings.malloc
6
+ FFI.osqp_set_default_settings(set)
7
+
8
+ # hack for setting members with []=
9
+ # safer than send("#{k}=", v)
10
+ entity = set.to_ptr
11
+ settings.each do |k, v|
12
+ entity[k.to_s] = settings_value(v)
13
+ end
14
+
15
+ m, n = shape(a)
16
+
17
+ # data
18
+ data = FFI::Data.malloc
19
+ data.n = n
20
+ data.m = m
21
+ data.p = csc_matrix(p)
22
+ data.q = float_array(q)
23
+ data.a = csc_matrix(a)
24
+ data.l = float_array(l)
25
+ data.u = float_array(u)
26
+
27
+ # work
28
+ work = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP)
29
+ check_result FFI.osqp_setup(work.ref, data, set)
30
+
31
+ @work = work
32
+ end
33
+
34
+ def solve(*args, **settings)
35
+ setup(*args, **settings) if args.any? || settings.any?
36
+
37
+ check_result FFI.osqp_solve(@work)
38
+ workspace = FFI::Workspace.new(@work)
39
+
40
+ # data
41
+ data = FFI::Data.new(workspace.data)
42
+ x = read_float_array(workspace.x, data.n)
43
+ y = read_float_array(workspace.y, data.m)
44
+
45
+ # info
46
+ info = FFI::Info.new(workspace.info)
47
+ status = info.status
48
+ idx = status.index { |v| v == 0 }
49
+
50
+ # TODO prim_inf_cert and dual_inf_cert
51
+ {
52
+ x: x,
53
+ y: y,
54
+ iter: info.iter,
55
+ status: status[0, idx].map(&:chr).join,
56
+ status_val: info.status_val,
57
+ status_polish: info.status_polish,
58
+ obj_val: info.obj_val,
59
+ pri_res: info.pri_res,
60
+ dua_res: info.dua_res,
61
+ setup_time: info.setup_time,
62
+ solve_time: info.solve_time,
63
+ update_time: info.update_time,
64
+ polish_time: info.polish_time,
65
+ run_time: info.run_time,
66
+ rho_estimate: info.rho_estimate,
67
+ rho_updates: info.rho_updates
68
+ }
69
+ end
70
+
71
+ def warm_start(x, y)
72
+ # check dimensions
73
+ workspace = FFI::Workspace.new(@work)
74
+ data = FFI::Data.new(workspace.data)
75
+ raise Error, "Expected x to be size #{data.n}, got #{x.size}" if x && x.size != data.n
76
+ raise Error, "Expected y to be size #{data.m}, got #{y.size}" if y && y.size != data.m
77
+
78
+ if x && y
79
+ check_result FFI.osqp_warm_start(@work, float_array(x), float_array(y))
80
+ elsif x
81
+ check_result FFI.osqp_warm_start_x(@work, float_array(x))
82
+ elsif y
83
+ check_result FFI.osqp_warm_start_y(@work, float_array(y))
84
+ else
85
+ raise Error, "Must set x or y"
86
+ end
87
+ end
88
+
89
+ private
90
+
91
+ def check_result(ret)
92
+ if ret != 0
93
+ # keep similar to official messages to make it easier to search online
94
+ # https://osqp.org/docs/interfaces/status_values.html
95
+ message =
96
+ case ret
97
+ when 1
98
+ "Data validation error"
99
+ when 2
100
+ "Settings validation error"
101
+ when 3
102
+ "Linear system solver loading error"
103
+ when 4
104
+ "Linear system solver initialization error"
105
+ when 5
106
+ "Non-convex problem"
107
+ when 6
108
+ "Memory allocation error"
109
+ when 7
110
+ "Workspace not initialized"
111
+ else
112
+ "Error code #{ret}"
113
+ end
114
+
115
+ raise Error, message
116
+ end
117
+ end
118
+
119
+ def float_array(arr)
120
+ # OSQP float = double
121
+ Fiddle::Pointer[arr.to_a.pack("d*")]
122
+ end
123
+
124
+ def int_array(arr)
125
+ # OSQP int = long long
126
+ Fiddle::Pointer[arr.to_a.pack("q*")]
127
+ end
128
+
129
+ def read_float_array(ptr, size)
130
+ # OSQP float = double
131
+ ptr[0, size * Fiddle::SIZEOF_DOUBLE].unpack("d*")
132
+ end
133
+
134
+ # TODO add support sparse matrices
135
+ # TODO convert to upper triangle like Python
136
+ def csc_matrix(mtx)
137
+ mtx = mtx.to_a
138
+
139
+ m, n = shape(mtx)
140
+
141
+ cx = []
142
+ ci = []
143
+ cp = []
144
+
145
+ # CSC format
146
+ # https://www.gormanalysis.com/blog/sparse-matrix-storage-formats/
147
+ cp << 0
148
+ n.times do |i|
149
+ mtx.each_with_index do |row, j|
150
+ if row[i] != 0
151
+ cx << row[i]
152
+ ci << j
153
+ end
154
+ end
155
+ # cumulative column values
156
+ cp << cx.size
157
+ end
158
+
159
+ nnz = cx.size
160
+ cx = float_array(cx)
161
+ ci = int_array(ci)
162
+ cp = int_array(cp)
163
+
164
+ FFI.csc_matrix(m, n, nnz, cx, ci, cp)
165
+ end
166
+
167
+ def shape(a)
168
+ if defined?(Matrix) && a.is_a?(Matrix)
169
+ [a.row_count, a.column_count]
170
+ elsif defined?(Numo::NArray) && a.is_a?(Numo::NArray)
171
+ a.shape
172
+ else
173
+ [a.size, a.first.size]
174
+ end
175
+ end
176
+
177
+ # handle booleans
178
+ def settings_value(v)
179
+ case v
180
+ when true
181
+ 1
182
+ when false
183
+ 0
184
+ else
185
+ v
186
+ end
187
+ end
188
+ end
189
+ end
@@ -0,0 +1,3 @@
1
+ module OSQP
2
+ VERSION = "0.1.0"
3
+ end
data/vendor/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2019 Bartolomeo Stellato, Goran Banjac, Paul Goulart, Stephen Boyd
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/vendor/NOTICE ADDED
@@ -0,0 +1,14 @@
1
+ OSQP
2
+ Copyright (c) 2019 Bartolomeo Stellato, Goran Banjac, Paul Goulart, Stephen Boyd
3
+
4
+ This product includes software developed at Stanford University and at the University of Oxford.
5
+
6
+
7
+ The following external modules are included in this software library
8
+
9
+ QDLDL
10
+ Copyright (c) 2018, Paul Goulart, Bartolomeo Stellato, Goran Banjac.
11
+
12
+ AMD
13
+ Copyright (c) 1996-2015, Timothy A. Davis, Patrick R. Amestoy, and Iain S. Duff.
14
+
Binary file
Binary file
data/vendor/libosqp.so ADDED
Binary file
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: osqp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Kane
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-11-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: numo-narray
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email: andrew@chartkick.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - CHANGELOG.md
76
+ - LICENSE.txt
77
+ - README.md
78
+ - lib/osqp.rb
79
+ - lib/osqp/ffi.rb
80
+ - lib/osqp/solver.rb
81
+ - lib/osqp/version.rb
82
+ - vendor/LICENSE
83
+ - vendor/NOTICE
84
+ - vendor/libosqp.dll
85
+ - vendor/libosqp.dylib
86
+ - vendor/libosqp.so
87
+ homepage: https://github.com/ankane/osqp
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '2.4'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubygems_version: 3.0.6
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: OSQP (Operator Splitting Quadratic Program) solver for Ruby
110
+ test_files: []