dsdp.h

Go to the documentation of this file.
00001 #ifndef __DSDP_H
00002 #define __DSDP_H
00003 
00004 #include "dsdpbasictypes.h"
00005 #include "dsdpvec.h"
00006 #include "dsdpschurmat.h"
00007 #include "dsdpcone.h"
00008 #include "dsdpconverge.h"
00018 typedef struct LUBounds_C* YBoundCone;
00019 
00024 typedef struct RDCone* RRCone;
00025 
00026 
00027 #define MAX_DSDP_MONITORS 5
00028 #define MAX_XMAKERS 4
00029 
00030 typedef struct {
00031   DSDPVec y;
00032   DSDPVec dy;
00033   double  mu;
00034   double  pstep;
00035   DSDPVec rhs;
00036 } XMaker;
00037 
00038 typedef struct { /* This information is needed to compute the step Direction */
00039   DSDPVec y;
00040   double zbar;
00041   double mutarget;
00042   double logdet;
00043 } DSDPState;
00044 
00045 typedef struct {
00046   int (*f)(void*);
00047   void * ptr;
00048 }DRoutine;
00049 
00050 typedef struct {
00051   int (*monitor)(struct DSDP_C *, void*);
00052   void *monitorctx;
00053 } DMonitor;
00054 
00055 typedef struct {
00056   DSDPCone cone;
00057   int coneid;
00058 } DCone;
00059 
00065 struct DSDP_C{
00066 
00067   DSDPCG *sles;
00068   int slestype;
00069 
00070   double schurmu;
00071   DSDPSchurMat M;
00072   double Mshift;
00073   double maxschurshift;
00074 
00075   int ncones,maxcones;
00076   DCone* K;
00077 
00078   int keyid;
00079 
00080   int solvetime,cgtime,ptime,dtime,ctime;
00081   int reuseM;
00082   DSDPTruth goty0;
00083   DSDPTruth setupcalled;
00084 
00085   int    m;       /*     number of constraints                        */ 
00086   double np;      /*     Dimension of full variable matrix            */
00087 
00088   int    itnow;   /* current iterate                                  */
00089   int    maxiter; /* Maximum number of iterates                       */
00090   double pobj;    /* current primal objective value - use duality gap */
00091   double ppobj;   /* current primal objetive value - evaluate P       */
00092   double dobj,ddobj;  /* the current dual objective value             */
00093   double pstep,dstep;  /* current primal and dual step lengths        */
00094   double dualitygap;
00095   double mutarget;
00096   double mu,muold,mu0;      /* The current  mu */
00097   double rho,potential,logdet,rhon;
00098   double pnorm;   /* the current value of ||P||                       */
00099   double maxtrustradius;
00100   double cnorm,anorm,bnorm; 
00101   double tracex,tracexs;
00102   double rgap;
00103   double pstepold;
00104 
00105   DSDPVec y;      /* dual variables                                       */
00106   DSDPVec y0;     /* initial dual variables                               */
00107   DSDPVec ytemp;  /* temporary dual variables                             */
00108   DSDPVec dy1;    /* search direction 1 affine direction                  */
00109   DSDPVec dy2;    /* search direction 2 centering direction               */
00110   DSDPVec dy;     /* total search direction = constant*dy1-dy2            */
00111   DSDPVec rhs1;   /* objective vector b to determine step direction       */
00112   DSDPVec rhs2;   /* barrier vector A(S^{-1}) to determine step direction */
00113   DSDPVec rhs;    /* right-hand side of linear system                     */
00114   DSDPVec rhstemp;/* temporary rhs vector                                 */
00115   DSDPVec b;      /* dual objective vector                                */
00116 
00117   /* Multiple of identity matrix added to dual        */
00118   double r;
00119   int rflag;
00120   DSDPPenalty UsePenalty;
00121   RRCone rcone;
00122 
00123   DSDPTruth usefixedrho; /*   True if fixed rho used. */
00124   
00125   XMaker xmaker[MAX_XMAKERS]; /* step direction used to create X */
00126   DSDPVec xmakerrhs;
00127 
00128   YBoundCone ybcone;
00129   double pinfeas; /* Infeasible in P indirectly -- neglect numerical errors */
00130   double perror;  /* Infeasible in P computed directly   */
00131 
00132   DSDPSolutionType pdfeasible;
00133   double dinfeastol; /* Parameter: Classify (D) as feasible */
00134   double pinfeastol; /* Parameter: Classify (P) as feasible */
00135 
00136   ConvergenceMonitor conv;
00137   DSDPTerminationReason reason;
00138 
00139   DMonitor dmonitor[MAX_DSDP_MONITORS];
00140   int nmonitors;
00141 
00142   DRoutine droutine[10];
00143   int ndroutines;
00144 };
00145 
00146 typedef struct DSDP_C PD_DSDP;
00147 
00148 #define DSDPKEY  5432
00149 
00150 #define DSDPValid(a) {if (!(a)||((a)->keyid!=DSDPKEY)){ DSDPSETERR(101,"DSDPERROR: Invalid DSDP object\n");}}
00151 
00152 #include "dsdpbasictypes.h"
00153 
00154 
00155 extern int DSDPCreateLUBoundsCone(DSDP, YBoundCone*);
00156 extern int BoundYConeSetBounds(YBoundCone, double, double);
00157 extern int BoundYConeGetBounds(YBoundCone, double*, double*);
00158 extern int BoundYConeAddX(YBoundCone,double,DSDPVec,DSDPVec,DSDPVec,double*);
00159 extern int BoundYConeAddS(YBoundCone,DSDPVec,DSDPVec);
00160 
00161 #ifdef __cplusplus
00162 extern "C" {
00163 #endif
00164 
00165 extern int DSDPComputeObjective(DSDP, DSDPVec, double *);
00166 extern int DSDPComputeDY(DSDP, double, DSDPVec, double*);
00167 extern int DSDPComputeNewY(DSDP, double, DSDPVec);
00168 extern int DSDPComputeRHS(DSDP, double, DSDPVec);
00169 extern int DSDPComputePDY1(DSDP,double,DSDPVec);
00170 extern int DSDPComputePDY(DSDP, double, DSDPVec, double*);
00171 extern int DSDPComputePY(DSDP,double,DSDPVec);
00172 extern int DSDPComputeG(DSDP, DSDPVec,DSDPVec,DSDPVec);
00173 extern int DSDPComputePNorm(DSDP, double,DSDPVec,double*);
00174 extern int DSDPComputeDualityGap(DSDP, double, double*);
00175 extern int DSDPSaveYForX(DSDP, double, double);
00176 extern int DSDPSetY(DSDP,double,double,DSDPVec);
00177 extern int DSDPComputePotential(DSDP, DSDPVec, double,double*);
00178 extern int DSDPComputePotential2(DSDP, DSDPVec, double, double, double*);
00179 extern int DSDPSetRR(DSDP,double);
00180 extern int DSDPGetRR(DSDP,double*);
00181 extern int DSDPGetMaxYElement(DSDP,double*);
00182 
00183 extern int DSDPSolveDynamicRho(DSDP);
00184 extern int DSDPRefineStepDirection(DSDP,DSDPVec, DSDPVec);
00185 
00186 /* Cone operations */
00187 extern int DSDPSetUpCones(DSDP);
00188 extern int DSDPSetUpCones2(DSDP, DSDPVec, DSDPSchurMat);
00189 extern int DSDPSchurSparsity(DSDP, int, int[], int);
00190 extern int DSDPComputeSS(DSDP, DSDPVec, DSDPDualFactorMatrix, DSDPTruth*);
00191 extern int DSDPInvertS(DSDP);
00192 extern int DSDPComputeHessian( DSDP, DSDPSchurMat,  DSDPVec, DSDPVec);
00193 extern int DSDPHessianMultiplyAdd( DSDP, DSDPVec, DSDPVec);
00194 extern int DSDPComputeMaxStepLength(DSDP, DSDPVec, DSDPDualFactorMatrix, double*);
00195 extern int DSDPComputeLogSDeterminant(DSDP, double*);
00196 extern int DSDPComputeANorm2(DSDP,DSDPVec);
00197 extern int DSDPViewCones(DSDP);
00198 extern int DSDPMonitorCones(DSDP,int);
00199 extern int DSDPDestroyCones(DSDP);
00200 extern int DSDPPassXVectors(DSDP,double,DSDPVec,DSDPVec);
00201 extern int DSDPComputeXVariables(DSDP,double,DSDPVec,DSDPVec,DSDPVec,double*);
00202 extern int DSDPGetConicDimension(DSDP,double*);
00203 extern int DSDPSchurSparsity(DSDP, int, int[], int);
00204 
00205 extern int DSDPCGSolve(DSDP,DSDPSchurMat,DSDPVec,DSDPVec,double,DSDPTruth*);
00206 extern int DSDPComputeDualStepDirection(DSDP, double, DSDPVec);
00207 extern int DSDPComputeDualStepDirections(DSDP);
00208 
00209 extern int DSDPSetCone(DSDP,DSDPCone);
00210 
00211 extern int DSDPScaleData(DSDP);
00212 extern int DSDPComputeDataNorms(DSDP);
00213 
00214 extern int DSDPTakeDown(DSDP);
00215 extern int DSDPSetDefaultStatistics(DSDP);
00216 extern int DSDPSetDefaultParameters(DSDP);
00217 extern int DSDPSetDefaultMonitors(DSDP);
00218 
00219 /* DSDP subroutines */
00220 extern int DSDPInitializeVariables(DSDP);
00221 extern int DSDPObjectiveGH( DSDP, DSDPSchurMat, DSDPVec);
00222 extern int DSDPCheckForUnboundedObjective(DSDP, DSDPTruth*);
00223 
00224 extern int DSDPCheckConvergence(DSDP,DSDPTerminationReason *);
00225 extern int DSDPMonitor(DSDP);
00226 extern int DSDPPrintStats(DSDP, void*); 
00227 extern int DSDPPrintStatsFile(DSDP, void*);
00228 
00229 extern int DSDPGetSchurMatrix(DSDP,DSDPSchurMat*);
00230 
00231 
00232 #ifdef __cplusplus
00233 }
00234 #endif
00235 
00236 extern int DSDPAddRCone(DSDP,RRCone*);
00237 extern int RConeSetType(RRCone, DSDPPenalty);
00238 extern int RConeGetRX(RRCone, double*);
00239 
00240 extern int DSDPGetConvergenceMonitor(DSDP, ConvergenceMonitor**);
00241 extern int DSDPDefaultConvergence(DSDP,void *);
00242 
00243 extern int DSDPSetDefaultSchurMatrixStructure(DSDP);
00244 extern int DSDPFixedVariablesNorm(DSDPSchurMat,DSDPVec);
00245 extern int DSDPComputeFixedYX(DSDPSchurMat,DSDPVec);
00246 
00247 extern int DSDPAddBCone(DSDP,DSDPVec,double);
00248 
00249 #endif

Generated on Wed May 21 19:31:19 2008 for DSDP by  doxygen 1.5.5