-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclarabel.html
More file actions
268 lines (228 loc) · 20.2 KB
/
clarabel.html
File metadata and controls
268 lines (228 loc) · 20.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Interface to 'Clarabel', an interior point conic solver — clarabel • clarabel</title><!-- favicons --><link rel="icon" type="image/png" sizes="96x96" href="../favicon-96x96.png"><link rel="icon" type="”image/svg+xml”" href="../favicon.svg"><link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png"><link rel="icon" sizes="any" href="../favicon.ico"><link rel="manifest" href="../site.webmanifest"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.5.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Interface to 'Clarabel', an interior point conic solver — clarabel"><meta name="description" content="Clarabel solves linear programs (LPs), quadratic programs (QPs),
second-order cone programs (SOCPs) and semidefinite programs
(SDPs). It also solves problems with exponential and power cone
constraints. The specific problem solved is:
Minimize $$\frac{1}{2}x^TPx + q^Tx$$ subject to $$Ax + s =
b$$ $$s \in K$$ where \(x \in R^n\), \(s \in R^m\), \(P
= P^T\) and nonnegative-definite, \(q \in R^n\), \(A \in
R^{m\times n}\), and \(b \in R^m\). The set \(K\) is a
composition of convex cones."><meta property="og:description" content="Clarabel solves linear programs (LPs), quadratic programs (QPs),
second-order cone programs (SOCPs) and semidefinite programs
(SDPs). It also solves problems with exponential and power cone
constraints. The specific problem solved is:
Minimize $$\frac{1}{2}x^TPx + q^Tx$$ subject to $$Ax + s =
b$$ $$s \in K$$ where \(x \in R^n\), \(s \in R^m\), \(P
= P^T\) and nonnegative-definite, \(q \in R^n\), \(A \in
R^{m\times n}\), and \(b \in R^m\). The set \(K\) is a
composition of convex cones."><meta property="og:image" content="https://oxfordcontrol.github.io/clarabel-r/logo.png"></head><body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">
<a class="navbar-brand me-2" href="../index.html">clarabel</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">0.11.1</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto"><li class="nav-item"><a class="nav-link" href="../articles/clarabel.html">Get started</a></li>
<li class="active nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
<li class="nav-item"><a class="nav-link" href="../news/index.html">Changelog</a></li>
</ul><ul class="navbar-nav"><li class="nav-item"><form class="form-inline" role="search">
<input class="form-control" type="search" name="search-input" id="search-input" autocomplete="off" aria-label="Search site" placeholder="Search for" data-search-index="../search.json"></form></li>
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/oxfordcontrol/clarabel-r/" aria-label="GitHub"><span class="fa fab fa-github fa-lg"></span></a></li>
</ul></div>
</div>
</nav><div class="container template-reference-topic">
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="../logo.png" class="logo" alt=""><h1>Interface to 'Clarabel', an interior point conic solver</h1>
<small class="dont-index">Source: <a href="https://github.com/oxfordcontrol/clarabel-r/blob/HEAD/R/clarabel.R" class="external-link"><code>R/clarabel.R</code></a></small>
<div class="d-none name"><code>clarabel.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Clarabel solves linear programs (LPs), quadratic programs (QPs),
second-order cone programs (SOCPs) and semidefinite programs
(SDPs). It also solves problems with exponential and power cone
constraints. The specific problem solved is:</p>
<p>Minimize $$\frac{1}{2}x^TPx + q^Tx$$ subject to $$Ax + s =
b$$ $$s \in K$$ where \(x \in R^n\), \(s \in R^m\), \(P
= P^T\) and nonnegative-definite, \(q \in R^n\), \(A \in
R^{m\times n}\), and \(b \in R^m\). The set \(K\) is a
composition of convex cones.</p>
</div>
<div class="section level2">
<h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">clarabel</span><span class="op">(</span><span class="va">A</span>, <span class="va">b</span>, <span class="va">q</span>, P <span class="op">=</span> <span class="cn">NULL</span>, <span class="va">cones</span>, control <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span><span class="op">)</span>, strict_cone_order <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level2">
<h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>
<dl><dt id="arg-a">A<a class="anchor" aria-label="anchor" href="#arg-a"></a></dt>
<dd><p>a matrix of constraint coefficients.</p></dd>
<dt id="arg-b">b<a class="anchor" aria-label="anchor" href="#arg-b"></a></dt>
<dd><p>a numeric vector giving the primal constraints</p></dd>
<dt id="arg-q">q<a class="anchor" aria-label="anchor" href="#arg-q"></a></dt>
<dd><p>a numeric vector giving the primal objective</p></dd>
<dt id="arg-p">P<a class="anchor" aria-label="anchor" href="#arg-p"></a></dt>
<dd><p>a symmetric positive semidefinite matrix, default
<code>NULL</code></p></dd>
<dt id="arg-cones">cones<a class="anchor" aria-label="anchor" href="#arg-cones"></a></dt>
<dd><p>a named list giving the cone sizes, see “Cone
Parameters” below for specification</p></dd>
<dt id="arg-control">control<a class="anchor" aria-label="anchor" href="#arg-control"></a></dt>
<dd><p>a list giving specific control parameters to use in
place of default values, with an empty list indicating the
default control parameters. Specified parameters should be
correctly named and typed to avoid Rust system panics as no
sanitization is done for efficiency reasons</p></dd>
<dt id="arg-strict-cone-order">strict_cone_order<a class="anchor" aria-label="anchor" href="#arg-strict-cone-order"></a></dt>
<dd><p>a logical flag, default <code>TRUE</code> for forcing
order of cones described below. If <code>FALSE</code> cones can be specified
in any order and even repeated and directly passed to the solver
without type and length checks</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>named list of solution vectors x, y, s and information
about run</p>
</div>
<div class="section level2">
<h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
<p>The order of the rows in matrix \(A\) has to correspond to the
order given in the table “Cone Parameters”, which means
means rows corresponding to <em>primal zero cones</em> should be
first, rows corresponding to <em>non-negative cones</em> second,
rows corresponding to <em>second-order cone</em> third, rows
corresponding to <em>positive semidefinite cones</em> fourth, rows
corresponding to <em>exponential cones</em> fifth and rows
corresponding to <em>power cones</em> at last.</p>
<p>When the parameter <code>strict_cone_order</code> is <code>FALSE</code>, one can specify
the cones in any order and even repeat them in the order they
appear in the <code>A</code> matrix. See below.</p>
<div class="section">
<h3 id="clarabel-can-solve">Clarabel can solve<a class="anchor" aria-label="anchor" href="#clarabel-can-solve"></a></h3>
<p></p><ol><li><p>linear programs
(LPs)</p></li>
<li><p>second-order cone programs (SOCPs)</p></li>
<li><p>exponential
cone programs (ECPs)</p></li>
<li><p>power cone programs (PCPs)</p></li>
<li><p>problems with any combination of cones, defined by the parameters
listed in “Cone Parameters” below</p></li>
</ol><p></p>
</div>
<div class="section">
<h3 id="cone-parameters">Cone Parameters<a class="anchor" aria-label="anchor" href="#cone-parameters"></a></h3>
<p>The table below shows the cone parameter specifications. Mathematical definitions are in the vignette.</p><table class="table table"><tr><td></td><td><b>Parameter</b></td><td><b>Type</b></td><td><b>Length</b></td><td><b>Description</b></td></tr><tr><td></td><td><code>z</code></td><td>integer</td><td>\(1\)</td><td>number of primal zero cones (dual free cones),</td></tr><tr><td></td><td></td><td></td><td></td><td>which corresponds to the primal equality constraints</td></tr><tr><td></td><td><code>l</code></td><td>integer</td><td>\(1\)</td><td>number of linear cones (non-negative cones)</td></tr><tr><td></td><td><code>q</code></td><td>integer</td><td>\(\ge 1\)</td><td>vector of second-order cone sizes</td></tr><tr><td></td><td><code>s</code></td><td>integer</td><td>\(\ge 1\)</td><td>vector of positive semidefinite cone sizes</td></tr><tr><td></td><td><code>ep</code></td><td>integer</td><td>\(1\)</td><td>number of primal exponential cones</td></tr><tr><td></td><td><code>p</code></td><td>numeric</td><td>\(\ge 1\)</td><td>vector of primal power cone parameters</td></tr><tr><td></td><td><code>gp</code></td><td>list</td><td>\(\ge 1\)</td><td>list of named lists of two items, <code>a</code> : a numeric vector of at least 2 exponent terms in the product summing to 1, and <code>n</code> : an integer dimension of generalized power cone parameters</td></tr></table><p></p>
</div>
<p>When the parameter <code>strict_cone_order</code> is <code>FALSE</code>, one can specify
the cones in the order they appear in the <code>A</code> matrix. The <code>cones</code>
argument in such a case should be a named list with names matching
<code>^z*</code> indicating primal zero cones, <code>^l*</code> indicating linear cones,
and so on. For example, either of the following would be valid: <code>list(z = 2L, l = 2L, q = 2L, z = 3L, q = 3L)</code>, or, <code>list(z1 = 2L, l1 = 2L, q1 = 2L, zb = 3L, qx = 3L)</code>, indicating a zero
cone of size 2, followed by a linear cone of size 2, followed by a second-order
cone of size 2, followed by a zero cone of size 3, and finally a second-order
cone of size 3. Generalized power cones parameters have to specified as named lists, e.g., <code>list(z = 2L, gp1 = list(a = c(0.3, 0.7), n = 3L), gp2 = list(a = c(0.5, 0.5), n = 1L))</code>.</p>
<p><em>Note that when <code>strict_cone_order = FALSE</code>, types of cone parameters such as integers, reals have to be explicit since the parameters are directly passed to the Rust interface with no sanity checks!</em></p>
</div>
<div class="section level2">
<h2 id="see-also">See also<a class="anchor" aria-label="anchor" href="#see-also"></a></h2>
<div class="dont-index"><p><code><a href="clarabel_control.html">clarabel_control()</a></code></p></div>
</div>
<div class="section level2">
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">A</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/matrix.html" class="external-link">matrix</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1</span>, <span class="fl">1</span><span class="op">)</span>, ncol <span class="op">=</span> <span class="fl">1</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">b</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1</span>, <span class="fl">1</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">obj</span> <span class="op"><-</span> <span class="fl">1</span></span></span>
<span class="r-in"><span><span class="va">cone</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>z <span class="op">=</span> <span class="fl">2L</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">control</span> <span class="op"><-</span> <span class="fu"><a href="clarabel_control.html">clarabel_control</a></span><span class="op">(</span>tol_gap_rel <span class="op">=</span> <span class="fl">1e-7</span>, tol_gap_abs <span class="op">=</span> <span class="fl">1e-7</span>, max_iter <span class="op">=</span> <span class="fl">100</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu">clarabel</span><span class="op">(</span>A <span class="op">=</span> <span class="va">A</span>, b <span class="op">=</span> <span class="va">b</span>, q <span class="op">=</span> <span class="va">obj</span>, cones <span class="op">=</span> <span class="va">cone</span>, control <span class="op">=</span> <span class="va">control</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#></span> $x</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 1</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $z</span>
<span class="r-out co"><span class="r-pr">#></span> [1] -0.5 -0.5</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $s</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0 0</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $obj_val</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 1</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $obj_val_dual</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 1</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $status</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 2</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $solve_time</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0.000222623</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $iterations</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $r_prim</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $r_dual</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info</span>
<span class="r-out co"><span class="r-pr">#></span> $info$μ</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 1</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$sigma</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 1</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$step_length</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$cost_primal</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 1</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$cost_dual</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 1</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$res_primal</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$res_dual</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$res_primal_inf</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 1</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$res_dual_inf</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 1.414214</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$gap_abs</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$gap_rel</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$ktratio</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 1</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$solve_time</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0.000222623</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$iterations</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 0</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> $info$status</span>
<span class="r-out co"><span class="r-pr">#></span> [1] 2</span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-out co"><span class="r-pr">#></span> </span>
<span class="r-in"><span></span></span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
</nav></aside></div>
<footer><div class="pkgdown-footer-left">
<p>Developed by <a href="https://naras.su.domains/" class="external-link">Balasubramanian Narasimhan</a>, <a href="https://users.ox.ac.uk/~engs1373/" class="external-link">Paul Goulart</a>, <a href="https://yuwenchen95.github.io/" class="external-link">Yuwen Chen</a>.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.3.</p>
</div>
</footer></div>
</body></html>