scs 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +3 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +84 -0
  5. data/ext/scs/Rakefile +11 -0
  6. data/lib/scs/ffi.rb +117 -0
  7. data/lib/scs/solver.rb +178 -0
  8. data/lib/scs/version.rb +3 -0
  9. data/lib/scs.rb +17 -0
  10. data/vendor/scs/LICENSE.txt +21 -0
  11. data/vendor/scs/Makefile +164 -0
  12. data/vendor/scs/README.md +220 -0
  13. data/vendor/scs/include/aa.h +56 -0
  14. data/vendor/scs/include/cones.h +46 -0
  15. data/vendor/scs/include/ctrlc.h +33 -0
  16. data/vendor/scs/include/glbopts.h +177 -0
  17. data/vendor/scs/include/linalg.h +26 -0
  18. data/vendor/scs/include/linsys.h +64 -0
  19. data/vendor/scs/include/normalize.h +18 -0
  20. data/vendor/scs/include/rw.h +17 -0
  21. data/vendor/scs/include/scs.h +161 -0
  22. data/vendor/scs/include/scs_blas.h +51 -0
  23. data/vendor/scs/include/util.h +65 -0
  24. data/vendor/scs/linsys/amatrix.c +305 -0
  25. data/vendor/scs/linsys/amatrix.h +36 -0
  26. data/vendor/scs/linsys/amatrix.o +0 -0
  27. data/vendor/scs/linsys/cpu/direct/private.c +366 -0
  28. data/vendor/scs/linsys/cpu/direct/private.h +26 -0
  29. data/vendor/scs/linsys/cpu/direct/private.o +0 -0
  30. data/vendor/scs/linsys/cpu/indirect/private.c +256 -0
  31. data/vendor/scs/linsys/cpu/indirect/private.h +31 -0
  32. data/vendor/scs/linsys/cpu/indirect/private.o +0 -0
  33. data/vendor/scs/linsys/external/amd/LICENSE.txt +934 -0
  34. data/vendor/scs/linsys/external/amd/SuiteSparse_config.c +469 -0
  35. data/vendor/scs/linsys/external/amd/SuiteSparse_config.h +254 -0
  36. data/vendor/scs/linsys/external/amd/SuiteSparse_config.o +0 -0
  37. data/vendor/scs/linsys/external/amd/amd.h +400 -0
  38. data/vendor/scs/linsys/external/amd/amd_1.c +180 -0
  39. data/vendor/scs/linsys/external/amd/amd_1.o +0 -0
  40. data/vendor/scs/linsys/external/amd/amd_2.c +1842 -0
  41. data/vendor/scs/linsys/external/amd/amd_2.o +0 -0
  42. data/vendor/scs/linsys/external/amd/amd_aat.c +184 -0
  43. data/vendor/scs/linsys/external/amd/amd_aat.o +0 -0
  44. data/vendor/scs/linsys/external/amd/amd_control.c +64 -0
  45. data/vendor/scs/linsys/external/amd/amd_control.o +0 -0
  46. data/vendor/scs/linsys/external/amd/amd_defaults.c +37 -0
  47. data/vendor/scs/linsys/external/amd/amd_defaults.o +0 -0
  48. data/vendor/scs/linsys/external/amd/amd_dump.c +179 -0
  49. data/vendor/scs/linsys/external/amd/amd_dump.o +0 -0
  50. data/vendor/scs/linsys/external/amd/amd_global.c +16 -0
  51. data/vendor/scs/linsys/external/amd/amd_global.o +0 -0
  52. data/vendor/scs/linsys/external/amd/amd_info.c +119 -0
  53. data/vendor/scs/linsys/external/amd/amd_info.o +0 -0
  54. data/vendor/scs/linsys/external/amd/amd_internal.h +304 -0
  55. data/vendor/scs/linsys/external/amd/amd_order.c +199 -0
  56. data/vendor/scs/linsys/external/amd/amd_order.o +0 -0
  57. data/vendor/scs/linsys/external/amd/amd_post_tree.c +120 -0
  58. data/vendor/scs/linsys/external/amd/amd_post_tree.o +0 -0
  59. data/vendor/scs/linsys/external/amd/amd_postorder.c +206 -0
  60. data/vendor/scs/linsys/external/amd/amd_postorder.o +0 -0
  61. data/vendor/scs/linsys/external/amd/amd_preprocess.c +118 -0
  62. data/vendor/scs/linsys/external/amd/amd_preprocess.o +0 -0
  63. data/vendor/scs/linsys/external/amd/amd_valid.c +92 -0
  64. data/vendor/scs/linsys/external/amd/amd_valid.o +0 -0
  65. data/vendor/scs/linsys/external/amd/changes +11 -0
  66. data/vendor/scs/linsys/external/qdldl/LICENSE +201 -0
  67. data/vendor/scs/linsys/external/qdldl/README.md +120 -0
  68. data/vendor/scs/linsys/external/qdldl/changes +4 -0
  69. data/vendor/scs/linsys/external/qdldl/qdldl.c +298 -0
  70. data/vendor/scs/linsys/external/qdldl/qdldl.h +177 -0
  71. data/vendor/scs/linsys/external/qdldl/qdldl.o +0 -0
  72. data/vendor/scs/linsys/external/qdldl/qdldl_types.h +21 -0
  73. data/vendor/scs/linsys/gpu/gpu.c +41 -0
  74. data/vendor/scs/linsys/gpu/gpu.h +85 -0
  75. data/vendor/scs/linsys/gpu/indirect/private.c +304 -0
  76. data/vendor/scs/linsys/gpu/indirect/private.h +36 -0
  77. data/vendor/scs/scs.mk +181 -0
  78. data/vendor/scs/src/aa.c +224 -0
  79. data/vendor/scs/src/aa.o +0 -0
  80. data/vendor/scs/src/cones.c +802 -0
  81. data/vendor/scs/src/cones.o +0 -0
  82. data/vendor/scs/src/ctrlc.c +77 -0
  83. data/vendor/scs/src/ctrlc.o +0 -0
  84. data/vendor/scs/src/linalg.c +84 -0
  85. data/vendor/scs/src/linalg.o +0 -0
  86. data/vendor/scs/src/normalize.c +93 -0
  87. data/vendor/scs/src/normalize.o +0 -0
  88. data/vendor/scs/src/rw.c +167 -0
  89. data/vendor/scs/src/rw.o +0 -0
  90. data/vendor/scs/src/scs.c +975 -0
  91. data/vendor/scs/src/scs.o +0 -0
  92. data/vendor/scs/src/scs_version.c +5 -0
  93. data/vendor/scs/src/scs_version.o +0 -0
  94. data/vendor/scs/src/util.c +196 -0
  95. data/vendor/scs/src/util.o +0 -0
  96. data/vendor/scs/test/data/small_random_socp +0 -0
  97. data/vendor/scs/test/minunit.h +13 -0
  98. data/vendor/scs/test/problem_utils.h +93 -0
  99. data/vendor/scs/test/problems/rob_gauss_cov_est.h +85 -0
  100. data/vendor/scs/test/problems/small_lp.h +50 -0
  101. data/vendor/scs/test/problems/small_random_socp.h +33 -0
  102. data/vendor/scs/test/random_socp_prob.c +171 -0
  103. data/vendor/scs/test/run_from_file.c +69 -0
  104. data/vendor/scs/test/run_tests +2 -0
  105. data/vendor/scs/test/run_tests.c +32 -0
  106. metadata +203 -0
