DSDP
allbounds.c
Go to the documentation of this file.
1#include "dsdpcone_impl.h"
2#include "dsdpsys.h"
3#include "dsdp5.h"
4
9
10#define COMPUTELBS(a,b,c) ( (a)+(b)-(c))
11#define COMPUTEUBS(a,b,c) (-(a)-(b)-(c))
12
13struct LUBounds_C{
14 double r,muscale,minx;
15 int invisible;
16 int keyid;
17 int setup,iter;
18 double lbound,ubound;
19 double maxratio;
20 DSDPVec YD,YP,DYD;
21 DSDP dsdp;
22 DSDPTruth skipit;
23 double pobj,pax,sumx,xdots;
24};
25typedef struct LUBounds_C* LUBounds;
26
27#define LUKEY 5432
28
29#define LUConeValid(a) {if (!(a)||((a)->keyid!=LUKEY)){ DSDPSETERR(101,"DSDPERROR: Invalid LUCone object\n");}}
30
31static int LUBoundsS(void* dcone,DSDPVec Y, DSDPDualFactorMatrix flag,
32 DSDPTruth *psdefinite);
33
34#undef __FUNCT__
35#define __FUNCT__ "LUBoundsSetUp"
36static int LUBoundsSetup(void *dcone,DSDPVec y){
37 DSDPFunctionBegin;
38 DSDPFunctionReturn(0);
39}
40
41#undef __FUNCT__
42#define __FUNCT__ "LUBoundsSetUp2"
43static int LUBoundsSetup2(void *dcone, DSDPVec Y, DSDPSchurMat M){
44 int info;
45 LUBounds lucone=(LUBounds)dcone;
46 DSDPFunctionBegin;
47 LUConeValid(lucone);
48 if (lucone->setup==0){
49 info=DSDPVecDuplicate(Y,&lucone->DYD);DSDPCHKERR(info);
50 info=DSDPVecDuplicate(Y,&lucone->YD);DSDPCHKERR(info);
51 info=DSDPVecDuplicate(Y,&lucone->YP);DSDPCHKERR(info);
52 info=DSDPVecSet(lucone->lbound,lucone->YD);DSDPCHKERR(info);
53 info=DSDPVecSetR(lucone->YD,-1e30);DSDPCHKERR(info);
54 info=DSDPVecSetC(lucone->YD,-1e30);DSDPCHKERR(info);
55 info=DSDPVecPointwiseMax(lucone->YD,Y,Y);DSDPCHKERR(info);
56 info=DSDPVecSet(lucone->ubound,lucone->YD);DSDPCHKERR(info);
57 info=DSDPVecSetR(lucone->YD,1e30);DSDPCHKERR(info);
58 info=DSDPVecSetC(lucone->YD,1e30);DSDPCHKERR(info);
59 info=DSDPVecPointwiseMin(lucone->YD,Y,Y);DSDPCHKERR(info);
60 lucone->setup=1;
61 }
62 DSDPFunctionReturn(0);
63}
64
65#undef __FUNCT__
66#define __FUNCT__ "LUBoundsDestroy"
67static int LUBoundsDestroy(void *dcone){
68 int info;
69 LUBounds lucone=(LUBounds)dcone;
70 DSDPFunctionBegin;
71 LUConeValid(lucone);
72 info=DSDPVecDestroy(&lucone->DYD);DSDPCHKERR(info);
73 info=DSDPVecDestroy(&lucone->YD);DSDPCHKERR(info);
74 info=DSDPVecDestroy(&lucone->YP);DSDPCHKERR(info);
75 DSDPFREE(&dcone,&info);DSDPCHKERR(info);
76 DSDPFunctionReturn(0);
77}
78
79#undef __FUNCT__
80#define __FUNCT__ "LUBoundsSize"
81static int LUBoundsSize(void *dcone, double *n){
82 int nn,info;
83 LUBounds lucone=(LUBounds)dcone;
84 DSDPFunctionBegin;
85 LUConeValid(lucone);
86 *n=0;
87 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);}
88 info=DSDPVecGetSize(lucone->YD,&nn);DSDPCHKERR(info);
89 *n=(2*(nn-2)*lucone->muscale);
90 DSDPFunctionReturn(0);
91}
92
93
94#undef __FUNCT__
95#define __FUNCT__ "LUBoundsHessian"
96static int LUBoundsHessian(void* dcone, double mu, DSDPSchurMat M,
97 DSDPVec vrhs1, DSDPVec vrhs2){
98 int info,i,m;
99 LUBounds lucone=(LUBounds)dcone;
100 double assa,as,asrs=0,sl,su;
101 double dd,yy,rs=0,srrs=0;
102 double cc,rr,r,r0=lucone->r;
103 double lbound, ubound;
104 DSDPVec DScale=lucone->YP,Y=lucone->YD;
105
106 DSDPFunctionBegin;
107 LUConeValid(lucone);
108
109 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);}
110 mu*=lucone->muscale;
111 info=DSDPSchurMatDiagonalScaling(M,DScale);DSDPCHKERR(info);
112 info=DSDPVecGetSize(DScale,&m);DSDPCHKERR(info);
113 info=DSDPVecGetC(Y,&cc);DSDPCHKERR(info);
114 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info);
115 lbound=cc*lucone->lbound;
116 ubound=cc*lucone->ubound;
117 r=rr*lucone->r;
118 info=DSDPVecSetC(DScale,0);DSDPCHKERR(info);
119 info=DSDPVecSetR(DScale,0);DSDPCHKERR(info);
120 for (i=1;i<m-1;i++){
121 info=DSDPVecGetElement(DScale,i,&dd);DSDPCHKERR(info);
122 info=DSDPVecSetElement(DScale,i,0);DSDPCHKERR(info);
123 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info);
124 sl=1.0/COMPUTELBS(lbound,yy,r);
125 su=1.0/COMPUTEUBS(ubound,yy,r);
126 assa=mu*(su*su + sl*sl);
127 as=mu*(su-sl);
128 if (r){
129 asrs=mu*r0*(su*su - sl*sl);
130 rs+=(su+sl);
131 srrs+=(su*su + sl*sl);
132 }
133 if (dd==0) continue;
134 info=DSDPVecAddElement(vrhs2,i,dd*as);DSDPCHKERR(info);
135 /* info=DSDPVecAddElement(vrhs3,i,dd*asrs);DSDPCHKERR(info); */
136 info=DSDPVecSetElement(DScale,i,dd*assa);DSDPCHKERR(info);
137 }
138 info=DSDPSchurMatAddDiagonal(M,DScale);DSDPCHKERR(info);
139 info=DSDPVecAddR(vrhs2,r0*mu*rs);DSDPCHKERR(info);
140 /*
141 info=DSDPVecAddR(vrhs3,r0*mu*srrs);DSDPCHKERR(info);
142 */
143 DSDPFunctionReturn(0);
144}
145
146#undef __FUNCT__
147#define __FUNCT__ "LUBoundsMultiply"
148static int LUBoundsMultiply(void* dcone, double mu, DSDPVec vrow, DSDPVec vin, DSDPVec vout){
149 int info,i,m;
150 double vv,ww,yy,sl,su,assa,rr;
151 LUBounds lucone=(LUBounds)dcone;
152 double cc, r=lucone->r;
153 double lbound=lucone->lbound, ubound=lucone->ubound;
154 DSDPVec Y=lucone->YD;
155
156 DSDPFunctionBegin;
157 LUConeValid(lucone);
158 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);}
159 mu*=lucone->muscale;
160 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info);
161 info=DSDPVecGetC(Y,&cc);DSDPCHKERR(info);
162 r=r*rr;
163 lbound*=cc; ubound*=cc;
164 info=DSDPVecGetSize(vin,&m);DSDPCHKERR(info);
165 for (i=1;i<m-1;i++){
166 info=DSDPVecGetElement(vrow,i,&ww);DSDPCHKERR(info);
167 info=DSDPVecGetElement(vin,i,&vv);DSDPCHKERR(info);
168 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info);
169 if (vv==0 || ww==0) continue;
170 sl=(1.0)/COMPUTELBS(lbound,yy,r);
171 su=(1.0)/COMPUTEUBS(ubound,yy,r);
172 assa=mu*ww*vv*(su*su + sl*sl);
173 info=DSDPVecAddElement(vout,i,assa);DSDPCHKERR(info);
174 }
175
176 DSDPFunctionReturn(0);
177}
178
179#undef __FUNCT__
180#define __FUNCT__ "BoundYConeAddX"
181int BoundYConeAddX(LUBounds lucone, double mu, DSDPVec Y, DSDPVec DY, DSDPVec XLU, double *tracexs){
182 int i,m,info;
183 double sl,su,dsl,dsu,ux,lx;
184 double dy,yy,xdots=0,xsum1=0,xsum2=0;
185 double r,dr,rr,drr,cr;
186 double lbound, ubound;
187
188 DSDPFunctionBegin;
189 LUConeValid(lucone);
190 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);}
191 info=DSDPVecGetSize(Y,&m);DSDPCHKERR(info);
192 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info);
193 info=DSDPVecGetC(Y,&cr);DSDPCHKERR(info);
194 info=DSDPVecGetR(DY,&drr);DSDPCHKERR(info);
195 r=rr*lucone->r; dr=drr*lucone->r;
196 lbound=cr*lucone->lbound; ubound=cr*lucone->ubound;
197 mu*=lucone->muscale;
198 for (i=1;i<m-1;i++){
199 info=DSDPVecGetElement(DY,i,&dy);DSDPCHKERR(info);
200 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info);
201 sl=1.0/COMPUTELBS(lbound,yy,r);
202 su=1.0/COMPUTEUBS(ubound,yy,r);
203 dsl=COMPUTELBS(0,dy,dr);
204 dsu=COMPUTEUBS(0,dy,dr);
205 lx=mu*(sl-sl*dsl*sl);
206 ux=mu*(su-su*dsu*su);
207 info=DSDPVecAddElement(XLU,i,ux-lx);DSDPCHKERR(info);
208 /* printf("%d) %4.4f %4.4f %4.4f ",i,ux,lx,ux-lx); */
209 xsum1+=lx;
210 xsum2+=ux;
211 xdots+=lx/sl + ux/su;
212 }
213 info=DSDPVecAddC(XLU,ubound*xsum1-lbound*xsum2);DSDPCHKERR(info);
214 info=DSDPVecAddR(XLU,xsum1+xsum2);DSDPCHKERR(info);
215 *tracexs+=xdots;
216 /*
217 DSDPLogInfo(0,3,"YBounds: Minimum x: %4.4e. Maximum x: %4.4e, Objective: %4.4e, Trace(xs): %4.4e, Max Ratio of x and s: %4.4e\n",minx,maxx,ppobj,xdots,ratioxs);
218 */
219 DSDPFunctionReturn(0);
220}
221
222#undef __FUNCT__
223#define __FUNCT__ "BoundYConeAddS"
224int BoundYConeAddS(LUBounds lucone, DSDPVec SL, DSDPVec SU){
225 DSDPFunctionBegin;
226 LUConeValid(lucone);
227 DSDPFunctionReturn(1);
228}
229
230#undef __FUNCT__
231#define __FUNCT__ "LUBoundsS"
232static int LUBoundsS(void* dcone,DSDPVec Y, DSDPDualFactorMatrix flag,
233 DSDPTruth *psdefinite){
234 int i,m,info;
235 LUBounds lucone=(LUBounds)dcone;
236 double cr,rr,r;
237 double yy,sl,su;
238 double lbound, ubound;
239 DSDPSchurMat M={0,0,0};
240
241 DSDPFunctionBegin;
242 LUConeValid(lucone);
243 *psdefinite=DSDP_TRUE;
244 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);}
245 if (lucone->setup==0){
246 info=LUBoundsSetup2(dcone,Y,M);DSDPCHKERR(info);
247 }
248 info=DSDPVecGetC(Y,&cr);DSDPCHKERR(info);
249 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info);
250 lbound=cr*lucone->lbound; ubound=cr*lucone->ubound;
251 r=rr*lucone->r;
252 *psdefinite=DSDP_TRUE;
253 if (flag==DUAL_FACTOR){
254 info=DSDPVecCopy(Y,lucone->YD);DSDPCHKERR(info);
255 } else {
256 info=DSDPVecCopy(Y,lucone->YP);DSDPCHKERR(info);
257 }
258
259 info=DSDPVecGetSize(Y,&m);DSDPCHKERR(info);
260 for (i=1;i<m-1;i++){
261 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info);
262 sl=COMPUTELBS(lbound,yy,r);
263 su=COMPUTEUBS(ubound,yy,r);
264 if (sl<=0 || su<=0){ *psdefinite=DSDP_FALSE; break;}
265 }
266 DSDPFunctionReturn(0);
267}
268
269#undef __FUNCT__
270#define __FUNCT__ "LUInvertS"
271static int LUInvertS(void* dcone){
272 DSDPFunctionBegin;
273 DSDPFunctionReturn(0);
274}
275
276#undef __FUNCT__
277#define __FUNCT__ "LUBoundsSetX"
278static int LUBoundsSetX(void* dcone,double mu, DSDPVec Y,DSDPVec DY){
279 LUBounds lucone=(LUBounds)dcone;
280 int info;
281 DSDPFunctionBegin;
282 LUConeValid(lucone);
283 info=DSDPVecCopy(Y,lucone->YP);DSDPCHKERR(info);
284 info=DSDPVecCopy(DY,lucone->DYD);DSDPCHKERR(info);
285 DSDPFunctionReturn(0);
286}
287
288#undef __FUNCT__
289#define __FUNCT__ "LUBoundsX"
290static int LUBoundsX(void* dcone,double mu, DSDPVec Y,DSDPVec DY, DSDPVec AX , double *tracexs){
291 LUBounds lucone=(LUBounds)dcone;
292 int info,invisible=lucone->invisible;
293
294 DSDPFunctionBegin;
295 LUConeValid(lucone);
296 info=LUBoundsSetX(dcone,mu,Y,DY);DSDPCHKERR(info);
297 if (!invisible){
298 info=BoundYConeAddX(lucone,mu,Y,DY,AX,tracexs);DSDPCHKERR(info);
299 }
300 DSDPFunctionReturn(0);
301}
302
303
304#undef __FUNCT__
305#define __FUNCT__ "LUBoundsComputeMaxStepLength"
306static int LUBoundsComputeMaxStepLength(void* dcone, DSDPVec DY, DSDPDualFactorMatrix flag, double *maxsteplength){
307 int i,m,info;
308 double mstep=1.0e200;
309 LUBounds lucone=(LUBounds)dcone;
310 double lbound=lucone->lbound, ubound=lucone->ubound;
311 double cc,rr,ddr,r,dsl,dsu,sl,su,yy,dy,dr;
312 DSDPVec Y;
313 DSDPFunctionBegin;
314
315 LUConeValid(lucone);
316 *maxsteplength=mstep;
317 if (flag==PRIMAL_FACTOR){
318 info=DSDPVecCopy(DY,lucone->DYD);DSDPCHKERR(info);
319 }
320 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);}
321 info=DSDPVecGetR(DY,&ddr);DSDPCHKERR(info);
322 dr=ddr*lucone->r;
323 if (flag==DUAL_FACTOR){
324 Y=lucone->YD;
325 } else {
326 Y=lucone->YP;
327 }
328 info=DSDPVecGetC(Y,&cc);DSDPCHKERR(info);
329 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info);
330 lbound*=cc; ubound*=cc;
331 r=rr*lucone->r;
332
333 info=DSDPVecGetSize(Y,&m);DSDPCHKERR(info);
334 for (i=1;i<m-1;i++){
335 info=DSDPVecGetElement(DY,i,&dy);DSDPCHKERR(info);
336 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info);
337 sl=COMPUTELBS(lbound,yy,r);
338 su=COMPUTEUBS(ubound,yy,r);
339 dsl=COMPUTELBS(0,dy,dr);
340 dsu=COMPUTEUBS(0,dy,dr);
341
342 if (dsl<0){mstep=DSDPMin(mstep,-sl/dsl);}
343 if (dsu<0){mstep=DSDPMin(mstep,-su/dsu);}
344 }
345 *maxsteplength=mstep;
346 DSDPLogInfo(0,8,"YBounds: max step: %4.4e\n",mstep);
347 DSDPFunctionReturn(0);
348}
349
350
351#undef __FUNCT__
352#define __FUNCT__ "LUBoundsPotential"
353static int LUBoundsPotential(void* dcone, double *logobj, double *logdet){
354 LUBounds lucone=(LUBounds)dcone;
355 int i,m,info;
356 double sl,su,yy,sumlog=0;
357 double cc,rr,r;
358 double lbound=lucone->lbound, ubound=lucone->ubound;
359 DSDPVec Y=lucone->YD;
360 DSDPFunctionBegin;
361
362 LUConeValid(lucone);
363 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);}
364 info=DSDPVecGetC(Y,&cc);DSDPCHKERR(info);
365 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info);
366 lbound*=cc; ubound*=cc;
367 r=rr*lucone->r;
368
369 info=DSDPVecGetSize(Y,&m);DSDPCHKERR(info);
370 for (i=1;i<m-1;i++){
371 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info);
372 sl=COMPUTELBS(lbound,yy,r);
373 su=COMPUTEUBS(ubound,yy,r);
374 sumlog+= log(su*sl);
375 }
376 *logdet=lucone->muscale*sumlog;
377 *logobj=0;
378 DSDPFunctionReturn(0);
379}
380
381#undef __FUNCT__
382#define __FUNCT__ "LUBoundsSparsity"
383static int LUBoundsSparsity(void *dcone,int row, int *tnnz, int rnnz[], int m){
384 LUBounds lucone=(LUBounds)dcone;
385 DSDPFunctionBegin;
386 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);}
387 *tnnz=1;rnnz[row]++;
388 DSDPFunctionReturn(0);
389}
390
391
392#undef __FUNCT__
393#define __FUNCT__ "LPANorm2"
394static int LPANorm2( void *dcone, DSDPVec ANorm){
395 LUBounds lucone=(LUBounds)dcone;
396 double yy,cnorm2;
397 int i,m,info;
398 DSDPFunctionBegin;
399 LUConeValid(lucone);
400 if (lucone->invisible){DSDPFunctionReturn(0);}
401 info=DSDPVecGetSize(ANorm,&m);DSDPCHKERR(info);
402 for (i=1;i<m-1;i++){
403 yy=2.0;
404 info=DSDPVecAddElement(ANorm,i,yy);
405 }
406 cnorm2=m*lucone->lbound*lucone->lbound + m*lucone->ubound*lucone->ubound;
407 cnorm2=m+1.0;
408 info=DSDPVecAddC(ANorm,cnorm2);DSDPCHKERR(info);
409 info=DSDPVecAddR(ANorm,2*lucone->r);DSDPCHKERR(info);
410 DSDPFunctionReturn(0);
411}
412
413
414#undef __FUNCT__
415#define __FUNCT__ "LUBoundsView"
416int LUBoundsView(LUBounds lucone){
417 double lbound=lucone->lbound, ubound=lucone->ubound;
418 DSDPFunctionBegin;
419 LUConeValid(lucone);
420 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);}
421 printf("Lower Bounds for all y variables: %4.8e\n",lbound);
422 printf("Upper Bounds for all y variables: %4.8e\n",ubound);
423 DSDPFunctionReturn(0);
424}
425
426#undef __FUNCT__
427#define __FUNCT__ "LUBoundsRHS"
428static int LUBoundsRHS( void *dcone, double mu, DSDPVec vrow, DSDPVec vrhs1, DSDPVec vrhs2){
429 int info,i,m;
430 LUBounds lucone=(LUBounds)dcone;
431 double as,sl,su;
432 double dd,yy,rs=0;
433 double cc,rr,r,r0=lucone->r;
434 double lbound, ubound;
435 DSDPVec Y=lucone->YD;
436
437 DSDPFunctionBegin;
438 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);}
439
440 LUConeValid(lucone);
441 mu*=lucone->muscale;
442 info=DSDPVecGetSize(vrow,&m);DSDPCHKERR(info);
443 info=DSDPVecGetC(Y,&cc);DSDPCHKERR(info);
444 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info);
445 lbound=cc*lucone->lbound;
446 ubound=cc*lucone->ubound;
447 r=rr*lucone->r;
448 for (i=1;i<m-1;i++){
449 info=DSDPVecGetElement(vrow,i,&dd);DSDPCHKERR(info);
450 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info);
451 sl=1.0/COMPUTELBS(lbound,yy,r);
452 su=1.0/COMPUTEUBS(ubound,yy,r);
453 as=mu*(su-sl);
454 if (r){
455 rs+=(su+sl);
456 }
457 if (dd==0) continue;
458 info=DSDPVecAddElement(vrhs2,i,dd*as);DSDPCHKERR(info);
459 }
460 info=DSDPVecAddR(vrhs2,r0*mu*rs);DSDPCHKERR(info);
461 DSDPFunctionReturn(0);
462}
463
464
465#undef __FUNCT__
466#define __FUNCT__ "LUBoundsMonitor"
467static int LUBoundsMonitor(void* dcone,int tag){
468 DSDPFunctionBegin;
469 DSDPFunctionReturn(0);
470}
471
472
473static struct DSDPCone_Ops kops;
474static const char *luconename="Bound Y Cone";
475
476#undef __FUNCT__
477#define __FUNCT__ "LUBoundsOperationsInitialize"
478static int LUBoundsOperationsInitialize(struct DSDPCone_Ops* coneops){
479 int info;
480 if (coneops==NULL) return 0;
481 info=DSDPConeOpsInitialize(coneops); DSDPCHKERR(info);
482 coneops->conehessian=LUBoundsHessian;
483 coneops->conesetup=LUBoundsSetup;
484 coneops->conesetup2=LUBoundsSetup2;
485 coneops->conedestroy=LUBoundsDestroy;
486 coneops->conemonitor=LUBoundsMonitor;
487 coneops->conecomputes=LUBoundsS;
488 coneops->coneinverts=LUInvertS;
489 coneops->conecomputex=LUBoundsX;
490 coneops->conesetxmaker=LUBoundsSetX;
491 coneops->conemaxsteplength=LUBoundsComputeMaxStepLength;
492 coneops->conerhs=LUBoundsRHS;
493 coneops->conelogpotential=LUBoundsPotential;
494 coneops->conesize=LUBoundsSize;
495 coneops->conesparsity=LUBoundsSparsity;
496 coneops->conehmultiplyadd=LUBoundsMultiply;
497 coneops->coneanorm2=LPANorm2;
498 coneops->id=12;
499 coneops->name=luconename;
500 return 0;
501}
502
503#undef __FUNCT__
504#define __FUNCT__ "BoundYConeSetBounds"
512int BoundYConeSetBounds(LUBounds lucone, double lb, double ub){
513 DSDPFunctionBegin;
514 LUConeValid(lucone);
515 lucone->lbound=lb;
516 lucone->ubound=ub;
517 if (lb==0 && ub==0){lucone->skipit=DSDP_TRUE;}
518 else { lucone->skipit=DSDP_FALSE;}
519 DSDPFunctionReturn(0);
520}
521
522
523#undef __FUNCT__
524#define __FUNCT__ "BoundYConeGetBounds"
532int BoundYConeGetBounds(LUBounds lucone, double *lb, double *ub){
533 DSDPFunctionBegin;
534 LUConeValid(lucone);
535 *lb=lucone->lbound;
536 *ub=lucone->ubound;
537 DSDPFunctionReturn(0);
538}
539
540
541#undef __FUNCT__
542#define __FUNCT__ "DSDPAddLUBounds"
549int DSDPAddLUBounds(DSDP dsdp,LUBounds lucone){
550 int info;
551 DSDPFunctionBegin;
552 LUConeValid(lucone);
553 info=LUBoundsOperationsInitialize(&kops); DSDPCHKERR(info);
554 info=DSDPAddCone(dsdp,&kops,(void*)lucone); DSDPCHKERR(info);
555 DSDPFunctionReturn(0);
556}
557
558#undef __FUNCT__
559#define __FUNCT__ "DSDPCreateLUBoundsCone"
566int DSDPCreateLUBoundsCone(DSDP dsdp, LUBounds *dspcone){
567 int m,info;
568 struct LUBounds_C *lucone;
569 DSDPFunctionBegin;
570 if (!dsdp){DSDPFunctionReturn(1);}
571 DSDPCALLOC1(&lucone,struct LUBounds_C,&info);DSDPCHKERR(info);
572 *dspcone=lucone;
573 lucone->keyid=LUKEY;
574 info=DSDPAddLUBounds(dsdp,lucone);DSDPCHKERR(info);
575 info=DSDPGetNumberOfVariables(dsdp,&m);DSDPCHKERR(info);
576 lucone->muscale=1.0;
577 lucone->r=0.0;
578 lucone->skipit=DSDP_FALSE;
579 lucone->pobj=0; lucone->pax=0; lucone->sumx=0; lucone->xdots=0;
580 info=BoundYConeSetBounds(lucone,-1000000,1000000);DSDPCHKERR(info);
581 lucone->invisible=1;
582 lucone->setup=0;
583 DSDPFunctionReturn(0);
584}
585
586#undef __FUNCT__
587#define __FUNCT__ "LUBoundsScaleBarrier"
588int LUBoundsScaleBarrier(LUBounds lucone,double muscale){
589 DSDPFunctionBegin;
590 LUConeValid(lucone);
591 if (muscale>0){
592 lucone->muscale=muscale;
593 }
594 DSDPFunctionReturn(0);
595}
596
int DSDPAddLUBounds(DSDP dsdp, LUBounds lucone)
Set the constraints to the solver.
Definition allbounds.c:549
int DSDPCreateLUBoundsCone(DSDP dsdp, LUBounds *dspcone)
Create bounds cone.
Definition allbounds.c:566
int BoundYConeGetBounds(LUBounds lucone, double *lb, double *ub)
Get bounds on the variables.
Definition allbounds.c:532
int BoundYConeSetBounds(LUBounds lucone, double lb, double ub)
Set bounds on the variables.
Definition allbounds.c:512
The API to DSDP for those applications using DSDP as a subroutine library.
DSDPTruth
Boolean variables.
@ DSDP_FALSE
@ DSDP_TRUE
DSDPDualFactorMatrix
DSDP requires two instances of the data structures S.
@ PRIMAL_FACTOR
@ DUAL_FACTOR
struct DSDP_C * DSDP
An implementation of the dual-scaling algorithm for semidefinite programming.
int DSDPConeOpsInitialize(struct DSDPCone_Ops *dops)
Initialize the function pointers to 0.
Definition dsdpcone.c:443
Implementations of a cone (SDP,LP,...) must provide a structure of function pointers.
int DSDPAddCone(DSDP, struct DSDPCone_Ops *, void *)
Apply DSDP to a conic structure.
Definition dsdpcops.c:569
int DSDPSchurMatAddDiagonal(DSDPSchurMat, DSDPVec)
Add elements to a row of the Schur matrix.
struct DSDPSchurMat_C DSDPSchurMat
This object represents the Schur Matrix. Its structure is opaque to the DSDP solver,...
int DSDPSchurMatDiagonalScaling(DSDPSchurMat, DSDPVec)
Get the scaling and nonzero pattern of each diagonal element of the matrix.
Error handling, printing, and profiling.
struct DSDPVec_C DSDPVec
This object hold m+2 variables: a scaling of C, the y variables, and r.
Definition dsdpvec.h:25
int DSDPGetNumberOfVariables(DSDP dsdp, int *m)
Copy the number of variables y.