DSDP
dbounds.c
Go to the documentation of this file.
1 #include "dsdpcone_impl.h"
2 #include "dsdpsys.h"
3 #include "dsdp5.h"
4 
5 #define COMPUTEUBS(a,b,c) (-(a)-(b)-(c))
15 struct BCone_C{
16  int keyid;
17  int nn,nnmax;
18  int *ib;
19  double *u,*au,*us,*uss,*ux,*uds;
20  double r,muscale;
21  int m;
22  double *xuout;
23  DSDPVec WY,WY2;
24 };
25 
26 #define BKEY 5432
27 #define BConeValid(a) {if (!(a)||((a)->keyid!=BKEY)){ DSDPSETERR(101,"DSDPERROR: Invalid Bcone object\n");}}
28 
29 #undef __FUNCT__
30 #define __FUNCT__ "BConeSetUp"
31 static int BConeSetup(void *dcone,DSDPVec y){
32  BCone bcone=(BCone)dcone;
33  int nn=bcone->nn;
34  int info;
35 
36  DSDPFunctionBegin;
37  if (bcone->nn<1) return 0;
38  DSDPCALLOC2(&bcone->us,double,nn,&info);DSDPCHKERR(info);
39  DSDPCALLOC2(&bcone->uss,double,nn,&info);DSDPCHKERR(info);
40  DSDPCALLOC2(&bcone->ux,double,nn,&info);DSDPCHKERR(info);
41  DSDPCALLOC2(&bcone->uds,double,nn,&info);DSDPCHKERR(info);
42  DSDPFunctionReturn(0);
43 }
44 
45 #undef __FUNCT__
46 #define __FUNCT__ "BConeSetUp2"
47 static int BConeSetup2(void *dcone, DSDPVec Y, DSDPSchurMat M){
48  int info;
49  BCone bcone=(BCone)dcone;
50  DSDPFunctionBegin;
51  info=DSDPVecDuplicate(Y,&bcone->WY);DSDPCHKERR(info);
52  info=DSDPVecDuplicate(Y,&bcone->WY2);DSDPCHKERR(info);
53  DSDPFunctionReturn(0);
54 }
55 
56 #undef __FUNCT__
57 #define __FUNCT__ "BConeDestroy"
58 static int BConeDestroy(void *dcone){
59  int info;
60  BCone bcone=(BCone)dcone;
61  DSDPFunctionBegin;
62  DSDPFREE(&bcone->ib,&info);DSDPCHKERR(info);
63  DSDPFREE(&bcone->u,&info);DSDPCHKERR(info);
64  DSDPFREE(&bcone->au,&info);DSDPCHKERR(info);
65  DSDPFREE(&bcone->us,&info);DSDPCHKERR(info);
66  DSDPFREE(&bcone->uss,&info);DSDPCHKERR(info);
67  DSDPFREE(&bcone->uds,&info);DSDPCHKERR(info);
68  DSDPFREE(&bcone->ux,&info);DSDPCHKERR(info);
69 
70  info=DSDPVecDestroy(&bcone->WY);DSDPCHKERR(info);
71  info=DSDPVecDestroy(&bcone->WY2);DSDPCHKERR(info);
72 
73  DSDPFREE(&dcone,&info);DSDPCHKERR(info);
74  DSDPFunctionReturn(0);
75 }
76 
77 #undef __FUNCT__
78 #define __FUNCT__ "BConeSize"
79 static int BConeSize(void *dcone, double *n){
80  BCone bcone=(BCone)dcone;
81  DSDPFunctionBegin;
82  *n=(double)(bcone->nn);
83  DSDPFunctionReturn(0);
84 }
85 
86 
87 #undef __FUNCT__
88 #define __FUNCT__ "BConeComputeS"
89 static int BConeComputeS(BCone bcone,DSDPVec Y,double ss[], int n){
90  int i,ii,info;
91  int *ib=bcone->ib, nn=bcone->nn;
92  double cr,rr,r,yy,*au=bcone->au,*u=bcone->u;
93 
94  DSDPFunctionBegin;
95  info=DSDPVecGetC(Y,&cr);
96  info=DSDPVecGetR(Y,&rr);
97  r=rr*bcone->r;
98  for (i=0;i<nn;i++){
99  ii=ib[i];
100  info=DSDPVecGetElement(Y,ii,&yy);
101  ss[i]=-cr*u[i]-au[i]*yy-r;
102  }
103  DSDPFunctionReturn(0);
104 }
105 
106 #undef __FUNCT__
107 #define __FUNCT__ "BConeHessian"
108 static int BConeHessian(void* dcone, double mu, DSDPSchurMat M,
109  DSDPVec vrhs1, DSDPVec vrhs2){
110  int info,i,ii;
111  BCone bcone=(BCone)dcone;
112  int *ib=bcone->ib, nn=bcone->nn;
113  double *us=bcone->us;
114  double *au=bcone->au,*u=bcone->u;
115  double dd,cc,rr,cs,as,rs;
116  double r=bcone->r;
117  DSDPVec DD=bcone->WY,MScale=bcone->WY2;
118 
119  DSDPFunctionBegin;
120  if (bcone->nn<1) return 0;
121  mu*=bcone->muscale;
122  info=DSDPVecZero(DD);DSDPCHKERR(info);
123 
124  info=DSDPSchurMatDiagonalScaling(M,MScale);DSDPCHKERR(info);
125  info=DSDPVecGetC(MScale,&cc);DSDPCHKERR(info);
126  info=DSDPVecGetR(MScale,&rr);DSDPCHKERR(info);
127  for (i=0;i<nn;i++){
128  ii=ib[i];
129  info=DSDPVecGetElement(MScale,ii,&dd);DSDPCHKERR(info);
130 
131  cs=cc*u[i]/us[i];
132  as=dd*au[i]/us[i];
133  rs=rr*r/us[i];
134 
135  if (cs){
136  info=DSDPVecAddC(vrhs2,mu*cs);DSDPCHKERR(info);
137  info=DSDPVecAddC(DD,mu*cs*cs);DSDPCHKERR(info);
138  info=DSDPSchurMatAddC(M,ii,mu*as*cs);DSDPCHKERR(info);
139  info=DSDPSchurMatAddR(M,0,mu*cs*rs);DSDPCHKERR(info);
140  }
141  if (as){
142  info=DSDPVecAddElement(vrhs2,ii,mu*as);DSDPCHKERR(info);
143  info=DSDPVecAddElement(DD,ii,mu*as*as);DSDPCHKERR(info);
144  }
145  if (rs){
146  info=DSDPVecAddR(vrhs2,mu*rs);DSDPCHKERR(info);
147  info=DSDPVecAddR(DD,mu*rs*rs);DSDPCHKERR(info);
148  info=DSDPSchurMatAddR(M,ii,mu*as*rs);DSDPCHKERR(info);
149  }
150 
151  }
152  info=DSDPSchurMatAddDiagonal(M,DD);DSDPCHKERR(info);
153 
154  DSDPFunctionReturn(0);
155 }
156 
157 #undef __FUNCT__
158 #define __FUNCT__ "BConeHessian"
159 static int BConeRHS(void* dcone, double mu, DSDPVec vrow,
160  DSDPVec vrhs1, DSDPVec vrhs2){
161  int info,i,ii;
162  BCone bcone=(BCone)dcone;
163  int *ib=bcone->ib, nn=bcone->nn;
164  double *us=bcone->us, *au=bcone->au,*u=bcone->u;
165  double dd,cc,rr,cs,as,rs;
166  double r=bcone->r;
167 
168  DSDPFunctionBegin;
169  mu*=bcone->muscale;
170  info=DSDPVecGetC(vrow,&cc);DSDPCHKERR(info);
171  info=DSDPVecGetR(vrow,&rr);DSDPCHKERR(info);
172  for (i=0;i<nn;i++){
173  ii=ib[i];
174  info=DSDPVecGetElement(vrow,ii,&dd);DSDPCHKERR(info);
175 
176  cs=cc*u[i]/us[i];
177  as=dd*au[i]/us[i];
178  rs=rr*r/us[i];
179 
180  if (cs){
181  info=DSDPVecAddC(vrhs2,mu*cs);DSDPCHKERR(info);
182  }
183  if (as){
184  info=DSDPVecAddElement(vrhs2,ii,mu*as);DSDPCHKERR(info);
185  }
186  if (rs){
187  info=DSDPVecAddR(vrhs2,mu*rs);DSDPCHKERR(info);
188  }
189 
190  }
191  DSDPFunctionReturn(0);
192 }
193 
194 
195 #undef __FUNCT__
196 #define __FUNCT__ "BConeMultiply"
197 static int BConeMultiply(void* dcone, double mu, DSDPVec vrow, DSDPVec vin, DSDPVec vout){
198  int info,i,ii;
199  BCone bcone=(BCone)dcone;
200  int *ib=bcone->ib, nn=bcone->nn;
201  double *au=bcone->au,*us=bcone->us;
202  double assa,dd,vv;
203 
204  DSDPFunctionBegin;
205  mu*=bcone->muscale;
206  for (i=0;i<nn;i++){
207  ii=ib[i];
208  info=DSDPVecGetElement(vin,ii,&dd);DSDPCHKERR(info);
209  info=DSDPVecGetElement(vrow,ii,&vv);DSDPCHKERR(info);
210  if (dd==0 || vv==0) continue;
211  assa=(au[i]/us[i]);
212  assa=mu*vv*assa*assa;
213  info=DSDPVecAddElement(vout,ii,assa);DSDPCHKERR(info);
214  }
215  DSDPFunctionReturn(0);
216 }
217 
218 #undef __FUNCT__
219 #define __FUNCT__ "BConeS"
220 static int BConeS(void* dcone,DSDPVec Y,DSDPDualFactorMatrix flag,DSDPTruth *psdefinite){
221  int i,info;
222  BCone bcone=(BCone)dcone;
223  int nn=bcone->nn;
224  double *us;
225  DSDPFunctionBegin;
226 
227  if (flag==DUAL_FACTOR){
228  us=bcone->us;
229  } else {
230  us=bcone->uss;
231  }
232  info=BConeComputeS(bcone,Y,us,nn);DSDPCHKERR(info);
233  *psdefinite=DSDP_TRUE;
234  for (i=0;i<nn;i++){
235  if (us[i]<=0){*psdefinite=DSDP_FALSE;break;}
236  }
237 
238  DSDPFunctionReturn(0);
239 }
240 
241 #undef __FUNCT__
242 #define __FUNCT__ "BConeSInvert"
243 static int BConeSInvert(void* dcone){
244  DSDPFunctionBegin;
245  DSDPFunctionReturn(0);
246 }
247 
248 
249 #undef __FUNCT__
250 #define __FUNCT__ "BConeSetX"
251 static int BConeSetX(void* dcone,double mu, DSDPVec Y,DSDPVec DY){
252  DSDPFunctionBegin;
253  DSDPFunctionReturn(0);
254 }
255 
256 #undef __FUNCT__
257 #define __FUNCT__ "BConeX"
258 static int BConeX(void* dcone,double mu, DSDPVec Y,DSDPVec DY, DSDPVec AX , double *tracexs){
259  int i,ii,info;
260  BCone bcone=(BCone)dcone;
261  int *ib=bcone->ib, nn=bcone->nn;
262  double *au=bcone->au, *us=bcone->uss, *ux=bcone->ux, *uds=bcone->uds, *u=bcone->u;
263  double *xuout=bcone->xuout;
264  double ds,dus,dau,xx,cr,rr;
265  double pobj1=0,xdots1=0;
266  DSDPTruth psdefinite;
267 
268  DSDPFunctionBegin;
269 
270  info=BConeS(dcone,Y,PRIMAL_FACTOR,&psdefinite); DSDPCHKERR(info);
271  info=BConeComputeS(bcone,DY,uds,nn);DSDPCHKERR(info);
272  info=DSDPVecGetC(Y,&cr);DSDPCHKERR(info);
273  info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info);
274 
275  mu*=bcone->muscale;
276  for (i=0;i<nn;i++){
277  ii=ib[i];
278  ds=uds[i]; dus=us[i]; dau=au[i];
279  xx=(mu/dus)-(mu/dus)*(ds/dus);
280  ux[i]=xx;
281  info=DSDPVecAddElement(AX,ii,dau*xx);DSDPCHKERR(info);
282  xdots1+=xx*us[i];
283  pobj1+=xx*u[i];
284  if (xuout) xuout[i]=xx;
285  }
286 
287  info=DSDPVecAddC(AX,pobj1);DSDPCHKERR(info);
288  *tracexs+=xdots1;
289  DSDPFunctionReturn(0);
290 }
291 
292 
293 #undef __FUNCT__
294 #define __FUNCT__ "BConeComputeMaxStepLength"
295 static int BConeComputeMaxStepLength(void* dcone, DSDPVec DY, DSDPDualFactorMatrix flag, double *maxsteplength){
296  int i,info;
297  double mstep=1.0e200;
298  BCone bcone=(BCone)dcone;
299  int nn=bcone->nn;
300  double *us,*uds=bcone->uds;
301  DSDPFunctionBegin;
302 
303  if (bcone->nn<1) return 0;
304  if (flag==DUAL_FACTOR){
305  us=bcone->us;
306  } else {
307  us=bcone->uss;
308  }
309 
310  info=BConeComputeS(bcone,DY,uds,nn);DSDPCHKERR(info);
311 
312  for (i=0;i<nn;i++){
313  if (uds[i]<0){mstep=DSDPMin(mstep,-us[i]/uds[i]);}
314  }
315 
316  *maxsteplength=mstep;
317 
318  DSDPFunctionReturn(0);
319 }
320 
321 
322 #undef __FUNCT__
323 #define __FUNCT__ "BConePotential"
324 static int BConePotential(void* dcone, double *logobj, double *logdet){
325  BCone bcone=(BCone)dcone;
326  int i;
327  double sumlog=0;
328  double mu=bcone->muscale;
329  int nn=bcone->nn;
330  double *us=bcone->us;
331 
332  DSDPFunctionBegin;
333  if (bcone->nn<1) return 0;
334  for (i=0;i<nn;i++){
335  sumlog+= mu*log(us[i]);
336  }
337  *logdet=sumlog;
338  *logobj=0;
339  DSDPFunctionReturn(0);
340 }
341 
342 #undef __FUNCT__
343 #define __FUNCT__ "BConeSparsity"
344 static int BConeSparsity(void *dcone,int row, int *tnnz, int rnnz[], int m){
345  DSDPFunctionBegin;
346  *tnnz=1;rnnz[row]++;
347  DSDPFunctionReturn(0);
348 }
349 
350 
351 #undef __FUNCT__
352 #define __FUNCT__ "BConeMonitor"
353 static int BConeMonitor(void *dcone,int di){
354  DSDPFunctionBegin;
355  DSDPFunctionReturn(0);
356 }
357 
358 
359 #undef __FUNCT__
360 #define __FUNCT__ "LPANorm2"
361 static int LPANorm2( void *dcone, DSDPVec ANorm){
362  BCone bcone=(BCone)dcone;
363  int *ib=bcone->ib, nn=bcone->nn;
364  double *u=bcone->u;
365  double yy=1.0,cnorm2=0;
366  int i,ii,info;
367  DSDPFunctionBegin;
368  for (i=0;i<nn;i++){
369  ii=ib[i]; yy=1.0;
370  info=DSDPVecAddElement(ANorm,ii,yy);
371  yy=u[i]; cnorm2+=yy*yy;
372  }
373  info=DSDPVecAddC(ANorm,cnorm2);
374  info=DSDPVecAddR(ANorm,bcone->r*bcone->nn);
375  DSDPFunctionReturn(0);
376 }
377 
378 
379 #undef __FUNCT__
380 #define __FUNCT__ "BConeView"
381 int BConeView(BCone bcone){
382  int i,ii;
383  int *ib=bcone->ib, nn=bcone->nn;
384  double *au=bcone->au,*u=bcone->u;
385  DSDPFunctionBegin;
386  BConeValid(bcone);
387  ib=bcone->ib; nn=bcone->nn;
388  au=bcone->au; u=bcone->u;
389  for (i=0;i<nn;i++){
390  ii=ib[i];
391  if (au[i]>0){
392  printf("Upper Bound. Var %d: %4.8e\n",ii,u[i]);
393  } else {
394  printf("Lower Bound. Var %d: %4.8e\n",ii,u[i]);
395  }
396  }
397  DSDPFunctionReturn(0);
398 }
399 
400 
401 static struct DSDPCone_Ops kops;
402 static const char *bconename="VariableBounds Cone";
403 
404 #undef __FUNCT__
405 #define __FUNCT__ "BConeOperationsInitialize"
406 static int BConeOperationsInitialize(struct DSDPCone_Ops* coneops){
407  int info;
408  if (coneops==NULL) return 0;
409  info=DSDPConeOpsInitialize(coneops); DSDPCHKERR(info);
410  coneops->conehessian=BConeHessian;
411  coneops->conerhs=BConeRHS;
412  coneops->conesetup=BConeSetup;
413  coneops->conesetup2=BConeSetup2;
414  coneops->conedestroy=BConeDestroy;
415  coneops->conecomputes=BConeS;
416  coneops->coneinverts=BConeSInvert;
417  coneops->conecomputex=BConeX;
418  coneops->conesetxmaker=BConeSetX;
419  coneops->conemaxsteplength=BConeComputeMaxStepLength;
420  coneops->conelogpotential=BConePotential;
421  coneops->conesize=BConeSize;
422  coneops->conemonitor=BConeMonitor;
423  coneops->conesparsity=BConeSparsity;
424  coneops->conehmultiplyadd=BConeMultiply;
425  coneops->coneanorm2=LPANorm2;
426  coneops->id=2;
427  coneops->name=bconename;
428  return 0;
429 }
430 
431 #undef __FUNCT__
432 #define __FUNCT__ "DSDPAddBounds"
433 int DSDPAddBounds(DSDP dsdp,BCone bcone){
434  int info;
435  DSDPFunctionBegin;
436  BConeValid(bcone);
437  info=BConeOperationsInitialize(&kops); DSDPCHKERR(info);
438  info=DSDPAddCone(dsdp,&kops,(void*)bcone); DSDPCHKERR(info);
439  DSDPFunctionReturn(0);
440 }
441 
442 #undef __FUNCT__
443 #define __FUNCT__ "DSDPCreateBCone"
467 int DSDPCreateBCone(DSDP dsdp, BCone *dspcone){
468  int m,info;
469  struct BCone_C *bcone;
470  DSDPFunctionBegin;
471  if (!dsdp){DSDPFunctionReturn(1);}
472  DSDPCALLOC1(&bcone,struct BCone_C,&info);DSDPCHKERR(info);
473  bcone->keyid=BKEY;
474  *dspcone=bcone;
475  /* info=DSDPAddBounds(dsdp,bcone);DSDPCHKERR(info); */
476  info=BConeOperationsInitialize(&kops); DSDPCHKERR(info);
477  info=DSDPAddCone(dsdp,&kops,(void*)bcone); DSDPCHKERR(info);
478  info=DSDPGetNumberOfVariables(dsdp,&m);DSDPCHKERR(info);
479  bcone->nn=0;
480  bcone->m=m;
481  bcone->muscale=1.0;
482  bcone->r=1.0;
483  bcone->nnmax=0;
484  bcone->xuout=0;
485  DSDPFunctionReturn(0);
486 }
487 
488 
489 #undef __FUNCT__
490 #define __FUNCT__ "BConeScaleBarrier"
491 int BConeScaleBarrier(BCone bcone,double muscale){
492  DSDPFunctionBegin;
493  BConeValid(bcone);
494  if (muscale>0){
495  bcone->muscale=muscale;
496  }
497  DSDPFunctionReturn(0);
498 }
499 
500 #undef __FUNCT__
501 #define __FUNCT__ "BConeCopyX"
517 int BConeCopyX(BCone bcone,double xl[], double xu[], int m){
518  int i,ii,*ib,nn;
519  double *xx,*au;
520  DSDPFunctionBegin;
521  BConeValid(bcone);
522  if (m!=bcone->m){ DSDPSETERR1(6,"Invalid Array Length.\n",bcone->m);}
523  xx=bcone->ux; au=bcone->au; nn=bcone->nn; ib=bcone->ib;
524  for (i=0;i<m;i++){
525  xl[i]=0;xu[i]=0;
526  }
527  for (i=0;i<nn;i++){
528  ii=ib[i]-1;
529  if (au[i]<0){
530  xl[ii]+=xx[i];
531  } else {
532  xu[ii]+=xx[i];
533  }
534  }
535  DSDPFunctionReturn(0);
536 }
537 #undef __FUNCT__
538 #define __FUNCT__ "BConeSetBound"
539 int BConeSetBound(BCone bcone,int vari, double ai, double bound){
540  int spot,info;
541  DSDPFunctionBegin;
542  BConeValid(bcone);
543  if (vari<1 || vari>bcone->m){ DSDPSETERR2(6,"Invalid Variable number 1 <= %d <= %d.\n",vari,bcone->m);}
544  if (bcone->nn>=bcone->nnmax){
545  DSDPLogInfo(0,19,"REALLOCATING SPACE FOR BOUNDS! %d \n",bcone->nnmax);
546  info=BConeAllocateBounds(bcone,2*bcone->nn+4);DSDPCHKERR(info);
547  }
548  spot=bcone->nn;
549  bcone->u[spot]=bound;
550  bcone->au[spot]=ai;
551  bcone->ib[spot]=vari;
552  bcone->nn++;
553  DSDPFunctionReturn(0);
554 }
555 
556 #undef __FUNCT__
557 #define __FUNCT__ "BConeSetLowerBound"
566 int BConeSetLowerBound(BCone bcone,int vari, double lbound){
567  int info;
568  DSDPFunctionBegin;
569  info=BConeSetBound(bcone,vari,-1.0,-lbound);DSDPCHKERR(info);
570  DSDPFunctionReturn(0);
571 }
572 
573 #undef __FUNCT__
574 #define __FUNCT__ "BConeSetUpperBound"
583 int BConeSetUpperBound(BCone bcone,int vari, double ubound){
584  int info;
585  DSDPFunctionBegin;
586  info=BConeSetBound(bcone,vari,1.0,ubound);DSDPCHKERR(info);
587  DSDPFunctionReturn(0);
588 }
589 
590 #undef __FUNCT__
591 #define __FUNCT__ "BConeSetPSlackVariable"
607 int BConeSetPSlackVariable(BCone bcone,int vari){
608  int info;
609  DSDPFunctionBegin;
610  info=BConeSetUpperBound(bcone,vari,0);DSDPCHKERR(info);
611  DSDPFunctionReturn(0);
612 }
613 
614 #undef __FUNCT__
615 #define __FUNCT__ "BConeSetPSurplusVariable"
624 int BConeSetPSurplusVariable(BCone bcone,int vari){
625  int info;
626  DSDPFunctionBegin;
627  info=BConeSetLowerBound(bcone,vari,0);DSDPCHKERR(info);
628  DSDPFunctionReturn(0);
629 }
630 
631 #undef __FUNCT__
632 #define __FUNCT__ "BConeAllocateBounds"
645 int BConeAllocateBounds(BCone bcone, int nnz){
646  int j,info,*uindex;
647  double *uu,*au;
648 
649  DSDPFunctionBegin;
650  BConeValid(bcone);
651  if (nnz<=bcone->nnmax){DSDPFunctionReturn(0);}
652  DSDPCALLOC2(&uu,double,(nnz),&info); DSDPCHKERR(info);
653  DSDPCALLOC2(&au,double,(nnz),&info); DSDPCHKERR(info);
654  DSDPCALLOC2(&uindex,int,(nnz),&info); DSDPCHKERR(info);
655  for (j=0;j<nnz;j++){uu[j]=0; uindex[j]=0; au[j]=0;}
656  if (bcone->nnmax>0){
657  for (j=0;j<bcone->nn;j++){uu[j]=bcone->u[j];}
658  for (j=0;j<bcone->nn;j++){uindex[j]=bcone->ib[j];}
659  for (j=0;j<bcone->nn;j++){au[j]=bcone->au[j];}
660  DSDPFREE(&bcone->u,&info);DSDPCHKERR(info);
661  DSDPFREE(&bcone->au,&info);DSDPCHKERR(info);
662  DSDPFREE(&bcone->ib,&info);DSDPCHKERR(info);
663  } else {
664  bcone->nn=0;
665  }
666  bcone->nnmax=nnz;
667  bcone->u=uu;
668  bcone->au=au;
669  bcone->ib=uindex;
670  DSDPFunctionReturn(0);
671 }
672 
673 #undef __FUNCT__
674 #define __FUNCT__ "BConeSetXArray"
675 int BConeSetXArray(BCone bcone,double *xuout, int n){
676  DSDPFunctionBegin;
677  BConeValid(bcone);
678  if (n==bcone->nn) bcone->xuout=xuout;
679  DSDPFunctionReturn(0);
680 }
681 
The API to DSDP for those applications using DSDP as a subroutine library.
struct BCone_C * BCone
The BCone object points to lower and upper bounds on the variable y in (D).
Definition: dsdp5.h:28
DSDPDualFactorMatrix
DSDP requires two instances of the data structures S.
@ PRIMAL_FACTOR
@ DUAL_FACTOR
DSDPTruth
Boolean variables.
@ DSDP_FALSE
@ DSDP_TRUE
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.
int DSDPSchurMatAddR(DSDPSchurMat, int, double)
Add an element to the Schur matrix correponding the variable r.
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 BConeCopyX(BCone bcone, double xl[], double xu[], int m)
Copy the variables into arrays.
Definition: dbounds.c:517
int BConeSetUpperBound(BCone bcone, int vari, double ubound)
Set an upper bound on a variable y.
Definition: dbounds.c:583
int BConeSetLowerBound(BCone bcone, int vari, double lbound)
Set a lower bound on a variable y.
Definition: dbounds.c:566
int DSDPCreateBCone(DSDP dsdp, BCone *dspcone)
Create a new cone that represents bounds on the y variables.
Definition: dbounds.c:467
int BConeSetPSurplusVariable(BCone bcone, int vari)
Set a surplus variable in constraint in (P).
Definition: dbounds.c:624
int BConeAllocateBounds(BCone bcone, int nnz)
Set a surplus variable in constraint in (P).
Definition: dbounds.c:645
int BConeSetPSlackVariable(BCone bcone, int vari)
Set a slack variable to a constraint in (P).
Definition: dbounds.c:607
int DSDPGetNumberOfVariables(DSDP dsdp, int *m)
Copy the number of variables y.
Definition: dsdpsetdata.c:707
Schur complement matrix whose solution is the Newton direction.
Definition: dsdpschurmat.h:35
Internal structures for the DSDP solver.
Definition: dsdp.h:65