@@ -0,0 +1,69 @@
1
+ #include "rw.h"
2
+ #include "scs.h"
3
+ #include "util.h"
4
+
5
+ scs_int override_setting(ScsSettings *s, char *param, char *val) {
6
+ scs_printf("Attempting to override %s with value %s.\n", param, val);
7
+ if (strcmp(param, "normalize") == 0) {
8
+ s->normalize = atoi(val);
9
+ } else if (strcmp(param, "scale") == 0) {
10
+ s->scale = atof(val);
11
+ } else if (strcmp(param, "rho_x") == 0) {
12
+ s->rho_x = atof(val);
13
+ } else if (strcmp(param, "max_iters") == 0) {
14
+ s->max_iters = atoi(val);
15
+ } else if (strcmp(param, "eps") == 0) {
16
+ s->eps = atof(val);
17
+ } else if (strcmp(param, "alpha") == 0) {
18
+ s->alpha = atof(val);
19
+ } else if (strcmp(param, "cg_rate") == 0) {
20
+ s->cg_rate = atof(val);
21
+ } else if (strcmp(param, "verbose") == 0) {
22
+ s->verbose = atoi(val);
23
+ } else if (strcmp(param, "acceleration_lookback") == 0) {
24
+ s->acceleration_lookback = atoi(val);
25
+ } else {
26
+ return -1;
27
+ }
28
+ scs_printf("Success.\n");
29
+ return 0;
30
+ }
31
+
32
+ /* Simple helper function to run problems from data files */
33
+ /* Mostly useful for debugging */
34
+ int main(int argc, char **argv) {
35
+ char *filename;
36
+ scs_int read_status;
37
+ ScsData *d;
38
+ ScsCone *k;
39
+ ScsSolution *sol;
40
+ ScsInfo info = {0};
41
+ scs_int i;
42
+ if (argc < 2) {
43
+ scs_printf("Need to specify a filename, exit.\n");
44
+ return -1;
45
+ }
46
+ filename = argv[1];
47
+ read_status = SCS(read_data)(filename, &d, &k);
48
+ if (read_status < 0) {
49
+ scs_printf("Data read failure, exit.\n");
50
+ return -1;
51
+ }
52
+ for (i = 2; i < argc; i += 2) {
53
+ if (argc < i + 2) {
54
+ scs_printf("Incorrect number of arguments supplied\n.");
55
+ SCS(free_data)(d, k);
56
+ return -1;
57
+ }
58
+ if (override_setting(d->stgs, argv[i], argv[i + 1]) < 0) {
59
+ scs_printf("Unrecognized setting %s\n", argv[i]);
60
+ SCS(free_data)(d, k);
61
+ return -1;
62
+ }
63
+ }
64
+ sol = scs_calloc(1, sizeof(ScsSolution));
65
+ scs(d, k, sol, &info);
66
+ SCS(free_data)(d, k);
67
+ SCS(free_sol)(sol);
68
+ return 0;
69
+ }
@@ -0,0 +1,2 @@
1
+ out/run_tests_indirect
2
+ out/run_tests_direct
@@ -0,0 +1,32 @@
1
+ /* Taken from http://www.jera.com/techinfo/jtns/jtn002.html */
2
+ #include <stdio.h>
3
+
4
+ #include "minunit.h"
5
+ #include "problem_utils.h"
6
+ #include "scs.h"
7
+
8
+ /* Include Tests */
9
+ #include "problems/small_lp.h"
10
+ #include "problems/rob_gauss_cov_est.h"
11
+ #include "problems/small_random_socp.h"
12
+
13
+ int tests_run = 0;
14
+
15
+ static const char *all_tests(void) {
16
+ mu_run_test(small_lp);
17
+ mu_run_test(rob_gauss_cov_est);
18
+ mu_run_test(small_random_socp);
19
+ return 0;
20
+ }
21
+
22
+ int main(void) {
23
+ const char *result = all_tests();
24
+ if (result != 0) {
25
+ scs_printf("%s\n", result);
26
+ } else {
27
+ scs_printf("ALL TESTS PASSED\n");
28
+ }
29
+ scs_printf("Tests run: %d\n", tests_run);
30
+
31
+ return result != 0;
32
+ }
metadata ADDED
@@ -0,0 +1,203 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Kane
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-11-17 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
+ - ext/scs/Rakefile
74
+ extra_rdoc_files: []
75
+ files:
76
+ - CHANGELOG.md
77
+ - LICENSE.txt
78
+ - README.md
79
+ - ext/scs/Rakefile
80
+ - lib/scs.rb
81
+ - lib/scs/ffi.rb
82
+ - lib/scs/solver.rb
83
+ - lib/scs/version.rb
84
+ - vendor/scs/LICENSE.txt
85
+ - vendor/scs/Makefile
86
+ - vendor/scs/README.md
87
+ - vendor/scs/include/aa.h
88
+ - vendor/scs/include/cones.h
89
+ - vendor/scs/include/ctrlc.h
90
+ - vendor/scs/include/glbopts.h
91
+ - vendor/scs/include/linalg.h
92
+ - vendor/scs/include/linsys.h
93
+ - vendor/scs/include/normalize.h
94
+ - vendor/scs/include/rw.h
95
+ - vendor/scs/include/scs.h
96
+ - vendor/scs/include/scs_blas.h
97
+ - vendor/scs/include/util.h
98
+ - vendor/scs/linsys/amatrix.c
99
+ - vendor/scs/linsys/amatrix.h
100
+ - vendor/scs/linsys/amatrix.o
101
+ - vendor/scs/linsys/cpu/direct/private.c
102
+ - vendor/scs/linsys/cpu/direct/private.h
103
+ - vendor/scs/linsys/cpu/direct/private.o
104
+ - vendor/scs/linsys/cpu/indirect/private.c
105
+ - vendor/scs/linsys/cpu/indirect/private.h
106
+ - vendor/scs/linsys/cpu/indirect/private.o
107
+ - vendor/scs/linsys/external/amd/LICENSE.txt
108
+ - vendor/scs/linsys/external/amd/SuiteSparse_config.c
109
+ - vendor/scs/linsys/external/amd/SuiteSparse_config.h
110
+ - vendor/scs/linsys/external/amd/SuiteSparse_config.o
111
+ - vendor/scs/linsys/external/amd/amd.h
112
+ - vendor/scs/linsys/external/amd/amd_1.c
113
+ - vendor/scs/linsys/external/amd/amd_1.o
114
+ - vendor/scs/linsys/external/amd/amd_2.c
115
+ - vendor/scs/linsys/external/amd/amd_2.o
116
+ - vendor/scs/linsys/external/amd/amd_aat.c
117
+ - vendor/scs/linsys/external/amd/amd_aat.o
118
+ - vendor/scs/linsys/external/amd/amd_control.c
119
+ - vendor/scs/linsys/external/amd/amd_control.o
120
+ - vendor/scs/linsys/external/amd/amd_defaults.c
121
+ - vendor/scs/linsys/external/amd/amd_defaults.o
122
+ - vendor/scs/linsys/external/amd/amd_dump.c
123
+ - vendor/scs/linsys/external/amd/amd_dump.o
124
+ - vendor/scs/linsys/external/amd/amd_global.c
125
+ - vendor/scs/linsys/external/amd/amd_global.o
126
+ - vendor/scs/linsys/external/amd/amd_info.c
127
+ - vendor/scs/linsys/external/amd/amd_info.o
128
+ - vendor/scs/linsys/external/amd/amd_internal.h
129
+ - vendor/scs/linsys/external/amd/amd_order.c
130
+ - vendor/scs/linsys/external/amd/amd_order.o
131
+ - vendor/scs/linsys/external/amd/amd_post_tree.c
132
+ - vendor/scs/linsys/external/amd/amd_post_tree.o
133
+ - vendor/scs/linsys/external/amd/amd_postorder.c
134
+ - vendor/scs/linsys/external/amd/amd_postorder.o
135
+ - vendor/scs/linsys/external/amd/amd_preprocess.c
136
+ - vendor/scs/linsys/external/amd/amd_preprocess.o
137
+ - vendor/scs/linsys/external/amd/amd_valid.c
138
+ - vendor/scs/linsys/external/amd/amd_valid.o
139
+ - vendor/scs/linsys/external/amd/changes
140
+ - vendor/scs/linsys/external/qdldl/LICENSE
141
+ - vendor/scs/linsys/external/qdldl/README.md
142
+ - vendor/scs/linsys/external/qdldl/changes
143
+ - vendor/scs/linsys/external/qdldl/qdldl.c
144
+ - vendor/scs/linsys/external/qdldl/qdldl.h
145
+ - vendor/scs/linsys/external/qdldl/qdldl.o
146
+ - vendor/scs/linsys/external/qdldl/qdldl_types.h
147
+ - vendor/scs/linsys/gpu/gpu.c
148
+ - vendor/scs/linsys/gpu/gpu.h
149
+ - vendor/scs/linsys/gpu/indirect/private.c
150
+ - vendor/scs/linsys/gpu/indirect/private.h
151
+ - vendor/scs/scs.mk
152
+ - vendor/scs/src/aa.c
153
+ - vendor/scs/src/aa.o
154
+ - vendor/scs/src/cones.c
155
+ - vendor/scs/src/cones.o
156
+ - vendor/scs/src/ctrlc.c
157
+ - vendor/scs/src/ctrlc.o
158
+ - vendor/scs/src/linalg.c
159
+ - vendor/scs/src/linalg.o
160
+ - vendor/scs/src/normalize.c
161
+ - vendor/scs/src/normalize.o
162
+ - vendor/scs/src/rw.c
163
+ - vendor/scs/src/rw.o
164
+ - vendor/scs/src/scs.c
165
+ - vendor/scs/src/scs.o
166
+ - vendor/scs/src/scs_version.c
167
+ - vendor/scs/src/scs_version.o
168
+ - vendor/scs/src/util.c
169
+ - vendor/scs/src/util.o
170
+ - vendor/scs/test/data/small_random_socp
171
+ - vendor/scs/test/minunit.h
172
+ - vendor/scs/test/problem_utils.h
173
+ - vendor/scs/test/problems/rob_gauss_cov_est.h
174
+ - vendor/scs/test/problems/small_lp.h
175
+ - vendor/scs/test/problems/small_random_socp.h
176
+ - vendor/scs/test/random_socp_prob.c
177
+ - vendor/scs/test/run_from_file.c
178
+ - vendor/scs/test/run_tests
179
+ - vendor/scs/test/run_tests.c
180
+ homepage: https://github.com/ankane/scs
181
+ licenses:
182
+ - MIT
183
+ metadata: {}
184
+ post_install_message:
185
+ rdoc_options: []
186
+ require_paths:
187
+ - lib
188
+ required_ruby_version: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '2.4'
193
+ required_rubygems_version: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ requirements: []
199
+ rubygems_version: 3.0.6
200
+ signing_key:
201
+ specification_version: 4
202
+ summary: SCS - the splitting conic solver - for Ruby
203
+ test_files: []