Skip to content

Commit

Permalink
Changed computation of centering parameter
Browse files Browse the repository at this point in the history
Introduced max and min for centering parameter

Introduced max and min for step size (all now defined in ecos.h)
  • Loading branch information
adomahidi committed Jun 5, 2013
1 parent a1ef4b5 commit a680162
Show file tree
Hide file tree
Showing 9 changed files with 828 additions and 51 deletions.
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

25 changes: 15 additions & 10 deletions include/ecos.h
Expand Up @@ -33,18 +33,23 @@

/* DEFAULT SOLVER PARAMETERS AND SETTINGS STRUCT ----------------------- */
#define MAXIT (30) /* maximum number of iterations */
#define GAMMA (0.98) /* scaling the final step length */
#define DELTA (5E-7) /* regularization parameter */
#define EPS (1E-14) /* regularization threshold (do not 0!) */
#define NITREF (3) /* number of iterative refinement steps */
#define LINSYSACC (1E-14) /* rel. accuracy of search direction */
#define FEASTOL (5E-6) /* primal/dual infeasibility tolerance */
#define ABSTOL (5E-7) /* absolute tolerance on duality gap */
#define RELTOL (5E-7) /* relative tolerance on duality gap */
#define FEASTOL (2E-5) /* primal/dual infeasibility tolerance */
#define ABSTOL (1E-6) /* absolute tolerance on duality gap */
#define RELTOL (1E-6) /* relative tolerance on duality gap */

#define GAMMA (0.99) /* scaling the final step length */
#define STATICREG (1) /* static regularization: 0:off, 1:on */
#define DELTASTAT (1E-9) /* regularization parameter */
#define DELTASTAT (5E-9) /* regularization parameter */
#define DELTA (5E-7) /* dyn. regularization parameter */
#define EPS (1E-14) /* dyn. regularization threshold (do not 0!) */
#define NITREF (2) /* number of iterative refinement steps */
#define LINSYSACC (1E-14) /* rel. accuracy of search direction */
#define SIGMAMIN (0.01) /* always do some centering */
#define SIGMAMAX (0.99) /* never fully center */
#define STEPMIN (1E-6) /* smallest step that we want to make */
#define STEPMAX (1.0) /* biggest step allowed */

typedef struct settings{
typedef struct settings{
pfloat gamma; /* scaling the final step length */
pfloat delta; /* regularization parameter */
pfloat eps; /* regularization threshold */
Expand Down
9 changes: 8 additions & 1 deletion matlab/conelp.m
Expand Up @@ -272,10 +272,13 @@

% build & factor KKT matrix
K = conelp_KKTmatrix(A, Gtilde, Vreg, EPS);



% fprintf('cond(K) = %4.2e\n', condest(K));

[L,D,PL,QL,P] = conelp_factor(K,P,LINSOLVER,n,p,dims,scaling);
[L,D,PL,QL,P] = conelp_factor(K,P,LINSOLVER,n,p,dims,scaling, c,b,h,kap,tau);

assert( all( ~isnan(L(:)) ), 'Factorization returned NaN');
assert( all( ~isnan(D(:)) ), 'Factorization returned NaN');

Expand Down Expand Up @@ -346,13 +349,17 @@
ds = conelp_timesW(scaling, ds_by_W, dims,LINSOLVER);
dkap = -(bkap + kap*dtau)/tau;

temp = conelp_kringel(s,dz,dims) + conelp_kringel(ds,z,dims) + conelp_kringel(s,z,dims)+ conelp_kringel(dsaff,dzaff,dims) - sigma*mu;
fprintf('||s o dz + ds o z + s o z + dsa o dza - sigma*mu*e = %e||\n',temp);

%% 5. Line search for combined search direction.
W_times_dz = conelp_timesW(scaling,dz,dims,LINSOLVER); % = W*dz
alpha = conelp_stepsize(lambda,ds_by_W,W_times_dz,dims,tau,dtau,kap,dkap)*GAMMA;
% fprintf('Combined step length: %10.8f\n',alpha);
% alpha = conelp_linesearch(s,z,tau,kap,ds,dz,dtau,dkap,dims,lambda)*GAMMA;

%% 6. Update variables and scaling.
fprintf('ds''*dz + dkap*dtau = %e\n', ds'*dz + dkap*dtau);
x = x + alpha*dx; y = y + alpha*dy; s = s + alpha*ds; z = z + alpha*dz;
kap = kap + alpha*dkap; tau = tau + alpha*dtau;
assert( tau > 0, 'tau <= 0, exiting.');
Expand Down
4 changes: 3 additions & 1 deletion matlab/conelp_factor.m
@@ -1,4 +1,4 @@
function [L,D,PL,QL,P] = conelp_factor(K,P,LINSOLVER,n,p,dims,scaling)
function [L,D,PL,QL,P] = conelp_factor(K,P,LINSOLVER,n,p,dims,scaling, c,b,h,kap,tau)
% LDL Factorization routine for CONELP solver.
%
% (c) Alexander Domahidi, IfA, ETH Zurich, 2012.
Expand All @@ -25,6 +25,8 @@
[L,D] = sldlsparse(sparse(K), P, S, 1e-14, 7e-7);
L = L + eye(size(L));

keyboard

otherwise, error('Unknown linear solver');
end

Expand Down
2 changes: 1 addition & 1 deletion matlab/conelp_scaling.m
Expand Up @@ -76,7 +76,7 @@
otherwise, error('Unknown linear solver');
end

Vpattern = blkdiag(Vpattern,Vk_pattern);
Vpattern = blkdiag(Vpattern,sparse(Vk_pattern));
end

varargout{1} = Vpattern;
Expand Down
27 changes: 18 additions & 9 deletions matlab/run_dimacs_test.m
Expand Up @@ -25,7 +25,7 @@
);


for i = 1:length(tests),
for i = 1:1%length(tests),
clear A At b c K
test_name = tests(i).name;
test_name = test_name(1:end-4); % strip .mat
Expand All @@ -41,16 +41,25 @@
if m2 == 1,
c = c';
end
if (exist('A','var'))
data = struct('A', sparse(A'), 'b', full(c), 'c', -full(b));
else
data = struct('A', sparse(At), 'b', full(c), 'c', -full(b));
end
cone = struct('f', 0, 'q', K.q', 'l', K.l);
% if (exist('A','var'))
% data = struct('A', sparse(A'), 'b', full(c), 'c', -full(b));
% else
% data = struct('A', sparse(At), 'b', full(c), 'c', -full(b));
% end
% cone = struct('f', 0, 'q', K.q', 'l', K.l);

[x_m, y_m, info] = ecos(data.c, data.A, data.b, cone);
% convert to ECOS format
G = -speye(length(c)); h = zeros(length(c),1);
if( ~exist('A','var') )
A = At';
end
% [x_m, y_m, info] = ecos(data.c, G,h,cone,data.A, data.b);
% [x_m, y_m, info,s,z] = conelp(full(c), G, h, K, A, full(b));
[x_m, y_m, info,s,z] = ecos(full(c), G, h, K, A, full(b));

err.(test_name) = abs( data.c'*x_m + objval.(test_name) ) ;
err.(test_name) = abs( (c'*x_m - objval.(test_name))/objval.(test_name) );
objval.(test_name)
c'*x_m
test_info.(test_name) = info;


Expand Down

0 comments on commit a680162

Please sign in to comment.