DSDP
|
00001 #include "dsdpcone_impl.h" 00002 #include "dsdpsys.h" 00003 #include "dsdp5.h" 00004 00010 #define COMPUTELBS(a,b,c) ( (a)+(b)-(c)) 00011 #define COMPUTEUBS(a,b,c) (-(a)-(b)-(c)) 00012 00013 struct LUBounds_C{ 00014 double r,muscale,minx; 00015 int invisible; 00016 int keyid; 00017 int setup,iter; 00018 double lbound,ubound; 00019 double maxratio; 00020 DSDPVec YD,YP,DYD; 00021 DSDP dsdp; 00022 DSDPTruth skipit; 00023 double pobj,pax,sumx,xdots; 00024 }; 00025 typedef struct LUBounds_C* LUBounds; 00026 00027 #define LUKEY 5432 00028 00029 #define LUConeValid(a) {if (!(a)||((a)->keyid!=LUKEY)){ DSDPSETERR(101,"DSDPERROR: Invalid LUCone object\n");}} 00030 00031 static int LUBoundsS(void* dcone,DSDPVec Y, DSDPDualFactorMatrix flag, 00032 DSDPTruth *psdefinite); 00033 00034 #undef __FUNCT__ 00035 #define __FUNCT__ "LUBoundsSetUp" 00036 static int LUBoundsSetup(void *dcone,DSDPVec y){ 00037 DSDPFunctionBegin; 00038 DSDPFunctionReturn(0); 00039 } 00040 00041 #undef __FUNCT__ 00042 #define __FUNCT__ "LUBoundsSetUp2" 00043 static int LUBoundsSetup2(void *dcone, DSDPVec Y, DSDPSchurMat M){ 00044 int info; 00045 LUBounds lucone=(LUBounds)dcone; 00046 DSDPFunctionBegin; 00047 LUConeValid(lucone); 00048 if (lucone->setup==0){ 00049 info=DSDPVecDuplicate(Y,&lucone->DYD);DSDPCHKERR(info); 00050 info=DSDPVecDuplicate(Y,&lucone->YD);DSDPCHKERR(info); 00051 info=DSDPVecDuplicate(Y,&lucone->YP);DSDPCHKERR(info); 00052 info=DSDPVecSet(lucone->lbound,lucone->YD);DSDPCHKERR(info); 00053 info=DSDPVecSetR(lucone->YD,-1e30);DSDPCHKERR(info); 00054 info=DSDPVecSetC(lucone->YD,-1e30);DSDPCHKERR(info); 00055 info=DSDPVecPointwiseMax(lucone->YD,Y,Y);DSDPCHKERR(info); 00056 info=DSDPVecSet(lucone->ubound,lucone->YD);DSDPCHKERR(info); 00057 info=DSDPVecSetR(lucone->YD,1e30);DSDPCHKERR(info); 00058 info=DSDPVecSetC(lucone->YD,1e30);DSDPCHKERR(info); 00059 info=DSDPVecPointwiseMin(lucone->YD,Y,Y);DSDPCHKERR(info); 00060 lucone->setup=1; 00061 } 00062 DSDPFunctionReturn(0); 00063 } 00064 00065 #undef __FUNCT__ 00066 #define __FUNCT__ "LUBoundsDestroy" 00067 static int LUBoundsDestroy(void *dcone){ 00068 int info; 00069 LUBounds lucone=(LUBounds)dcone; 00070 DSDPFunctionBegin; 00071 LUConeValid(lucone); 00072 info=DSDPVecDestroy(&lucone->DYD);DSDPCHKERR(info); 00073 info=DSDPVecDestroy(&lucone->YD);DSDPCHKERR(info); 00074 info=DSDPVecDestroy(&lucone->YP);DSDPCHKERR(info); 00075 DSDPFREE(&dcone,&info);DSDPCHKERR(info); 00076 DSDPFunctionReturn(0); 00077 } 00078 00079 #undef __FUNCT__ 00080 #define __FUNCT__ "LUBoundsSize" 00081 static int LUBoundsSize(void *dcone, double *n){ 00082 int nn,info; 00083 LUBounds lucone=(LUBounds)dcone; 00084 DSDPFunctionBegin; 00085 LUConeValid(lucone); 00086 *n=0; 00087 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);} 00088 info=DSDPVecGetSize(lucone->YD,&nn);DSDPCHKERR(info); 00089 *n=(2*(nn-2)*lucone->muscale); 00090 DSDPFunctionReturn(0); 00091 } 00092 00093 00094 #undef __FUNCT__ 00095 #define __FUNCT__ "LUBoundsHessian" 00096 static int LUBoundsHessian(void* dcone, double mu, DSDPSchurMat M, 00097 DSDPVec vrhs1, DSDPVec vrhs2){ 00098 int info,i,m; 00099 LUBounds lucone=(LUBounds)dcone; 00100 double assa,as,asrs=0,sl,su; 00101 double dd,yy,rs=0,srrs=0; 00102 double cc,rr,r,r0=lucone->r; 00103 double lbound, ubound; 00104 DSDPVec DScale=lucone->YP,Y=lucone->YD; 00105 00106 DSDPFunctionBegin; 00107 LUConeValid(lucone); 00108 00109 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);} 00110 mu*=lucone->muscale; 00111 info=DSDPSchurMatDiagonalScaling(M,DScale);DSDPCHKERR(info); 00112 info=DSDPVecGetSize(DScale,&m);DSDPCHKERR(info); 00113 info=DSDPVecGetC(Y,&cc);DSDPCHKERR(info); 00114 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info); 00115 lbound=cc*lucone->lbound; 00116 ubound=cc*lucone->ubound; 00117 r=rr*lucone->r; 00118 info=DSDPVecSetC(DScale,0);DSDPCHKERR(info); 00119 info=DSDPVecSetR(DScale,0);DSDPCHKERR(info); 00120 for (i=1;i<m-1;i++){ 00121 info=DSDPVecGetElement(DScale,i,&dd);DSDPCHKERR(info); 00122 info=DSDPVecSetElement(DScale,i,0);DSDPCHKERR(info); 00123 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info); 00124 sl=1.0/COMPUTELBS(lbound,yy,r); 00125 su=1.0/COMPUTEUBS(ubound,yy,r); 00126 assa=mu*(su*su + sl*sl); 00127 as=mu*(su-sl); 00128 if (r){ 00129 asrs=mu*r0*(su*su - sl*sl); 00130 rs+=(su+sl); 00131 srrs+=(su*su + sl*sl); 00132 } 00133 if (dd==0) continue; 00134 info=DSDPVecAddElement(vrhs2,i,dd*as);DSDPCHKERR(info); 00135 /* info=DSDPVecAddElement(vrhs3,i,dd*asrs);DSDPCHKERR(info); */ 00136 info=DSDPVecSetElement(DScale,i,dd*assa);DSDPCHKERR(info); 00137 } 00138 info=DSDPSchurMatAddDiagonal(M,DScale);DSDPCHKERR(info); 00139 info=DSDPVecAddR(vrhs2,r0*mu*rs);DSDPCHKERR(info); 00140 /* 00141 info=DSDPVecAddR(vrhs3,r0*mu*srrs);DSDPCHKERR(info); 00142 */ 00143 DSDPFunctionReturn(0); 00144 } 00145 00146 #undef __FUNCT__ 00147 #define __FUNCT__ "LUBoundsMultiply" 00148 static int LUBoundsMultiply(void* dcone, double mu, DSDPVec vrow, DSDPVec vin, DSDPVec vout){ 00149 int info,i,m; 00150 double vv,ww,yy,sl,su,assa,rr; 00151 LUBounds lucone=(LUBounds)dcone; 00152 double cc, r=lucone->r; 00153 double lbound=lucone->lbound, ubound=lucone->ubound; 00154 DSDPVec Y=lucone->YD; 00155 00156 DSDPFunctionBegin; 00157 LUConeValid(lucone); 00158 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);} 00159 mu*=lucone->muscale; 00160 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info); 00161 info=DSDPVecGetC(Y,&cc);DSDPCHKERR(info); 00162 r=r*rr; 00163 lbound*=cc; ubound*=cc; 00164 info=DSDPVecGetSize(vin,&m);DSDPCHKERR(info); 00165 for (i=1;i<m-1;i++){ 00166 info=DSDPVecGetElement(vrow,i,&ww);DSDPCHKERR(info); 00167 info=DSDPVecGetElement(vin,i,&vv);DSDPCHKERR(info); 00168 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info); 00169 if (vv==0 || ww==0) continue; 00170 sl=(1.0)/COMPUTELBS(lbound,yy,r); 00171 su=(1.0)/COMPUTEUBS(ubound,yy,r); 00172 assa=mu*ww*vv*(su*su + sl*sl); 00173 info=DSDPVecAddElement(vout,i,assa);DSDPCHKERR(info); 00174 } 00175 00176 DSDPFunctionReturn(0); 00177 } 00178 00179 #undef __FUNCT__ 00180 #define __FUNCT__ "BoundYConeAddX" 00181 int BoundYConeAddX(LUBounds lucone, double mu, DSDPVec Y, DSDPVec DY, DSDPVec XLU, double *tracexs){ 00182 int i,m,info; 00183 double sl,su,dsl,dsu,ux,lx; 00184 double dy,yy,xdots=0,xsum1=0,xsum2=0; 00185 double r,dr,rr,drr,cr; 00186 double lbound, ubound; 00187 00188 DSDPFunctionBegin; 00189 LUConeValid(lucone); 00190 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);} 00191 info=DSDPVecGetSize(Y,&m);DSDPCHKERR(info); 00192 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info); 00193 info=DSDPVecGetC(Y,&cr);DSDPCHKERR(info); 00194 info=DSDPVecGetR(DY,&drr);DSDPCHKERR(info); 00195 r=rr*lucone->r; dr=drr*lucone->r; 00196 lbound=cr*lucone->lbound; ubound=cr*lucone->ubound; 00197 mu*=lucone->muscale; 00198 for (i=1;i<m-1;i++){ 00199 info=DSDPVecGetElement(DY,i,&dy);DSDPCHKERR(info); 00200 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info); 00201 sl=1.0/COMPUTELBS(lbound,yy,r); 00202 su=1.0/COMPUTEUBS(ubound,yy,r); 00203 dsl=COMPUTELBS(0,dy,dr); 00204 dsu=COMPUTEUBS(0,dy,dr); 00205 lx=mu*(sl-sl*dsl*sl); 00206 ux=mu*(su-su*dsu*su); 00207 info=DSDPVecAddElement(XLU,i,ux-lx);DSDPCHKERR(info); 00208 /* printf("%d) %4.4f %4.4f %4.4f ",i,ux,lx,ux-lx); */ 00209 xsum1+=lx; 00210 xsum2+=ux; 00211 xdots+=lx/sl + ux/su; 00212 } 00213 info=DSDPVecAddC(XLU,ubound*xsum1-lbound*xsum2);DSDPCHKERR(info); 00214 info=DSDPVecAddR(XLU,xsum1+xsum2);DSDPCHKERR(info); 00215 *tracexs+=xdots; 00216 /* 00217 DSDPLogInfo(0,3,"YBounds: Minimum x: %4.4e. Maximum x: %4.4e, Objective: %4.4e, Trace(xs): %4.4e, Max Ratio of x and s: %4.4e\n",minx,maxx,ppobj,xdots,ratioxs); 00218 */ 00219 DSDPFunctionReturn(0); 00220 } 00221 00222 #undef __FUNCT__ 00223 #define __FUNCT__ "BoundYConeAddS" 00224 int BoundYConeAddS(LUBounds lucone, DSDPVec SL, DSDPVec SU){ 00225 DSDPFunctionBegin; 00226 LUConeValid(lucone); 00227 DSDPFunctionReturn(1); 00228 } 00229 00230 #undef __FUNCT__ 00231 #define __FUNCT__ "LUBoundsS" 00232 static int LUBoundsS(void* dcone,DSDPVec Y, DSDPDualFactorMatrix flag, 00233 DSDPTruth *psdefinite){ 00234 int i,m,info; 00235 LUBounds lucone=(LUBounds)dcone; 00236 double cr,rr,r; 00237 double yy,sl,su; 00238 double lbound, ubound; 00239 DSDPSchurMat M={0,0,0}; 00240 00241 DSDPFunctionBegin; 00242 LUConeValid(lucone); 00243 *psdefinite=DSDP_TRUE; 00244 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);} 00245 if (lucone->setup==0){ 00246 info=LUBoundsSetup2(dcone,Y,M);DSDPCHKERR(info); 00247 } 00248 info=DSDPVecGetC(Y,&cr);DSDPCHKERR(info); 00249 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info); 00250 lbound=cr*lucone->lbound; ubound=cr*lucone->ubound; 00251 r=rr*lucone->r; 00252 *psdefinite=DSDP_TRUE; 00253 if (flag==DUAL_FACTOR){ 00254 info=DSDPVecCopy(Y,lucone->YD);DSDPCHKERR(info); 00255 } else { 00256 info=DSDPVecCopy(Y,lucone->YP);DSDPCHKERR(info); 00257 } 00258 00259 info=DSDPVecGetSize(Y,&m);DSDPCHKERR(info); 00260 for (i=1;i<m-1;i++){ 00261 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info); 00262 sl=COMPUTELBS(lbound,yy,r); 00263 su=COMPUTEUBS(ubound,yy,r); 00264 if (sl<=0 || su<=0){ *psdefinite=DSDP_FALSE; break;} 00265 } 00266 DSDPFunctionReturn(0); 00267 } 00268 00269 #undef __FUNCT__ 00270 #define __FUNCT__ "LUInvertS" 00271 static int LUInvertS(void* dcone){ 00272 DSDPFunctionBegin; 00273 DSDPFunctionReturn(0); 00274 } 00275 00276 #undef __FUNCT__ 00277 #define __FUNCT__ "LUBoundsSetX" 00278 static int LUBoundsSetX(void* dcone,double mu, DSDPVec Y,DSDPVec DY){ 00279 LUBounds lucone=(LUBounds)dcone; 00280 int info; 00281 DSDPFunctionBegin; 00282 LUConeValid(lucone); 00283 info=DSDPVecCopy(Y,lucone->YP);DSDPCHKERR(info); 00284 info=DSDPVecCopy(DY,lucone->DYD);DSDPCHKERR(info); 00285 DSDPFunctionReturn(0); 00286 } 00287 00288 #undef __FUNCT__ 00289 #define __FUNCT__ "LUBoundsX" 00290 static int LUBoundsX(void* dcone,double mu, DSDPVec Y,DSDPVec DY, DSDPVec AX , double *tracexs){ 00291 LUBounds lucone=(LUBounds)dcone; 00292 int info,invisible=lucone->invisible; 00293 00294 DSDPFunctionBegin; 00295 LUConeValid(lucone); 00296 info=LUBoundsSetX(dcone,mu,Y,DY);DSDPCHKERR(info); 00297 if (!invisible){ 00298 info=BoundYConeAddX(lucone,mu,Y,DY,AX,tracexs);DSDPCHKERR(info); 00299 } 00300 DSDPFunctionReturn(0); 00301 } 00302 00303 00304 #undef __FUNCT__ 00305 #define __FUNCT__ "LUBoundsComputeMaxStepLength" 00306 static int LUBoundsComputeMaxStepLength(void* dcone, DSDPVec DY, DSDPDualFactorMatrix flag, double *maxsteplength){ 00307 int i,m,info; 00308 double mstep=1.0e200; 00309 LUBounds lucone=(LUBounds)dcone; 00310 double lbound=lucone->lbound, ubound=lucone->ubound; 00311 double cc,rr,ddr,r,dsl,dsu,sl,su,yy,dy,dr; 00312 DSDPVec Y; 00313 DSDPFunctionBegin; 00314 00315 LUConeValid(lucone); 00316 *maxsteplength=mstep; 00317 if (flag==PRIMAL_FACTOR){ 00318 info=DSDPVecCopy(DY,lucone->DYD);DSDPCHKERR(info); 00319 } 00320 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);} 00321 info=DSDPVecGetR(DY,&ddr);DSDPCHKERR(info); 00322 dr=ddr*lucone->r; 00323 if (flag==DUAL_FACTOR){ 00324 Y=lucone->YD; 00325 } else { 00326 Y=lucone->YP; 00327 } 00328 info=DSDPVecGetC(Y,&cc);DSDPCHKERR(info); 00329 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info); 00330 lbound*=cc; ubound*=cc; 00331 r=rr*lucone->r; 00332 00333 info=DSDPVecGetSize(Y,&m);DSDPCHKERR(info); 00334 for (i=1;i<m-1;i++){ 00335 info=DSDPVecGetElement(DY,i,&dy);DSDPCHKERR(info); 00336 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info); 00337 sl=COMPUTELBS(lbound,yy,r); 00338 su=COMPUTEUBS(ubound,yy,r); 00339 dsl=COMPUTELBS(0,dy,dr); 00340 dsu=COMPUTEUBS(0,dy,dr); 00341 00342 if (dsl<0){mstep=DSDPMin(mstep,-sl/dsl);} 00343 if (dsu<0){mstep=DSDPMin(mstep,-su/dsu);} 00344 } 00345 *maxsteplength=mstep; 00346 DSDPLogInfo(0,8,"YBounds: max step: %4.4e\n",mstep); 00347 DSDPFunctionReturn(0); 00348 } 00349 00350 00351 #undef __FUNCT__ 00352 #define __FUNCT__ "LUBoundsPotential" 00353 static int LUBoundsPotential(void* dcone, double *logobj, double *logdet){ 00354 LUBounds lucone=(LUBounds)dcone; 00355 int i,m,info; 00356 double sl,su,yy,sumlog=0; 00357 double cc,rr,r; 00358 double lbound=lucone->lbound, ubound=lucone->ubound; 00359 DSDPVec Y=lucone->YD; 00360 DSDPFunctionBegin; 00361 00362 LUConeValid(lucone); 00363 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);} 00364 info=DSDPVecGetC(Y,&cc);DSDPCHKERR(info); 00365 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info); 00366 lbound*=cc; ubound*=cc; 00367 r=rr*lucone->r; 00368 00369 info=DSDPVecGetSize(Y,&m);DSDPCHKERR(info); 00370 for (i=1;i<m-1;i++){ 00371 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info); 00372 sl=COMPUTELBS(lbound,yy,r); 00373 su=COMPUTEUBS(ubound,yy,r); 00374 sumlog+= log(su*sl); 00375 } 00376 *logdet=lucone->muscale*sumlog; 00377 *logobj=0; 00378 DSDPFunctionReturn(0); 00379 } 00380 00381 #undef __FUNCT__ 00382 #define __FUNCT__ "LUBoundsSparsity" 00383 static int LUBoundsSparsity(void *dcone,int row, int *tnnz, int rnnz[], int m){ 00384 LUBounds lucone=(LUBounds)dcone; 00385 DSDPFunctionBegin; 00386 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);} 00387 *tnnz=1;rnnz[row]++; 00388 DSDPFunctionReturn(0); 00389 } 00390 00391 00392 #undef __FUNCT__ 00393 #define __FUNCT__ "LPANorm2" 00394 static int LPANorm2( void *dcone, DSDPVec ANorm){ 00395 LUBounds lucone=(LUBounds)dcone; 00396 double yy,cnorm2; 00397 int i,m,info; 00398 DSDPFunctionBegin; 00399 LUConeValid(lucone); 00400 if (lucone->invisible){DSDPFunctionReturn(0);} 00401 info=DSDPVecGetSize(ANorm,&m);DSDPCHKERR(info); 00402 for (i=1;i<m-1;i++){ 00403 yy=2.0; 00404 info=DSDPVecAddElement(ANorm,i,yy); 00405 } 00406 cnorm2=m*lucone->lbound*lucone->lbound + m*lucone->ubound*lucone->ubound; 00407 cnorm2=m+1.0; 00408 info=DSDPVecAddC(ANorm,cnorm2);DSDPCHKERR(info); 00409 info=DSDPVecAddR(ANorm,2*lucone->r);DSDPCHKERR(info); 00410 DSDPFunctionReturn(0); 00411 } 00412 00413 00414 #undef __FUNCT__ 00415 #define __FUNCT__ "LUBoundsView" 00416 int LUBoundsView(LUBounds lucone){ 00417 double lbound=lucone->lbound, ubound=lucone->ubound; 00418 DSDPFunctionBegin; 00419 LUConeValid(lucone); 00420 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);} 00421 printf("Lower Bounds for all y variables: %4.8e\n",lbound); 00422 printf("Upper Bounds for all y variables: %4.8e\n",ubound); 00423 DSDPFunctionReturn(0); 00424 } 00425 00426 #undef __FUNCT__ 00427 #define __FUNCT__ "LUBoundsRHS" 00428 static int LUBoundsRHS( void *dcone, double mu, DSDPVec vrow, DSDPVec vrhs1, DSDPVec vrhs2){ 00429 int info,i,m; 00430 LUBounds lucone=(LUBounds)dcone; 00431 double as,sl,su; 00432 double dd,yy,rs=0; 00433 double cc,rr,r,r0=lucone->r; 00434 double lbound, ubound; 00435 DSDPVec Y=lucone->YD; 00436 00437 DSDPFunctionBegin; 00438 if (lucone->skipit==DSDP_TRUE){DSDPFunctionReturn(0);} 00439 00440 LUConeValid(lucone); 00441 mu*=lucone->muscale; 00442 info=DSDPVecGetSize(vrow,&m);DSDPCHKERR(info); 00443 info=DSDPVecGetC(Y,&cc);DSDPCHKERR(info); 00444 info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info); 00445 lbound=cc*lucone->lbound; 00446 ubound=cc*lucone->ubound; 00447 r=rr*lucone->r; 00448 for (i=1;i<m-1;i++){ 00449 info=DSDPVecGetElement(vrow,i,&dd);DSDPCHKERR(info); 00450 info=DSDPVecGetElement(Y,i,&yy);DSDPCHKERR(info); 00451 sl=1.0/COMPUTELBS(lbound,yy,r); 00452 su=1.0/COMPUTEUBS(ubound,yy,r); 00453 as=mu*(su-sl); 00454 if (r){ 00455 rs+=(su+sl); 00456 } 00457 if (dd==0) continue; 00458 info=DSDPVecAddElement(vrhs2,i,dd*as);DSDPCHKERR(info); 00459 } 00460 info=DSDPVecAddR(vrhs2,r0*mu*rs);DSDPCHKERR(info); 00461 DSDPFunctionReturn(0); 00462 } 00463 00464 00465 #undef __FUNCT__ 00466 #define __FUNCT__ "LUBoundsMonitor" 00467 static int LUBoundsMonitor(void* dcone,int tag){ 00468 DSDPFunctionBegin; 00469 DSDPFunctionReturn(0); 00470 } 00471 00472 00473 static struct DSDPCone_Ops kops; 00474 static const char *luconename="Bound Y Cone"; 00475 00476 #undef __FUNCT__ 00477 #define __FUNCT__ "LUBoundsOperationsInitialize" 00478 static int LUBoundsOperationsInitialize(struct DSDPCone_Ops* coneops){ 00479 int info; 00480 if (coneops==NULL) return 0; 00481 info=DSDPConeOpsInitialize(coneops); DSDPCHKERR(info); 00482 coneops->conehessian=LUBoundsHessian; 00483 coneops->conesetup=LUBoundsSetup; 00484 coneops->conesetup2=LUBoundsSetup2; 00485 coneops->conedestroy=LUBoundsDestroy; 00486 coneops->conemonitor=LUBoundsMonitor; 00487 coneops->conecomputes=LUBoundsS; 00488 coneops->coneinverts=LUInvertS; 00489 coneops->conecomputex=LUBoundsX; 00490 coneops->conesetxmaker=LUBoundsSetX; 00491 coneops->conemaxsteplength=LUBoundsComputeMaxStepLength; 00492 coneops->conerhs=LUBoundsRHS; 00493 coneops->conelogpotential=LUBoundsPotential; 00494 coneops->conesize=LUBoundsSize; 00495 coneops->conesparsity=LUBoundsSparsity; 00496 coneops->conehmultiplyadd=LUBoundsMultiply; 00497 coneops->coneanorm2=LPANorm2; 00498 coneops->id=12; 00499 coneops->name=luconename; 00500 return 0; 00501 } 00502 00503 #undef __FUNCT__ 00504 #define __FUNCT__ "BoundYConeSetBounds" 00505 00512 int BoundYConeSetBounds(LUBounds lucone, double lb, double ub){ 00513 DSDPFunctionBegin; 00514 LUConeValid(lucone); 00515 lucone->lbound=lb; 00516 lucone->ubound=ub; 00517 if (lb==0 && ub==0){lucone->skipit=DSDP_TRUE;} 00518 else { lucone->skipit=DSDP_FALSE;} 00519 DSDPFunctionReturn(0); 00520 } 00521 00522 00523 #undef __FUNCT__ 00524 #define __FUNCT__ "BoundYConeGetBounds" 00525 00532 int BoundYConeGetBounds(LUBounds lucone, double *lb, double *ub){ 00533 DSDPFunctionBegin; 00534 LUConeValid(lucone); 00535 *lb=lucone->lbound; 00536 *ub=lucone->ubound; 00537 DSDPFunctionReturn(0); 00538 } 00539 00540 00541 #undef __FUNCT__ 00542 #define __FUNCT__ "DSDPAddLUBounds" 00543 00549 int DSDPAddLUBounds(DSDP dsdp,LUBounds lucone){ 00550 int info; 00551 DSDPFunctionBegin; 00552 LUConeValid(lucone); 00553 info=LUBoundsOperationsInitialize(&kops); DSDPCHKERR(info); 00554 info=DSDPAddCone(dsdp,&kops,(void*)lucone); DSDPCHKERR(info); 00555 DSDPFunctionReturn(0); 00556 } 00557 00558 #undef __FUNCT__ 00559 #define __FUNCT__ "DSDPCreateLUBoundsCone" 00560 00566 int DSDPCreateLUBoundsCone(DSDP dsdp, LUBounds *dspcone){ 00567 int m,info; 00568 struct LUBounds_C *lucone; 00569 DSDPFunctionBegin; 00570 if (!dsdp){DSDPFunctionReturn(1);} 00571 DSDPCALLOC1(&lucone,struct LUBounds_C,&info);DSDPCHKERR(info); 00572 *dspcone=lucone; 00573 lucone->keyid=LUKEY; 00574 info=DSDPAddLUBounds(dsdp,lucone);DSDPCHKERR(info); 00575 info=DSDPGetNumberOfVariables(dsdp,&m);DSDPCHKERR(info); 00576 lucone->muscale=1.0; 00577 lucone->r=0.0; 00578 lucone->skipit=DSDP_FALSE; 00579 lucone->pobj=0; lucone->pax=0; lucone->sumx=0; lucone->xdots=0; 00580 info=BoundYConeSetBounds(lucone,-1000000,1000000);DSDPCHKERR(info); 00581 lucone->invisible=1; 00582 lucone->setup=0; 00583 DSDPFunctionReturn(0); 00584 } 00585 00586 #undef __FUNCT__ 00587 #define __FUNCT__ "LUBoundsScaleBarrier" 00588 int LUBoundsScaleBarrier(LUBounds lucone,double muscale){ 00589 DSDPFunctionBegin; 00590 LUConeValid(lucone); 00591 if (muscale>0){ 00592 lucone->muscale=muscale; 00593 } 00594 DSDPFunctionReturn(0); 00595 } 00596