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 _P_LUBounds* 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 {
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;
00086 double np;
00087
00088 int itnow;
00089 int maxiter;
00090 double pobj;
00091 double ppobj;
00092 double dobj,ddobj;
00093 double pstep,dstep;
00094 double dualitygap;
00095 double mutarget;
00096 double mu,muold,mu0;
00097 double rho,potential,logdet,rhon;
00098 double pnorm;
00099 double maxtrustradius;
00100 double cnorm,anorm,bnorm;
00101 double tracex,tracexs;
00102 double rgap;
00103 double pstepold;
00104
00105 DSDPVec y;
00106 DSDPVec y0;
00107 DSDPVec ytemp;
00108 DSDPVec dy1;
00109 DSDPVec dy2;
00110 DSDPVec dy;
00111 DSDPVec rhs1;
00112 DSDPVec rhs2;
00113 DSDPVec rhs;
00114 DSDPVec rhstemp;
00115 DSDPVec b;
00116
00117
00118 double r;
00119 int rflag;
00120 DSDPPenalty UsePenalty;
00121 RRCone rcone;
00122
00123 DSDPTruth usefixedrho;
00124
00125 XMaker xmaker[MAX_XMAKERS];
00126 DSDPVec xmakerrhs;
00127
00128 YBoundCone ybcone;
00129 double pinfeas;
00130 double perror;
00131
00132 DSDPSolutionType pdfeasible;
00133 double dinfeastol;
00134 double pinfeastol;
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 extern int DSDPCreateLUBoundsCone(DSDP, YBoundCone*);
00155 extern int BoundYConeSetBounds(YBoundCone, double, double);
00156 extern int BoundYConeGetBounds(YBoundCone, double*, double*);
00157 extern int BoundYConeAddX(YBoundCone,double,DSDPVec,DSDPVec,DSDPVec,double*);
00158 extern int BoundYConeAddS(YBoundCone,DSDPVec,DSDPVec);
00159
00160 extern int DSDPComputeObjective(DSDP, DSDPVec, double *);
00161 extern int DSDPComputeDY(DSDP, double, DSDPVec, double*);
00162 extern int DSDPComputeNewY(DSDP, double, DSDPVec);
00163 extern int DSDPComputeRHS(DSDP, double, DSDPVec);
00164 extern int DSDPComputePDY1(DSDP,double,DSDPVec);
00165 extern int DSDPComputePDY(DSDP, double, DSDPVec, double*);
00166 extern int DSDPComputePY(DSDP,double,DSDPVec);
00167 extern int DSDPComputeG(DSDP, DSDPVec,DSDPVec,DSDPVec);
00168 extern int DSDPComputePNorm(DSDP, double,DSDPVec,double*);
00169 extern int DSDPComputeDualityGap(DSDP, double, double*);
00170 extern int DSDPSaveYForX(DSDP, double, double);
00171 extern int DSDPSetY(DSDP,double,double,DSDPVec);
00172 extern int DSDPComputePotential(DSDP, DSDPVec, double,double*);
00173 extern int DSDPComputePotential2(DSDP, DSDPVec, double, double, double*);
00174 extern int DSDPSetRR(DSDP,double);
00175 extern int DSDPGetRR(DSDP,double*);
00176 extern int DSDPGetMaxYElement(DSDP,double*);
00177 extern int DSDPSolveDynamicRho(DSDP);
00178 extern int DSDPRefineStepDirection(DSDP,DSDPVec, DSDPVec);
00179
00180
00181 extern int DSDPSetUpCones(DSDP);
00182 extern int DSDPSetUpCones2(DSDP, DSDPVec, DSDPSchurMat);
00183 extern int DSDPSchurSparsity(DSDP, int, int[], int);
00184 extern int DSDPComputeSS(DSDP, DSDPVec, DSDPDualFactorMatrix, DSDPTruth*);
00185 extern int DSDPInvertS(DSDP);
00186 extern int DSDPComputeHessian( DSDP, DSDPSchurMat, DSDPVec, DSDPVec);
00187 extern int DSDPHessianMultiplyAdd( DSDP, DSDPVec, DSDPVec);
00188 extern int DSDPComputeMaxStepLength(DSDP, DSDPVec, DSDPDualFactorMatrix, double*);
00189 extern int DSDPComputeLogSDeterminant(DSDP, double*);
00190 extern int DSDPComputeANorm2(DSDP,DSDPVec);
00191 extern int DSDPViewCones(DSDP);
00192 extern int DSDPMonitorCones(DSDP,int);
00193 extern int DSDPDestroyCones(DSDP);
00194 extern int DSDPPassXVectors(DSDP,double,DSDPVec,DSDPVec);
00195 extern int DSDPComputeXVariables(DSDP,double,DSDPVec,DSDPVec,DSDPVec,double*);
00196 extern int DSDPGetConicDimension(DSDP,double*);
00197 extern int DSDPSchurSparsity(DSDP, int, int[], int);
00198
00199 extern int DSDPCGSolve(DSDP,DSDPSchurMat,DSDPVec,DSDPVec,double,DSDPTruth*);
00200 extern int DSDPComputeDualStepDirection(DSDP, double, DSDPVec);
00201 extern int DSDPComputeDualStepDirections(DSDP);
00202
00203 extern int DSDPAddBCone(DSDP,DSDPVec,double);
00204 extern int DSDPAddICone(DSDP,int, double);
00205 extern int DSDPAddRCone(DSDP,RRCone*);
00206 extern int DSDPSetCone(DSDP,DSDPCone);
00207 extern int RConeSetType(RRCone, DSDPPenalty);
00208
00209 extern int DSDPScaleData(DSDP);
00210 extern int DSDPComputeDataNorms(DSDP);
00211
00212 extern int DSDPTakeDown(DSDP);
00213 extern int DSDPSetDefaultStatistics(DSDP);
00214 extern int DSDPSetDefaultParameters(DSDP);
00215 extern int DSDPSetDefaultMonitors(DSDP);
00216
00217
00218 extern int DSDPInitializeVariables(DSDP);
00219 extern int DSDPObjectiveGH( DSDP, DSDPSchurMat, DSDPVec);
00220 extern int DSDPCheckForUnboundedObjective(DSDP, DSDPTruth*);
00221
00222 extern int DSDPCheckConvergence(DSDP,DSDPTerminationReason *);
00223 extern int DSDPMonitor(DSDP);
00224 extern int DSDPDefaultConvergence(DSDP,void *);
00225 extern int DSDPPrintStats(DSDP, void*);
00226 extern int DSDPPrintStatsFile(DSDP, void*);
00227
00228 extern int DSDPGetSchurMatrix(DSDP,DSDPSchurMat*);
00229 extern int DSDPFixedVariablesNorm(DSDPSchurMat,DSDPVec);
00230 extern int DSDPComputeFixedYX(DSDPSchurMat,DSDPVec);
00231
00232
00233
00234 extern int DSDPLAPACKSchurCreate(int,DSDPSchurMat*);
00235 extern int DSDPSetSchurMatrixStructure(DSDP,int (*)(DSDPSchurMat *, int, void*), void*);
00236 extern int DSDPSetDefaultSchurMatrixStructure(DSDP);
00237 extern int DSDPSchurSolve(DSDP,DSDPVec,DSDPVec);
00238 extern int DSDPGetConvergenceMonitor(DSDP, ConvergenceMonitor**);
00239 extern int DSDPSetDefaultConvergenceMonitor(DSDP);
00240
00241
00242 #endif