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);
140 #define MAXOPTIONS 40
142 #define BUFFERSIZ 100
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);
252 static 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);