24 #define __FUNCT__ "DSDPSetDualObjective" 29 if (i>dsdp->m || i<=0){
30 DSDPSETERR2(1,
"Invalid variable number: Is 1 <= %d <= %d?\n",i,dsdp->m);}
31 info=DSDPVecSetElement(dsdp->b,i,bi);DSDPCHKERR(info);
32 DSDPFunctionReturn(0);
45 #define __FUNCT__ "DSDPCopyB" 51 if (dsdp->m < m) DSDPFunctionReturn(1);
52 info=DSDPVecGetArray(dsdp->b,&b);DSDPCHKERR(info);
53 for (i=0;i<m;i++) bb[i]=b[i+1];
54 info=DSDPVecRestoreArray(dsdp->b,&b);DSDPCHKERR(info);
55 DSDPFunctionReturn(0);
76 #define __FUNCT__ "DSDPSetY0" 78 int info;
double scale;
81 if (i>dsdp->m || i<=0){
82 DSDPSETERR2(1,
"Invalid variable number: Is 1<= %d <= %d\n",i,dsdp->m);}
84 info=DSDPVecSetElement(dsdp->y,i,scale*yi0);DSDPCHKERR(info);
85 DSDPFunctionReturn(0);
99 #define __FUNCT__ "DSDPGetY" 105 if (dsdp->m < m-1) DSDPFunctionReturn(1);
106 if (dsdp->m > m) DSDPFunctionReturn(1);
107 info=DSDPVecCopy(dsdp->xmaker[0].y,dsdp->ytemp); DSDPCHKERR(info);
109 info=DSDPVecGetArray(dsdp->ytemp,&yy);DSDPCHKERR(info);
110 for (i=0;i<m;i++) y[i]=yy[i+1]/scale;
111 info=DSDPVecRestoreArray(dsdp->ytemp,&yy);DSDPCHKERR(info);
112 DSDPFunctionReturn(0);
127 #define __FUNCT__ "DSDPGetScale" 129 int info;
double sscale;
132 info=DSDPVecGetC(dsdp->y,&sscale);DSDPCHKERR(info);
134 if (sscale==0) *scale=1.0;
135 DSDPFunctionReturn(0);
152 #define __FUNCT__ "DSDPSetScale" 154 int info;
double sscale;
158 if (scale==0) scale=1.0;
161 info=DSDPVecScale(sscale,dsdp->y);
162 dsdp->mutarget*=sscale;
168 DSDPLogInfo(0,2,
"Set DSDP C Scaling: %4.4e\n",scale);
169 DSDPFunctionReturn(0);
184 #define __FUNCT__ "DSDPAddObjectiveConstant" 189 info=DSDPVecSetC(dsdp->b,-c);DSDPCHKERR(info);
190 DSDPLogInfo(0,2,
"Add Objective Constant: %4.4e\n",c);
191 DSDPFunctionReturn(0);
205 #define __FUNCT__ "DSDPSetMaxIts" 209 if (its >= 0) dsdp->maxiter = its;
210 DSDPLogInfo(0,2,
"Set Maximum Iterates: %4d\n",its);
211 DSDPFunctionReturn(0);
224 #define __FUNCT__ "DSDPGetMaxIts" 229 DSDPFunctionReturn(0);
245 #define __FUNCT__ "DSDPSetMaxTrustRadius" 249 if (rad > 0) dsdp->maxtrustradius = rad;
250 DSDPLogInfo(0,2,
"Set Maximum Trust Radius: %4.4e\n",rad);
251 DSDPFunctionReturn(0);
264 #define __FUNCT__ "DSDPGetMaxTrustRadius" 268 *rad=dsdp->maxtrustradius;
269 DSDPFunctionReturn(0);
282 #define __FUNCT__ "DSDPSetZBar" 289 dsdp->ppobj=ppobj*scale;
290 DSDPLogInfo(0,2,
"Set Primal Objective and Upper bound on solution: %4.4e. \n",ppobj);
291 DSDPFunctionReturn(0);
310 #define __FUNCT__ "DSDPSetR0" 317 info=
DSDPSetRR(dsdp,scale*res); DSDPCHKERR(info);
319 DSDPLogInfo(0,2,
"Set Dual Initial Infeasibility to %4.4e times Identity Matrix. \n",res);
320 DSDPFunctionReturn(0);
339 #define __FUNCT__ "DSDPSetBarrierParameter" 341 int info;
double scale;
345 dsdp->mutarget = mu*scale;
346 DSDPLogInfo(0,2,
"Set InitialBarrierParameter: %4.4e \n",mu);
347 DSDPFunctionReturn(0);
363 #define __FUNCT__ "DSDPGetBarrierParameter" 365 int info;
double scale;
368 *mu=dsdp->mutarget/scale;
369 DSDPFunctionReturn(0);
382 #define __FUNCT__ "DSDPUsePenalty" 384 DSDPPenalty UsePenalty;
389 UsePenalty=DSDPAlways;
390 }
else if (yesorno<0){
391 UsePenalty=DSDPNever;
393 UsePenalty=DSDPInfeasible;
395 dsdp->UsePenalty=UsePenalty;
396 info=RConeSetType(dsdp->rcone,UsePenalty);DSDPCHKERR(info);
397 DSDPLogInfo(0,2,
"Set UsePenalty: %d \n",yesorno);
398 DSDPFunctionReturn(0);
417 #define __FUNCT__ "DSDPSetPenaltyParameter" 420 double scale,ppenalty;
424 ppenalty=fabs(Gamma*scale);
425 info=DSDPVecSetR(dsdp->b,ppenalty);DSDPCHKERR(info);
426 DSDPLogInfo(0,2,
"Set Penalty Parameter: %4.4e\n",Gamma);
427 DSDPFunctionReturn(0);
442 #define __FUNCT__ "DSDPGetPenaltyParameter" 448 info=DSDPVecGetR(dsdp->b,&ppenalty);DSDPCHKERR(info);
449 *Gamma=fabs(ppenalty);
450 DSDPFunctionReturn(0);
456 #define __FUNCT__ "DSDPGetPenalty" 457 int DSDPGetPenalty(
DSDP dsdp,
double *penalty){
458 int info;
double ppenalty;
461 info=DSDPVecGetR(dsdp->b,&ppenalty);DSDPCHKERR(info);
462 *penalty=fabs(ppenalty);
463 DSDPFunctionReturn(0);
478 #define __FUNCT__ "DSDPGetPPObjective" 485 *ppobj=(dsdp->ppobj)/scale;
486 if (dsdp->cnorm==0) *ppobj=0;
487 DSDPFunctionReturn(0);
501 #define __FUNCT__ "DSDPGetDObjective" 503 int info;
double scale;
507 *dobj = (dsdp->dobj)/scale;
508 if (dsdp->cnorm==0) *dobj=-fabs(*dobj);
509 DSDPFunctionReturn(0);
522 #define __FUNCT__ "DSDPGetDDObjective" 524 int info;
double scale;
528 *ddobj = (dsdp->ddobj)/scale;
529 if (dsdp->cnorm==0) *ddobj=-fabs(*ddobj);
530 DSDPFunctionReturn(0);
544 #define __FUNCT__ "DSDPGetDualityGap" 546 int info;
double scale;
550 *dgap = (dsdp->dualitygap)/scale;
551 DSDPFunctionReturn(0);
563 #define __FUNCT__ "DSDPGetIts" 568 DSDPFunctionReturn(0);
581 #define __FUNCT__ "DSDPStopReason" 585 *reason=dsdp->reason;
586 DSDPFunctionReturn(0);
600 #define __FUNCT__ "DSDPGetR" 602 int info;
double rr,scale;
605 info=
DSDPGetRR(dsdp,&rr);DSDPCHKERR(info);
608 DSDPFunctionReturn(0);
620 #define __FUNCT__ "DSDPGetDataNorms" 628 dnorm[0]=dsdp->cnorm;
629 dnorm[1]=dsdp->anorm;
630 dnorm[2]=dsdp->bnorm;
631 DSDPFunctionReturn(0);
644 #define __FUNCT__ "DSDPGetMaxYElement" 649 DSDPFunctionReturn(0);
653 #define __FUNCT__ "DSDPGetDimension" 665 DSDPFunctionReturn(0);
677 #define __FUNCT__ "DSDPGetYMaxNorm" 683 info=DSDPVecGetC(dsdp->y,&cc);DSDPCHKERR(info);
684 info=DSDPVecGetR(dsdp->y,&rr);DSDPCHKERR(info);
685 info=DSDPVecSetC(dsdp->y,0);DSDPCHKERR(info);
686 info=DSDPVecSetR(dsdp->y,0);DSDPCHKERR(info);
687 info=DSDPVecNormInfinity(dsdp->y,&yy);DSDPCHKERR(info);
688 info=DSDPVecSetC(dsdp->y,cc);DSDPCHKERR(info);
689 info=DSDPVecSetR(dsdp->y,rr);DSDPCHKERR(info);
690 if (cc) yy/=fabs(cc);
691 if (ynorm) *ynorm=yy;
692 DSDPFunctionReturn(0);
706 #define __FUNCT__ "DSDPGetNumberOfVariables" 711 DSDPFunctionReturn(0);
723 #define __FUNCT__ "DSDPGetPnorm" 728 DSDPFunctionReturn(0);
741 #define __FUNCT__ "DSDPGetStepLengths" 747 DSDPFunctionReturn(0);
764 #define __FUNCT__ "DSDPSetPotentialParameter" 768 if (rho>1) dsdp->rhon=rho;
769 DSDPLogInfo(0,2,
"Set Potential Parameter %4.4f\n",rho);
770 DSDPFunctionReturn(0);
783 #define __FUNCT__ "DSDPGetPotentialParameter" 788 DSDPFunctionReturn(0);
802 #define __FUNCT__ "DSDPGetPotential" 806 *potential=dsdp->potential;
807 DSDPFunctionReturn(0);
820 #define __FUNCT__ "DSDPUseDynamicRho" 826 DSDPLogInfo(0,2,
"Set UseDynamicRho: %d \n",yesorno);
827 DSDPFunctionReturn(0);
833 #define __FUNCT__ "DSDPBoundDualVariables" 844 int DSDPBoundDualVariables(
DSDP dsdp,
double lbound,
double ubound){
848 bbound=DSDPMax(fabs(lbound),fabs(ubound));
849 DSDPLogInfo(0,2,
"Bound Variables between %4.4e and %4.4e \n",-bbound,bbound);
851 DSDPFunctionReturn(0);
865 #define __FUNCT__ "DSDPGetYBounds" 870 DSDPFunctionReturn(0);
884 #define __FUNCT__ "DSDPSetYBounds" 889 DSDPFunctionReturn(0);
904 #define __FUNCT__ "DSDPReuseMatrix" 909 DSDPLogInfo(0,2,
"Reuse the Schur Matrix: %d times\n",rm);
910 DSDPFunctionReturn(0);
924 #define __FUNCT__ "DSDPGetReuseMatrix" 929 DSDPFunctionReturn(0);
944 #define __FUNCT__ "DSDPSetMonitor" 948 if (dsdp->nmonitors<MAX_DSDP_MONITORS){
949 DSDPLogInfo(0,2,
"Set Monitor\n");
950 dsdp->dmonitor[dsdp->nmonitors].monitor=monitor;
951 dsdp->dmonitor[dsdp->nmonitors].monitorctx=monitorctx;
954 DSDPFunctionReturn(0);
967 #define __FUNCT__ "DSDPSetConvergenceFlag" 973 DSDPLogInfo(0,2,
"Initial Point Infeasible, Check variable bounds? \n",0);
975 DSDPFunctionReturn(0);
int DSDPSetBarrierParameter(DSDP dsdp, double mu)
Set the current barrier parameter.
int DSDPGetStepLengths(DSDP dsdp, double *pstep, double *dstep)
Copy the step sizes in the current iteration.
int DSDPGetBarrierParameter(DSDP dsdp, double *mu)
Copy the current barrier parameter.
int DSDPGetPPObjective(DSDP dsdp, double *ppobj)
Copy the objective value (PP).
int DSDPAddObjectiveConstant(DSDP dsdp, double c)
Add a constant to the objective.
int DSDPGetPenaltyParameter(DSDP dsdp, double *Gamma)
Copy the penalty parameter Gamma.
Error handling, printing, and profiling.
int DSDPSetZBar(DSDP dsdp, double ppobj)
Set an upper bound on the objective value at the solution.
int DSDPSetDualObjective(DSDP dsdp, int i, double bi)
Set the objective vector b in (D).
int DSDPSetScale(DSDP dsdp, double scale)
Set the internal scaling factor.
int DSDPUseDynamicRho(DSDP dsdp, int yesorno)
Use a dynamic strategy to choose parameter rho.
int DSDPGetPnorm(DSDP dsdp, double *pnorm)
Copy the proximity of the solution to the central path.
Internal structures for the DSDP solver.
DSDPTerminationReason
There are many reasons to terminate the solver.
int DSDPSetRR(DSDP, double)
Set variable r.
int DSDPGetDataNorms(DSDP dsdp, double dnorm[3])
Copy the norms of the data C, A, and b into an array.
The API to DSDP for those applications using DSDP as a subroutine library.
int DSDPSetMonitor(DSDP dsdp, int(*monitor)(DSDP, void *), void *monitorctx)
Monitor each iteration of the solver.
int DSDPSetMaxTrustRadius(DSDP dsdp, double rad)
Set a maximum trust radius on the step direction.
int DSDPComputeDataNorms(DSDP)
Compute norms of A,C, and b.
int DSDPGetDimension(DSDP dsdp, double *n)
Copy the dimension of the cones, or the number of constraints in (D).
int DSDPReuseMatrix(DSDP dsdp, int rm)
Reuse the Hessian of the barrier function multiple times at each DSDP iteration.
int DSDPSetPenaltyParameter(DSDP dsdp, double Gamma)
Set the penalty parameter Gamma.
Internal data structure for the DSDP solver.
int DSDPGetReuseMatrix(DSDP dsdp, int *rm)
Copy this parameter.
int DSDPGetConicDimension(DSDP, double *)
Get the total dimension of the cones.
int DSDPGetMaxTrustRadius(DSDP dsdp, double *rad)
Copy the current radius of the trust region.
int DSDPGetDObjective(DSDP dsdp, double *dobj)
Copy the objective value (D).
int DSDPGetPotential(DSDP dsdp, double *potential)
Copy the potential of the current solution.
int DSDPSetPotentialParameter(DSDP dsdp, double rho)
Set the potential parameter.
int DSDPStopReason(DSDP dsdp, DSDPTerminationReason *reason)
Copy the reason why the solver terminated.
int DSDPSetY0(DSDP dsdp, int i, double yi0)
Set the initial values of variables y in (D).
int DSDPGetIts(DSDP dsdp, int *its)
Copy the current iteration number.
int DSDPGetRR(DSDP, double *)
Get variable r.
int DSDPGetYMaxNorm(DSDP dsdp, double *ynorm)
Copy the the infinity norm of the variables y.
int DSDPGetY(DSDP dsdp, double y[], int m)
Copies the variables y into an array.
int DSDPGetNumberOfVariables(DSDP dsdp, int *m)
Copy the number of variables y.
int DSDPUsePenalty(DSDP dsdp, int yesorno)
Use penalty parameter to enforce feasibility.
int DSDPGetDDObjective(DSDP dsdp, double *ddobj)
Copy the objective value (DD).
int DSDPGetR(DSDP dsdp, double *res)
Copy the infeasibility in (D), or the variable r in (DD).
int DSDPGetScale(DSDP dsdp, double *scale)
Copy the internal scaling factor from the solver.
int DSDPGetMaxIts(DSDP dsdp, int *its)
Copy the maximum number of iterations from the solver.
int DSDPGetDualityGap(DSDP dsdp, double *dgap)
Copy the difference between the objective values.
int DSDPSetYBounds(DSDP dsdp, double lbound, double ubound)
Bound the variables y.
int BoundYConeSetBounds(LUBounds lucone, double lb, double ub)
Set bounds on the variables.
int DSDPGetPotentialParameter(DSDP dsdp, double *rho)
Copy the potential parameter.
int DSDPGetYBounds(DSDP dsdp, double *lbound, double *ubound)
Copy the bounds on the variables y.
int BoundYConeGetBounds(LUBounds lucone, double *lb, double *ub)
Get bounds on the variables.
int DSDPSetConvergenceFlag(DSDP dsdp, DSDPTerminationReason reason)
Monitor each iteration of the solver.
int DSDPCopyB(DSDP dsdp, double bb[], int m)
Copies the variables b from solver into an array.
int DSDPSetR0(DSDP dsdp, double res)
Set an initial value for the variable r in (DD)
int DSDPSetMaxIts(DSDP dsdp, int its)
Terminate the solver after this number of iterations.
int DSDPGetMaxYElement(DSDP dsdp, double *ymax)
Copy the the infinity norm of the variables y.