45#define __FUNCT__ "DSDPSetOptions"
49 int maxit,rpos,drho,iloginfo;
50 double penalty,rho,zbar,cc,r0,mu0,gaptol,dbound,dd;
51 double ylow,yhigh,maxtrust,steptol,inftol,infptol,pnormtol;
55 for (kk=0; kk<nargs-1; kk++){
56 if (strncmp(runargs[kk],
"-gaptol",5)==0){
57 gaptol=atof(runargs[kk+1]);
59 }
else if (strncmp(runargs[kk],
"-penalty",7)==0){
60 penalty=atof(runargs[kk+1]);
62 }
else if (strncmp(runargs[kk],
"-bigM",5)==0){
63 rpos=atoi(runargs[kk+1]);
65 }
else if (strncmp(runargs[kk],
"-maxit",6)==0){
66 maxit=atoi(runargs[kk+1]);
68 }
else if (strncmp(runargs[kk],
"-r0",3)==0){
69 r0=atof(runargs[kk+1]);
70 info=
DSDPSetR0(dsdp,r0); DSDPCHKERR(info);
71 }
else if (strncmp(runargs[kk],
"-zbar",5)==0){
72 zbar=atof(runargs[kk+1]);
74 }
else if (strncmp(runargs[kk],
"-infdtol",7)==0){
75 inftol=atof(runargs[kk+1]);
77 }
else if (strncmp(runargs[kk],
"-infptol",7)==0){
78 infptol=atof(runargs[kk+1]);
80 }
else if (strncmp(runargs[kk],
"-rho",4)==0){
81 rho=atof(runargs[kk+1]);
83 }
else if (strncmp(runargs[kk],
"-drho",5)==0){
84 drho=atoi(runargs[kk+1]);
86 }
else if (strncmp(runargs[kk],
"-mu0",4)==0){
87 mu0=atof(runargs[kk+1]);
89 }
else if (strncmp(runargs[kk],
"-maxtrustradius",7)==0){
90 maxtrust=atof(runargs[kk+1]);
92 }
else if (strncmp(runargs[kk],
"-boundy",6)==0){
93 yhigh=fabs(atof(runargs[kk+1]));ylow=-yhigh;
95 }
else if (strncmp(runargs[kk],
"-steptol",7)==0){
96 steptol=fabs(atof(runargs[kk+1]));
98 }
else if (strncmp(runargs[kk],
"-pnormtol",7)==0){
99 pnormtol=fabs(atof(runargs[kk+1]));
101 }
else if (strncmp(runargs[kk],
"-reuse",6)==0){
102 reuse=atoi(runargs[kk+1]);
104 }
else if (strncmp(runargs[kk],
"-dadd",6)==0){
105 cc=atof(runargs[kk+1]);
107 }
else if (strncmp(runargs[kk],
"-dbound",6)==0){
108 dbound=atof(runargs[kk+1]);
110 }
else if (strncmp(runargs[kk],
"-fix",4)==0){
112 }
else if (strncmp(runargs[kk],
"-dobjmin",7)==0){
113 dd=atof(runargs[kk+1]);
114 info = DSDPSetDualLowerBound(dsdp,dd);DSDPCHKERR(info);
115 }
else if (strncmp(runargs[kk],
"-dloginfo",8)==0){
116 iloginfo=atoi(runargs[kk+1]);
117 info=DSDPLogInfoAllow(iloginfo,0);
121 for (kk=0; kk<nargs; kk++){
123 }
else if (strncmp(runargs[kk],
"-help",5)==0){
127 DSDPFunctionReturn(0);
144#define __FUNCT__ "DSDPReadOptions"
148 char thisline[BUFFERSIZ]=
"%",doption[STRLENGTH],dvalue[STRLENGTH];
149 char fargs[2*MAXOPTIONS][STRLENGTH];
150 char *fargs2[2*MAXOPTIONS];
155 for (i=0;i<2*MAXOPTIONS;i++){fargs2[i]=fargs[i];}
157 fp=fopen(filename,
"r");
160 if (line>=MAXOPTIONS)
break;
161 fgets(thisline,BUFFERSIZ,fp);
162 if (sscanf(thisline,
"%s %s",doption,dvalue)>=2){
163 if (doption[0]!=
'%'){
164 strncpy(fargs[2*line],doption,STRLENGTH-1);
165 strncpy(fargs[2*line+1],dvalue,STRLENGTH-1);
175 DSDPFunctionReturn(0);
189#define __FUNCT__ "DSDPView"
192 int info,reuse,m,maxit;
193 double penalty,rho,mu0,gaptol,dnorm[3],derror[6],potential,ymax;
194 double ylow,yhigh,maxtrust,steptol,inftol,infptol,pnormtol,dbound,tracex;
199 printf(
"Terminate DSDP after %d iterations.\n",maxit);
201 printf(
"Terminate DSDP if dual objective is greater than %8.4e\n",dbound);
203 printf(
"Terminate DSDP if the relative duality gap is less than %8.4e\n",gaptol);
205 printf(
"Terminate DSDP if step length in D less than %8.4e\n",steptol);
207 printf(
"Terminate DSDP only if Pnorm less than %8.4e\n",pnormtol);
209 printf(
"Max Trust Radius is %8.4e\n",maxtrust);
211 printf(
"Reapply Hessian of Barrier up to %d times per iteration.\n",reuse);
214 printf(
"The norms of C: %8.4e, A: %4.4e, and b: %8.4e\n",dnorm[0],dnorm[1],dnorm[2]);
216 printf(
"There are %d y variables: ",m);
218 printf(
"largest is %8.4e, ",ymax);
220 printf(
"bounded below by %8.4e and above by %8.4e. \n",ylow,yhigh);
222 printf(
"The X variables have a trace of %8.4e ",tracex);
224 printf(
"bounded by penalty parameter: %8.4e\n",penalty);
226 printf(
"Current Barrier Parameter: %8.4e\n",mu0);
228 printf(
"Potential Parameter: %8.4e ( times dimension) \n",rho);
230 printf(
"The value of the potential function is %8.4e\n",potential);
232 printf(
"(D) Feasible only if R < %8.4e\n",inftol);
234 printf(
"(P) Feasible only if Pinfeas < %8.4e\n",infptol);
237 printf(
" DSDP Solutions are both feasible and bounded\n");
239 printf(
" (D) is unbounded and (P) is infeasible\n");
241 printf(
" (D) is infeasible and (D) is unbounded\n");
243 printf(
" Hmm. Not clear whether either solution is feasible.\n");
246 printf(
"The errors: %8.4e, %4.4e, %8.4e, ",derror[0],derror[1],derror[2]);
247 printf(
"%8.4e, %4.4e, %8.4e\n",derror[3],derror[4],derror[5]);
248 DSDPFunctionReturn(0);
252static char dsdpoptions[]=
"\
253 -gaptol <1e-6> stop when relative duality gap less than \n\
254 -r0 <-1> if nonnegative, initialize S by adding this multiple of the identity matrix \n\
255 -penalty <1e10>< penalize dual infeasibility \n\
256 -boundy <1e7> bound for variables y \n\
257 -maxit <200> set maximum iterates \n\
258 -zbar <1e10> Upper bound for dual solution \n\
259 -mu0 <-1> if positive, set initial barrier parameter \n\
260 -rho <3> Potential parameter as multiple of dimension \n\
261 -drho <1> Use dynamic rho strategy \n\
262 -pnormtol <1e30> stop only if pnorm less than \n\
263 -reuse <4> Reuse the Schur Matrix this many times\n\
264 -dobjmin <> apply a known lower bound for the objective at solution as a constraint. \n\
265 -bigM <0> if positive, modify algorithm to make dual \n\
266 infeasibility positive with a large associated cost \n\
267 -dloginfo <0> - print more information for higher numbers \n\
268 -params <filename> to read selected options from a file \n\
269 -help for this help message\n";
281 printf(
"%s",dsdpoptions);
282 DSDPFunctionReturn(0);
The API to DSDP for those applications using DSDP as a subroutine library.
DSDPSolutionType
Formulations (P) and (D) can be feasible and bounded, feasible and unbounded, or infeasible.
int DSDPGetSolutionType(DSDP dsdp, DSDPSolutionType *pdfeasible)
Solutions can be bounded, infeasible, or unbounded.
int DSDPSetOptions(DSDP dsdp, char *runargs[], int nargs)
Read command line arguments to set options in DSDP.
int DSDPView(DSDP dsdp)
Print many of the parameters currently set in DSDP.
int DSDPGetPNormTolerance(DSDP dsdp, double *ptol)
Get the termination tolerance.
int DSDPGetRTolerance(DSDP dsdp, double *inftol)
Copy the maximum infeasibility allowed (D).
int DSDPSetGapTolerance(DSDP dsdp, double gaptol)
Terminate the solver when the relative duality gap is less than this tolerance.
int DSDPSetPNormTolerance(DSDP dsdp, double ptol)
Terminate the solver when the relative duality gap is suffiently small and the PNorm is less than thi...
int DSDPGetGapTolerance(DSDP dsdp, double *gaptol)
Get the termination tolerance.
int DSDPSetStepTolerance(DSDP dsdp, double steptol)
Terminate the solver if the step length in (DD) is below this tolerance.
int DSDPGetPTolerance(DSDP dsdp, double *inftol)
Copy the feasibility tolerance.
int DSDPSetRTolerance(DSDP dsdp, double inftol)
Classify (D) as feasible only if the variable r is less than this tolerance.
int DSDPSetMaxIts(DSDP dsdp, int its)
Terminate the solver after this number of iterations.
int DSDPSetDualBound(DSDP dsdp, double dbound)
Terminate the solver if the objective value in (DD) is greater than this tolerance.
int DSDPGetDualBound(DSDP dsdp, double *dbound)
Get the termination parameter.
int DSDPGetStepTolerance(DSDP dsdp, double *steptol)
Get the current tolerance.
int DSDPGetMaxIts(DSDP dsdp, int *its)
Copy the maximum number of iterations from the solver.
int DSDPSetPTolerance(DSDP dsdp, double inftol)
Classify (P) as feasible only if the infeasibility is less than this tolerance.
int DSDPGetYMaxNorm(DSDP dsdp, double *ynorm)
Copy the the infinity norm of the variables y.
int DSDPGetTraceX(DSDP dsdp, double *tracex)
Copy the trace of the variables X in (P).
int DSDPAddObjectiveConstant(DSDP dsdp, double c)
Add a constant to the objective.
int DSDPGetFinalErrors(DSDP dsdp, double err[6])
Copy six different error measurements into an array.
int DSDPSetR0(DSDP dsdp, double res)
Set an initial value for the variable r in (DD)
int DSDPGetDataNorms(DSDP dsdp, double dnorm[3])
Copy the norms of the data C, A, and b into an array.
int DSDPGetNumberOfVariables(DSDP dsdp, int *m)
Copy the number of variables y.
int DSDPGetPotential(DSDP dsdp, double *potential)
Copy the potential of the current solution.
int DSDPGetBarrierParameter(DSDP dsdp, double *mu)
Copy the current barrier parameter.
int DSDPGetPotentialParameter(DSDP dsdp, double *rho)
Copy the potential parameter.
int DSDPUsePenalty(DSDP dsdp, int yesorno)
Use penalty parameter to enforce feasibility.
int DSDPSetZBar(DSDP dsdp, double ppobj)
Set an upper bound on the objective value at the solution.
int DSDPSetFixedVariable(DSDP dsdp, int vari, double val)
Fix variable y to exact value.
int DSDPSetBarrierParameter(DSDP dsdp, double mu)
Set the current barrier parameter.
int DSDPSetPotentialParameter(DSDP dsdp, double rho)
Set the potential parameter.
int DSDPGetMaxTrustRadius(DSDP dsdp, double *rad)
Copy the current radius of the trust region.
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.
int DSDPReadOptions(DSDP dsdp, char filename[])
Read DSDP parameters from a file.
int DSDPPrintOptions()
Print runtime options;.
int DSDPSetMaxTrustRadius(DSDP dsdp, double rad)
Set a maximum trust radius on the step direction.
int DSDPSetYBounds(DSDP dsdp, double lbound, double ubound)
Bound the variables y.
int DSDPGetPenaltyParameter(DSDP dsdp, double *Gamma)
Copy the penalty parameter Gamma.
int DSDPUseDynamicRho(DSDP dsdp, int yesorno)
Use a dynamic strategy to choose parameter rho.
int DSDPGetYBounds(DSDP dsdp, double *lbound, double *ubound)
Copy the bounds on the variables y.
int DSDPGetReuseMatrix(DSDP dsdp, int *rm)
Copy this parameter.
Internal structures for the DSDP solver.