README.md in scs-0.3.2 vs README.md in scs-0.4.0
- old
+ new
@@ -16,30 +16,59 @@
If installation fails, you may need to install [dependencies](#dependencies).
## Getting Started
-Prep the problem
+Prep the problem, like [this one](https://www.cvxgrp.org/scs/examples/python/basic_qp.html)
```ruby
-data = {a: [[1], [-1]], b: [1, 0], c: [-1]}
-cone = {q: [], l: 2}
+data = {
+ p: SCS::Matrix.from_dense([[3, -1], [-1, 2]]),
+ a: SCS::Matrix.from_dense([[-1, 1], [1, 0], [0, 1]]),
+ b: [-1, 0.3, -0.5],
+ c: [-1, -1]
+}
+cone = {z: 1, l: 2}
```
And solve it
```ruby
solver = SCS::Solver.new
solver.solve(data, cone)
```
+## Data
+
+Matrices can be a sparse matrix
+
+```ruby
+a = SCS::Matrix.new(3, 2)
+a[0, 0] = 1
+a[1, 0] = 2
+# or
+SCS::Matrix.from_dense([[1, 0], [2, 0], [0, 0]])
+```
+
+Arrays can be Ruby arrays
+
+```ruby
+[1, 2, 3]
+```
+
+Or Numo arrays
+
+```ruby
+Numo::NArray.cast([1, 2, 3])
+```
+
## Settings
Default values shown
```ruby
-solver.solve(data, cone, {
+solver.solve(data, cone,
normalize: true, # heuristic data rescaling
scale: 0.1, # if normalized, rescales by this factor
adaptive_scale: true, # heuristically adapt dual scale through the solve
rho_x: 1e-6, # x equality constraint scaling
max_iters: 1e5, # maximum iterations to take
@@ -52,10 +81,10 @@
warm_start: false, # warm start
acceleration_lookback: 10, # memory for acceleration
acceleration_interval: 10, # iterations to run Anderson acceleration
write_data_filename: nil, # filename to write data if set
log_csv_filename: nil # write csv logs of various quantities
-})
+)
```
## Direct vs Indirect
SCS comes with two solvers: a direct solver which uses a cached LDL factorization and an indirect solver based on conjugate gradients. For the indirect solver, use: