Skip to content

Commit b568d56

Browse files
authored
Merge pull request #4 from OxfordControl/developer
Merge Developer into Master for release v1.1
2 parents 84ecc9d + c3af45e commit b568d56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1346
-353
lines changed

.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ pythontex-files-*/
216216
TSWLatexianTemp*
217217

218218
## Editors:
219+
220+
# MATLAB editor
221+
*.asv
222+
223+
# gedit
224+
*.*~
225+
219226
# WinEdt
220227
*.bak
221228
*.sav
@@ -228,5 +235,3 @@ TSWLatexianTemp*
228235

229236
# KBibTeX
230237
*~[0-9]*
231-
admmdual/dataChorDec.m
232-
admmdual/dataChorDec.m

README.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# CDCS
22

33
CDCS (Cone Decomposition Conic Solver) is an open-source MATLAB solver for sparse conic programs with partially decomposable conic constraints. CDCS implements the alternating direction method of multipliers (ADMM)
4-
described in on our paper [_Fast ADMM for Semidefinite Programs with Chordal Sparsity_](https://arxiv.org/pdf/1609.06068v2.pdf) (included in the `doc/` folder).
4+
described in our papers [_Fast ADMM for Semidefinite Programs with Chordal Sparsity_](https://arxiv.org/pdf/1609.06068v2.pdf) and [_Fast ADMM for homogeneous self-dual embeddings of sparse SDPs_](https://arxiv.org/pdf/1611.01828.pdf) (included in the `doc/` folder)
55

6-
**Current version:** 1.0
6+
**Current version:** 1.1
77

8-
**Release notes:** CDCS is based on a temporary research code called ADMM-PDCP, which is no longer maintained. If you downloaded ADMM-PDCP, please replace it with CDCS.
8+
**Release notes:**
9+
10+
* Homogeneous self-dual embedding is the new default method
11+
* The termination codes have changed. This means that if you use CDCS from YALMIP, the termination code returned by YALMIP will be incorrect. This should be fixed in the next YALMIP release!
12+
* CDCS is based on a temporary research code called ADMM-PDCP, which is no longer maintained. If you downloaded ADMM-PDCP, please replace it with CDCS.
913

1014

1115
## Contents
@@ -21,7 +25,7 @@ described in on our paper [_Fast ADMM for Semidefinite Programs with Chordal Spa
2125
CDCS solves in the standard primal and dual vectorized forms
2226

2327
minimize c'x maximize b'y
24-
(1) subject to Ax = b, (2) subject to c - A'y = z,
28+
(1) subject to Ax = b, (2) subject to A'y + z = c,
2529
x \in K z \in K*
2630

2731
where the conic constraint `x \in K` are partially decomposable. This means that
@@ -41,6 +45,9 @@ sparsity pattern. The other supported cone types are not decomposed.
4145
This means that CDCS is most suitable for large sparse semidefinite programs (SDPs),
4246
although it can be used for any conic program over the supported cones.
4347

48+
CDCS offers a choice to solve the primal problem (1) only, the dual problem (2) only,
49+
or the homogeneous self-dual embedding of the two problems. _From version 1.1, the
50+
homogeneous self-dual embedding is the default method._
4451

4552

4653
## Quick start<a name="QuickStart"></a>
@@ -72,26 +79,36 @@ you have any suggestions for improvement, or find any bugs, feel free to [contac
7279

7380
## How to cite<a name="References"></a>
7481

75-
If you find CDCS useful, please cite:
82+
If you find CDCS useful, please cite at least one of the following papers as appropriate:
7683

7784
```
78-
@article{ZFPGW2016,
79-
archivePrefix = {arXiv},
80-
eprint = {1609.06068v2},
81-
primaryClass = "math-OC",
82-
author = {Zheng, Yang and Fantuzzi, Giovanni and Papachristodoulou, Antonis and Goulart, Paul and Wynn, Andrew},
83-
title = {{Fast ADMM for Semidefinite Programs with Chordal Sparsity}}
84-
}
85+
@article{{ZFPGWhsde2016,
86+
archivePrefix= {arXiv},
87+
eprint = {1611.01828},
88+
primaryClass = "math-OC",
89+
author = {Zheng, Yang and Fantuzzi, Giovanni and Papachristodoulou, Antonis and Goulart, Paul and Wynn, Andrew},
90+
title = {{Fast ADMM for homogeneous self-dual embeddings of sparse SDPs}}
91+
}
92+
93+
@article{ZFPGWpd2016,
94+
archivePrefix= {arXiv},
95+
eprint = {1609.06068v2},
96+
primaryClass = "math-OC",
97+
author = {Zheng, Yang and Fantuzzi, Giovanni and Papachristodoulou, Antonis and Goulart, Paul and Wynn, Andrew},
98+
title = {{Fast ADMM for Semidefinite Programs with Chordal Sparsity}}
99+
}
85100
86101
@misc{CDCS,
87102
author = {Zheng, Yang and Fantuzzi, Giovanni and Papachristodoulou, Antonis and Goulart, Paul and Wynn, Andrew},
88-
title = {{CDCS}: Cone Decomposition Conic Solver, version 1.0},
103+
title = {{CDCS}: Cone Decomposition Conic Solver, version 1.1},
89104
howpublished = {\url{https://github.com/giofantuzzi/CDCS}},
90105
month = Sep,
91106
year = 2016
92107
}
93108
```
94109
A selection of BibTex styles that support arXiv preprints can be found [here](http://arxiv.org/hypertex/bibstyles/).
110+
111+
95112
## Contact us<a name="Contacts"></a>
96113
To contact us about CDCS, suggest improvements and report bugs, email either [Giovanni Fantuzzi](mailto:gf910@ic.ac.uk?Subject=CDCS) or [Yang Zheng](mailto:yang.zheng@eng.ox.ac.uk?Subject=CDCS).
97114

README.txt

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44

55
CDCS (Cone Decomposition Conic Solver) is an open-source MATLAB solver for sparse
66
conic programs with partially decomposable conic constraints. CDCS implements the
7-
alternating direction method of multipliers (ADMM) described in on our paper:
8-
"Fast ADMM for Semidefinite Programs with Chordal Sparsity" available from
9-
(https://arxiv.org/pdf/1609.06068v2.pdf).
7+
alternating direction method of multipliers (ADMM) described in on our papers
8+
9+
* "Fast ADMM for Semidefinite Programs with Chordal Sparsity" available from
10+
(https://arxiv.org/pdf/1609.06068v2.pdf)
1011

11-
Current version: 1.0
12+
* "Fast ADMM for homogeneous self-dual embeddings of sparse SDPs" available from
13+
(https://arxiv.org/abs/1611.01828)
14+
15+
Current version: 1.1
1216
Release notes: CDCS is based on a temporary research code called ADMM-PDCP, which
1317
is no longer maintained. If you downloaded ADMM-PDCP, please
1418
replace it with CDCS.
@@ -32,7 +36,7 @@ Release notes: CDCS is based on a temporary research code called ADMM-PDCP, whic
3236
CDCS solves in the standard primal and dual vectorized forms
3337

3438
minimize c'x maximize b'y
35-
(1) subject to Ax = b, (2) subject to c - A'y = z,
39+
(1) subject to Ax = b, (2) subject to A'y + z = c,
3640
x \in K z \in K*
3741

3842
where the conic constraint `x \in K` are partially decomposable. This means that
@@ -87,9 +91,17 @@ us (see the Contact Us section below).
8791
HOW TO CITE
8892
================================================================================
8993

90-
If you find CDCS useful, please cite it with
94+
If you find CDCS useful, please cite
95+
96+
@article{{ZFPGWhsde2016,
97+
archivePrefix = {arXiv},
98+
eprint = {1611.01828},
99+
primaryClass = "math-OC",
100+
author = {Zheng, Yang and Fantuzzi, Giovanni and Papachristodoulou, Antonis and Goulart, Paul and Wynn, Andrew},
101+
title = {{Fast ADMM for homogeneous self-dual embeddings of sparse SDPs}}
102+
}
91103

92-
@article{ZFPGW2016,
104+
@article{ZFPGWpd2016,
93105
archivePrefix = {arXiv},
94106
eprint = {1609.06068v2},
95107
primaryClass = "math-OC",

cdcs.m

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,50 @@
11
function [x,y,z,info] = cdcs(At,b,c,K,userOpts,initVars)
2-
32
% CDCS
43
%
54
% Syntax:
65
%
7-
% [x,y,z,info] = CDCS(At,b,c,K,opts)
6+
% [x,y,z,info] = CDCS(At,b,c,K,options)
87
%
9-
% Solve a sparse conic program using chordal decomposition for the semidefinite
8+
% Solve a sparse conic program using chordal decomposition for the positive semidefinite
109
% cones and ADMM. CDCS solves the primal (P) or dual (D) standard forms of
1110
% the conic problem,
1211
%
1312
% min <c,x> max <b,y>
14-
% (P) s.t. Ax = b, (D) s.t. c - A^Ty = z
13+
% (P) s.t. Ax = b, (D) s.t. A^Ty + z = c
1514
% x \in K z \in K*
1615
%
17-
% where A,b and c are the problem date and K is the cone (K* is the dual cone).
16+
% where A,b and c are the problem data and K is the cone (K* is the dual cone).
17+
% CDCS supports the following cones: Free, Linear, second-order,
18+
% Semi-definite, called as called K.f, K.l, K.q, and K.s.
19+
%
1820
% The standard form to be solved is specified by the "solver" field of the
1921
% options structure:
2022
%
21-
% opts.solver = 'primal' (default): solve the problem in primal standard form
22-
% opts.solver = 'dual' : solve the problem in dual standard form
23+
% options.solver = 'hsde' (default): solve the problem in homogeneous self-dual embedding form
24+
% options.solver = 'primal' : solve the problem in primal standard form
25+
% options.solver = 'dual' : solve the problem in dual standard form
2326
%
2427
% The chordal decomposition can be carried out in two ways, specified by the
2528
% "chordalize" option:
2629
%
27-
% opts.chordalize = 1 (default): split the data equally between the cliques
28-
% opts.chordalize = 2 : assign data to one clique only
30+
% options.chordalize = 1 (default): split the data equally between the cliques
31+
% options.chordalize = 2 : assign data to one clique only
2932
%
3033
% <a href="matlab:help('cdcsOpts')">Click here for a complete list of options</a>.
3134
%
3235
% The output structure 'info' contains the following information:
3336
%
3437
% info.problem: - 0: CDCS terminated succesfully
35-
% - 1: the maximum number of iterations was reached
36-
% - 2: the ADMM iterations terminated succesfully, but the positive
37-
% matrix completion algorithm threw an error
38+
% - 1: primal infeasibility detected
39+
% - 2: dual infeasibility detected
40+
% - 3: maximum number of iterations reached
41+
% - 4: the ADMM iterations terminated succesfully, but the positive
42+
% matrix completion algorithm threw an error
3843
% info.iter: number of iterations
3944
% info.cost: terminal cost
4045
% info.pres: terminal primal ADMM residual
4146
% info.dres: terminal dual ADMM residual
47+
% info.log : history log of the ADMM residuals, cost, etc.
4248
% info.time: some timing information (setup, ADMM iterations, cleanup, total)
4349
%
4450
% See also CDCSOPTS
@@ -61,10 +67,11 @@
6167

6268

6369
%============================================
64-
% Solver options
70+
% Solver options & import cdcs_utils
6571
%============================================
6672
tstart = tic;
6773
opts = cdcsOpts;
74+
import cdcs_utils.*
6875

6976

7077
%============================================
@@ -76,13 +83,13 @@
7683
end
7784

7885
% Checks on specified solver type and method
79-
if ~any(strcmpi(opts.solver,{'primal','dual'}))
80-
error('Unknown opts.solver. Please use "primal" or "dual".')
86+
if ~any(strcmpi(opts.solver,{'primal','dual','hsde'}))
87+
error('Unknown opts.solver. Please use "primal", "dual" or "hsde".')
8188
end
8289

8390
% Print nice welcoming header
8491
if opts.verbose
85-
myline1 = [repmat('=',1,64),'\n'];
92+
[header,myline1,myline2] = printHeader(opts);
8693
fprintf(myline1)
8794
fprintf('CDCS by G. Fantuzzi, Y. Zheng -- v1.0\n')
8895
fprintf(myline1)
@@ -93,15 +100,14 @@
93100
% start timing
94101
proctime = tic;
95102

96-
% sparsify everything, check cone constraints, rescale
103+
% sparsify everything, check cone constraints
97104
[At,b,c,K,opts] = checkInputs(At,b,c,K,opts);
98-
[At,b,c,K,opts] = rescaleData(At,b,c,K,opts);
99105
[At,b,c,K,opts] = splitBlocks(At,b,c,K,opts);
100106
[opts.n,opts.m] = size(At);
101107

102-
% chordal decomposition
108+
% rescale & chordal decomposition
103109
Kold = K;
104-
[At,b,c,K,Ech,cd,chstuff] = chordalize(At,b,c,K,opts);
110+
[At,b,c,K,Ech,chstuff,opts] = preprocess(At,b,c,K,opts);
105111

106112
% basic decomposed problem dimensions: no. of cones, no. of vectorized conic
107113
% variables, and no. of free primal variables
@@ -114,80 +120,77 @@
114120
[X,Y,Z,others] = makeVariables(K,initVars,opts);
115121

116122
% Make operators for ADMM
117-
[step1,step2,step3,checkConv] = makeADMM(At,b,c,K,cd,Ech,opts);
123+
[updateX,updateY,updateZ,checkConvergence] = makeADMM(At,b,c,K,Ech,opts);
118124

119125
% Time setup and display
120126
proctime = toc(proctime);
121127
if opts.verbose
122-
myline2 = [repmat('-',1,64),'\n'];
128+
% Set method to display
129+
if strcmpi(opts.solver,'hsde')
130+
method = 'homogeneous self-dual embedding';
131+
else
132+
method = opts.solver;
133+
end
123134
fprintf('done in %.4f seconds. \n',proctime);
124-
fprintf('Standard form : %s\n',opts.solver);
135+
fprintf('Algorithm : %s\n',method);
125136
fprintf('Chordalization method : %i\n',opts.chordalize);
126137
fprintf('Adaptive penalty : %i\n',opts.adaptive);
127138
fprintf('Scale data : %i\n',opts.rescale);
128139
fprintf('Free variables : %i \n',K.f);
129140
fprintf('Non-negative variables : %i \n',K.l);
130-
fprintf('Second-order cones : %i (max. size: %i)\n',length(K.q),max(K.q));
131-
fprintf('Semidefinite cones : %i (max. size: %i)\n',length(K.s),max(K.s));
141+
fprintf('Second-order cones : %i (max. size: %i)\n',length(find(K.q ~=0)),max(K.q));
142+
fprintf('Semidefinite cones : %i (max. size: %i)\n',length(find(K.s ~=0)),max(K.s));
132143
fprintf('Affine constraints : %i \n',opts.m);
133144
fprintf('Consensus constraints : %i \n',sum(accumarray(Ech,1)));
134-
fprintf(myline1)
145+
fprintf(myline1);
146+
fprintf(header);
147+
fprintf(myline2);
135148
end
136149

137150
%============================================
138151
% Run ADMM
139152
%============================================
140-
% Display
141-
if opts.verbose
142-
fprintf(' iter | pres | dres | cost | rho | time (s) |\n')
143-
fprintf(myline2)
144-
end
145-
146153
admmtime = tic;
147-
opts.feasCode = 1;
148154
for iter = 1:opts.maxIter
149155

150156
% Save current iterate for convergence test
151157
YOld = Y;
152158

153159
% Update block variables
154-
[X,others] = step1(X,Y,Z,opts.rho,others);
155-
[Y,others] = step2(X,Y,Z,opts.rho,others);
156-
[Z,others] = step3(X,Y,Z,opts.rho,others);
160+
[X,others] = updateX(X,Y,Z,opts.rho,others);
161+
[Y,others] = updateY(X,Y,Z,opts.rho,others);
162+
[Z,others] = updateZ(X,Y,Z,opts.rho,others);
157163

158164
% log errors / check for convergence
159-
[isConverged,log,opts] = checkConv(X,Y,Z,YOld,others,iter,admmtime,opts);
160-
if isConverged
161-
opts.feasCode = 0;
165+
[stop,info,log,opts] = checkConvergence(X,Y,Z,YOld,others,iter,admmtime,opts);
166+
if stop
162167
break;
163168
end
164169
end
165170
admmtime = toc(admmtime);
166-
if opts.verbose
167-
fprintf(myline1)
168-
end
169171

170172
%============================================
171173
% Outputs
172174
%============================================
173175
% Variables in sedumi format
174176
posttime = tic;
175-
[x,y,z,opts] = setOutputs(X,Y,Z,others,Kold,cd,Ech,chstuff,opts);
177+
[x,y,z,info,opts] = setOutputs(X,Y,Z,others,Kold,c,Ech,chstuff,info,opts);
176178
posttime = toc(posttime);
177179

178180
% Info
179-
info.problem = opts.feasCode; % diagnostic code
180181
info.iter = iter; % # of iterations
181-
info.cost = log.cost; % terminal cost
182-
info.pres = log.pres; % terminal primal ADMM res
183-
info.dres = log.dres; % terminal dual ADMM res
182+
info.cost = log(iter).cost; % terminal cost
183+
info.pres = log(iter).pres; % terminal primal ADMM res
184+
info.dres = log(iter).dres; % terminal dual ADMM res
185+
info.log = log; % log of residuals etc
184186
info.time.setup = proctime; % setup time
185187
info.time.admm = admmtime; % ADMM time
186188
info.time.cleanup = posttime; % post-processing time
187189
info.time.total = toc(tstart); % total CPU time
188190

189191
% Print summary
190192
if opts.verbose
193+
fprintf(myline1)
191194
fprintf(' SOLUTION SUMMARY:\n')
192195
fprintf('------------------\n')
193196
fprintf(' Termination code : %11.1d\n',info.problem)

cdcsInstall.m

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
cd('include')
1313
cs_install
1414
cd(here);
15-
movefile(['include',filesep,'cs_lsolve.mex*'],[here,filesep,'private']);
16-
movefile(['include',filesep,'cs_ltsolve.mex*'],[here,filesep,'private']);
15+
movefile(['include',filesep,'cs_lsolve.mex*'], ...
16+
[here,filesep,'packages',filesep,'+cdcs_utils']);
17+
movefile(['include',filesep,'cs_ltsolve.mex*'], ...
18+
[here,filesep,'packages',filesep,'+cdcs_utils']);
1719

1820
% Then compile some mex files from this package
19-
cd('private')
21+
cd(['packages',filesep,'+cdcs_utils',filesep,'private'])
2022
if (~isempty (strfind (computer, '64')))
2123
mexcmd = 'mex -largeArrayDims' ;
2224
else
@@ -27,6 +29,7 @@
2729
cd(here)
2830

2931
% Finally add to path and save
32+
addpath([here,filesep,'packages']);
3033
addpath(here);
3134
savepath
3235

0 commit comments

Comments
 (0)