osqp 0.6.0
Closes #45142. Signed-off-by: Rui Chen <chenrui333@gmail.com>
This commit is contained in:
parent
fdc7ffc807
commit
01e62509c4
1 changed files with 21 additions and 19 deletions
|
@ -1,8 +1,8 @@
|
|||
class Osqp < Formula
|
||||
desc "Operator splitting QP solver"
|
||||
homepage "https://osqp.org/"
|
||||
url "https://github.com/oxfordcontrol/osqp/archive/v0.5.0.tar.gz"
|
||||
sha256 "e0932d1f7bc56dbe526bee4a81331c1694d94c570f8ac6a6cb413f38904e0f64"
|
||||
url "https://github.com/oxfordcontrol/osqp/archive/v0.6.0.tar.gz"
|
||||
sha256 "6e00d11d1f88c1e32a4419324b7539b89e8f9cbb1c50afe69f375347c989ba2b"
|
||||
|
||||
bottle do
|
||||
cellar :any
|
||||
|
@ -49,25 +49,27 @@ class Osqp < Formula
|
|||
add_executable(osqp_demo_static osqp_demo.c)
|
||||
target_link_libraries(osqp_demo_static PRIVATE osqp::osqpstatic)
|
||||
EOS
|
||||
# from https://github.com/oxfordcontrol/osqp/blob/master/tests/demo/test_demo.h
|
||||
(testpath/"osqp_demo.c").write <<~EOS
|
||||
#include <assert.h>
|
||||
#include <osqp.h>
|
||||
int main() {
|
||||
c_float P_x[4] = {4.0, 1.0, 1.0, 2.0};
|
||||
c_int P_nnz = 4;
|
||||
c_int P_i[4] = {0, 1, 0, 1};
|
||||
c_int P_p[3] = {0, 2, 4};
|
||||
c_float q[2] = {1.0, 1.0};
|
||||
c_float A_x[4] = {1.0, 1.0, 1.0, 1.0};
|
||||
c_int A_nnz = 4;
|
||||
c_int A_i[4] = {0, 1, 0, 2};
|
||||
c_int A_p[3] = {0, 2, 4};
|
||||
c_float l[3] = {1.0, 0.0, 0.0};
|
||||
c_float u[3] = {1.0, 0.69999999999999995559, 0.69999999999999995559};
|
||||
c_float P_x[3] = { 4.0, 1.0, 2.0, };
|
||||
c_int P_nnz = 3;
|
||||
c_int P_i[3] = { 0, 0, 1, };
|
||||
c_int P_p[3] = { 0, 1, 3, };
|
||||
c_float q[2] = { 1.0, 1.0, };
|
||||
c_float A_x[4] = { 1.0, 1.0, 1.0, 1.0, };
|
||||
c_int A_nnz = 4;
|
||||
c_int A_i[4] = { 0, 1, 0, 2, };
|
||||
c_int A_p[3] = { 0, 2, 4, };
|
||||
c_float l[3] = { 1.0, 0.0, 0.0, };
|
||||
c_float u[3] = { 1.0, 0.7, 0.7, };
|
||||
c_int n = 2;
|
||||
c_int m = 3;
|
||||
c_int exitflag;
|
||||
OSQPSettings *settings = (OSQPSettings *)c_malloc(sizeof(OSQPSettings));
|
||||
OSQPWorkspace *workspace;
|
||||
OSQPWorkspace *work;
|
||||
OSQPData *data;
|
||||
data = (OSQPData *)c_malloc(sizeof(OSQPData));
|
||||
data->n = n;
|
||||
|
@ -78,11 +80,11 @@ class Osqp < Formula
|
|||
data->l = l;
|
||||
data->u = u;
|
||||
osqp_set_default_settings(settings);
|
||||
workspace = osqp_setup(data, settings);
|
||||
assert(workspace != OSQP_NULL);
|
||||
osqp_solve(workspace);
|
||||
assert(workspace->info->status_val == OSQP_SOLVED);
|
||||
osqp_cleanup(workspace);
|
||||
exitflag = osqp_setup(&work, data, settings);
|
||||
assert(exitflag == 0);
|
||||
osqp_solve(work);
|
||||
assert(work->info->status_val == OSQP_SOLVED);
|
||||
osqp_cleanup(work);
|
||||
c_free(data->A);
|
||||
c_free(data->P);
|
||||
c_free(data);
|
||||
|
|
Loading…
Reference in a new issue