socp | R Documentation |
Solve Second-order Cone Problem by primal-dual interior point method.
socp(f, A, b, C, d, N, x, z, w, control = list())
f |
Vector defining linear objective,
|
A |
Matrix with the |
b |
Vector with the |
C |
Matrix with the |
d |
Vector with the |
N |
vector of size |
x |
Primal feasible initial point. Must satisfy: norm(A(i)*x+b(i)) < c(i)'*x+d(i) , i=1,...,L |
z |
dual feasible initial point. |
w |
dual feasible initial point. |
control |
A list of control parameters. See below for details. |
minimize
f'*x
subject to
norm(A_i*x+b_i) <=c_i'*x+d_i , i=1,…, L
The dual problem is:
maximize
-(b'*z+d*w)
subject to
A'*z+C'*w == f
norm(z_i) <= w_i , i=1,…,L
(see description of input arguments for definition of A, b, C, d, z, w)
STOPPING CRITERIA: (stop when any of the following is met)
abs.tol
– maximum absolute error in objective function;
guarantees that for any x: abs(f'*x - f'*x_opt) <= abs_tol
rel.tol
– maximum relative error in objective function;
guarantees that for any x:
abs(f'*x - f'*x_opt)/(f'*x_opt) <= rel_tol (if f'*x_opt > 0)
Negative value has special meaning, see target
target
– if rel_tol<0, stops when
f'*x<target or -b'*z>=target
max.iter
– limit on number of algorithm outer iterations.
Most problems can be solved in less than 50 iterations.
Called with max_iter=0
only checks feasibility of x
and
z
, (and returns gap and deviation from centrality).
OTHER PARAMETERS:
Nu
– duality gap vs. deviation from centrality reduction weight.
As a general rule, larger values of Nu yield faster convergence,
up to a point where the deviation from centrality becomes too
large and the convergence becomes very slow.
Required Nu>0, recommended Nu>1, typical range
2<=Nu<=50. Try Nu=10.
out.mode
– specifies what will be output in hist:
0 | hist is returned empty (default value) |
1 | vector with duality gap (an upper bound on absolute |
error), for the initial point and after each iteration | |
2 | matrix with duality gap and deviation from centrality |
x |
Solution. |
z |
solution to the dual problem |
iter |
Number of iterations performed |
hist |
see |
convergence |
A logical code. |
info |
A numerical code. It indicates if the convergence was successful. |
message |
A character string giving any additional information returned by the optimizer. |
R port by Yohan Chalabi and Diethelm Wuertz,
C Code for SOCP written by M. Lobo, L. Vandenberghe, and S. Boyd.
SOCP, Software for Second-order Cone Programming User's Guide, Beta Version April 1997, Miguel Sousa Lobo, Lieven Vandenberghe, Stephen Boyd.
https://web.stanford.edu/~boyd/old_software/SOCP.html
socpControl
## socp # min x + y # s.t. x^2 + y^2 <= 1 # y >= 0 f <- c(1, 1) A <- matrix(c(1, 0, 0, 0, 1, 0), ncol = 2) b <- c(0, 0, 0) C <- matrix(c(0, 0, 0, 1), ncol = 2) d <- c(1,0) N <- c(2, 1) x <- c(0, 0.5) z <- c(1, 0, 0) w <- c(2, 1) fit1 <- socp(f, A, b, C, d, N, x, z, w) fit1 fit2 <- socp(f, A, b, C, d, N, x) fit2 fit3 <- socp(f, A, b, C, d, N) fit3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.