20 #define __FUNCT__ "DSDPComputeObjective"
24 info = DSDPVecDot(Y,dsdp->b,ddobj);DSDPCHKERR(info);
25 DSDPFunctionReturn(0);
44 #define __FUNCT__ "DSDPComputeDY"
47 double ppnorm,ddy1=fabs(1.0/mu*dsdp->schurmu),ddy2=-1.0;
50 info=DSDPVecWAXPBY(DY,ddy1,dsdp->dy1,ddy2,dsdp->dy2);DSDPCHKERR(info);
53 DSDPLogInfo(0,2,
"Problem with PNORM: %4.4e < 0 \n",ppnorm);
57 DSDPFunctionReturn(0);
76 #define __FUNCT__ "DSDPComputePDY"
79 double ppnorm,ddy1=-fabs(1.0/mu*dsdp->schurmu),ddy2=1.0;
82 info=DSDPVecWAXPBY(DY,ddy1,dsdp->dy1,ddy2,dsdp->dy2);DSDPCHKERR(info);
85 DSDPLogInfo(0,2,
"Problem with PNORM: %4.4e < 0 \n",ppnorm);
89 DSDPFunctionReturn(0);
104 #define __FUNCT__ "DSDPComputePDY1"
107 double ddy1=-fabs(mur*dsdp->schurmu);
109 info=DSDPVecScaleCopy(dsdp->dy1,ddy1,DY1); DSDPCHKERR(info);
110 DSDPFunctionReturn(0);
124 #define __FUNCT__ "DSDPComputeNewY"
129 info=DSDPVecWAXPY(Y,beta,dsdp->dy,dsdp->y);DSDPCHKERR(info);
130 info=DSDPVecGetR(Y,&rtemp);DSDPCHKERR(info);
131 rtemp=DSDPMin(0,rtemp);
133 info=DSDPVecSetR(Y,rtemp);DSDPCHKERR(info);
134 info=DSDPApplyFixedVariables(dsdp->M,Y);DSDPCHKERR(info);
135 DSDPFunctionReturn(0);
149 #define __FUNCT__ "DSDPComputePY"
153 info=DSDPVecWAXPY(PY,beta,dsdp->dy,dsdp->y);DSDPCHKERR(info);
154 info=DSDPApplyFixedVariables(dsdp->M,PY);DSDPCHKERR(info);
155 DSDPFunctionReturn(0);
176 #define __FUNCT__ "DSDPComputeRHS"
179 double ddrhs1=1.0/mu*dsdp->schurmu,ddrhs2=-( mu/fabs(mu) );
181 info=DSDPVecWAXPBY(RHS,ddrhs1,dsdp->rhs1,ddrhs2,dsdp->rhs2);DSDPCHKERR(info);
182 DSDPFunctionReturn(0);
186 #define __FUNCT__ "DSDPComputePNorm"
205 info = DSDPVecDot(dsdp->rhs,DY,&ppnorm);DSDPCHKERR(info);
206 ppnorm/=dsdp->schurmu;
210 DSDPLogInfo(0,2,
"Problem with PNORM: %4.4e is not positive.\n",ppnorm);
213 if (*pnorm!=*pnorm){DSDPSETERR1(1,
"Problem with PNORM: %4.4e is not positive.\n",ppnorm);}
214 DSDPFunctionReturn(0);
229 #define __FUNCT__ "DSDPComputeDualityGap"
232 double newgap=0,pnorm;
233 double smu=1.0/dsdp->schurmu;
235 info=
DSDPComputeDY(dsdp,mu,dsdp->dy,&pnorm); DSDPCHKERR(info);
236 info=DSDPVecDot(dsdp->dy,dsdp->rhs2,&newgap);DSDPCHKERR(info);
237 newgap = (newgap*smu+dsdp->np)*mu;
239 DSDPLogInfo(0,2,
"GAP :%4.4e<0: Problem\n",newgap);
241 DSDPLogInfo(0,2,
"Duality Gap: %12.8e, Update primal objective: %12.8e\n",newgap,dsdp->ddobj+newgap);
243 newgap=DSDPMax(0,newgap);
245 DSDPFunctionReturn(0);
260 #define __FUNCT__ "DSDPComputePotential"
263 double dpotential,gap,ddobj;
266 gap=dsdp->ppobj-ddobj;
267 if (gap>0) dpotential=dsdp->rho*log(gap)-logdet;
268 else {dpotential=dsdp->potential+1;}
269 *potential=dpotential;
270 DSDPLogInfo(0,9,
"Gap: %4.4e, Log Determinant: %4.4e, Log Gap: %4.4e\n",gap,logdet,log(gap));
271 DSDPFunctionReturn(0);
286 #define __FUNCT__ "DSDPComputePotential2"
292 *potential=-(ddobj + mu*logdet)*dsdp->schurmu;
293 *potential=-(ddobj/mu + logdet)*dsdp->schurmu;
294 DSDPFunctionReturn(0);
308 #define __FUNCT__ "DSDPSetY"
313 info=DSDPVecGetR(dsdp->y,&r1);DSDPCHKERR(info);
314 info=DSDPVecGetR(ynew,&r2);DSDPCHKERR(info);
315 if (r2==0&&r1!=0){dsdp->rflag=1;}
else {dsdp->rflag=0;};
316 info=DSDPVecCopy(ynew,dsdp->y);DSDPCHKERR(info);
319 if (dsdp->ppobj<=dsdp->ddobj){
320 dsdp->ppobj=dsdp->ddobj+2*dsdp->mu * dsdp->np;
321 DSDPLogInfo(0,2,
"Primal Objective Not Right. Assigned: %8.8e\n",dsdp->ppobj);
323 info=DSDPVecGetR(ynew,&rr);DSDPCHKERR(info);
324 info=DSDPVecGetR(dsdp->b,&pp);DSDPCHKERR(info);
325 dsdp->dobj=dsdp->ddobj-rr*pp;
326 DSDPLogInfo(0,2,
"Duality Gap: %4.4e, Potential: %4.4e \n",dsdp->dualitygap,dsdp->potential);
327 dsdp->dualitygap=dsdp->ppobj-dsdp->ddobj;
328 dsdp->mu=(dsdp->dualitygap)/(dsdp->np);
332 DSDPLogInfo(0,2,
"Duality Gap: %4.4e, Potential: %4.4e \n",dsdp->dualitygap,dsdp->potential);
333 DSDPFunctionReturn(0);
338 #define __FUNCT__ "DSDPSetRR"
349 info=DSDPVecSetR(dsdp->y,-res);DSDPCHKERR(info);
350 DSDPFunctionReturn(0);
354 #define __FUNCT__ "DSDPGetRR"
365 info=DSDPVecGetR(dsdp->y,res);DSDPCHKERR(info);
368 DSDPFunctionReturn(0);
373 #define __FUNCT__ "DSDPObjectiveGH"
386 info=DSDPVecGetSize(vrhs1,&m); DSDPCHKERR(info);
390 info=DSDPVecGetElement(dsdp->b,i,&rtemp);DSDPCHKERR(info);
391 info=DSDPVecAddElement(vrhs1,i,rtemp);DSDPCHKERR(info);
394 DSDPFunctionReturn(0);
398 #define __FUNCT__ "DSDPCheckForUnboundedObjective"
399 int DSDPCheckForUnboundedObjective(
DSDP dsdp,
DSDPTruth *unbounded){
405 info = DSDPVecDot(dsdp->b,dsdp->dy2,&dtemp);DSDPCHKERR(info);
406 if ( dtemp < 0 /* && dsdp->r==0 && dsdp->ddobj > 0 */) {
407 info = DSDPVecScaleCopy(dsdp->dy2,-1.0,dsdp->ytemp); DSDPCHKERR(info);
414 info=DSDPVecScale(2.0,dsdp->ytemp); DSDPCHKERR(info);
416 info = DSDPVecCopy(dsdp->ytemp,dsdp->y); DSDPCHKERR(info);
419 info = DSDPVecNormalize(dsdp->y); DSDPCHKERR(info);
423 DSDPFunctionReturn(0);
DSDPTruth
Boolean variables.
struct DSDPVec_C DSDPVec
This object hold m+2 variables: a scaling of C, the y variables, and r.
Schur complement matrix whose solution is the Newton direction.
int DSDPComputeSS(DSDP, DSDPVec, DSDPDualFactorMatrix, DSDPTruth *)
Compute the dual variables S in each cone.
Error handling, printing, and profiling.
int DSDPComputePDY1(DSDP, double, DSDPVec)
Compute an affine step direction dy1.
int DSDPComputeNewY(DSDP, double, DSDPVec)
Update the Y variables.
int DSDPObjectiveGH(DSDP, DSDPSchurMat, DSDPVec)
Compute gradient of dual objective.
Internal structures for the DSDP solver.
int DSDPSetRR(DSDP, double)
Set variable r.
int DSDPComputeDualityGap(DSDP, double, double *)
Compute the current duality gap.
int DSDPComputePY(DSDP, double, DSDPVec)
Compute PY = Y - beta DY for use in computing X.
Internal data structure for the DSDP solver.
int DSDPSaveYForX(DSDP, double, double)
Save the current solution for later computation of X.
int DSDPSetY(DSDP, double, double, DSDPVec)
Update the solver with these y variables.
int DSDPComputeRHS(DSDP, double, DSDPVec)
Compute the right-hand side of the linear system that determines the step direction.
int DSDPComputeDY(DSDP, double, DSDPVec, double *)
Compute the step direction.
int DSDPComputePotential(DSDP, DSDPVec, double, double *)
Compute the potential of the given point.
int DSDPComputeObjective(DSDP, DSDPVec, double *)
Compute the objective function (DD).
int DSDPGetRR(DSDP, double *)
Get variable r.
int DSDPSchurMatSetR(DSDPSchurMat M, double rr)
Set up the data structure.
int DSDPComputePNorm(DSDP, double, DSDPVec, double *)
Compute proximity to a point on the central path.
int DSDPSchurMatVariableCompute(DSDPSchurMat, int, double *)
Determine with the cone should compute this diagonal element of M and RHS.
int DSDPComputePDY(DSDP, double, DSDPVec, double *)
Compute the step direction.
int DSDPComputePotential2(DSDP, DSDPVec, double, double, double *)
Compute the objective function plus the barrier function.