1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
|
#ifndef __sdpa_parts_h__
#define __sdpa_parts_h__
#include "sdpa_include.h"
#include "sdpa_dataset.h"
namespace sdpa {
class Newton;
class Solutions;
class InputData;
class Residuals;
class WorkVariables;
class ComputeTime;
class Parameter;
class StepLength;
class DirectionParameter;
class Switch;
class RatioInitResCurrentRes;
class SolveInfo;
class Phase;
class AverageComplementarity;
class ComputeTime
{
public:
double Predictor;
double Corrector;
double StepPredictor;
double StepCorrector;
double xMatTime;
double zMatTime;
double invzMatTime;
double xMatzMatTime;
double EigxMatTime;
double EigzMatTime;
double EigxMatzMatTime;
double makerMat;
double makebMat;
double B_DIAG;
double B_F1;
double B_F2;
double B_F3;
double B_PRE;
double makegVecMul;
double makegVec;
double choleskybMat;
double solve;
double sumDz;
double makedX;
double symmetriseDx;
double makedXdZ;
double updateRes;
double MainLoop;
double FileRead;
double FileCheck;
double FileChange;
double TotalTime;
ComputeTime();
~ComputeTime();
void display(FILE* fpout=stdout);
};
class Parameter
{
public:
enum parameterType {PARAMETER_DEFAULT,
PARAMETER_UNSTABLE_BUT_FAST,
PARAMETER_STABLE_BUT_SLOW};
int maxIteration;
double epsilonStar;
double lambdaStar;
double omegaStar;
double lowerBound;
double upperBound;
double betaStar;
double betaBar;
double gammaStar;
double epsilonDash;
#define PRINT_DEFAULT_LENGTH 30
static char xPRINT_DEFAULT[PRINT_DEFAULT_LENGTH];
static char XPRINT_DEFAULT[PRINT_DEFAULT_LENGTH];
static char YPRINT_DEFAULT[PRINT_DEFAULT_LENGTH];
static char infPRINT_DEFAULT[PRINT_DEFAULT_LENGTH];
char xPrint[PRINT_DEFAULT_LENGTH];
char XPrint[PRINT_DEFAULT_LENGTH];
char YPrint[PRINT_DEFAULT_LENGTH];
char infPrint[PRINT_DEFAULT_LENGTH];
Parameter();
Parameter(FILE* parameterFile);
~Parameter();
void setDefaultParameter(parameterType type
= PARAMETER_DEFAULT);
void readFile(FILE* parameterFile);
void display(FILE* fpout=stdout, char* printFormat=infPRINT_DEFAULT);
};
class StepLength
{
public:
double primal;
double dual;
StepLength();
StepLength(double alphaP, double alphaD, int nBlock,
int* blockStruct);
~StepLength();
void initialize(double alphaP, double alphaD);
void terminate();
static double minBlockVector(BlockVector& aVec);
void computeStepLength(Solutions& currentPt,
Newton& newton,
WorkVariables& work,
ComputeTime& com);
void MehrotraPredictor(InputData& inputData,
Solutions& currentPt,
Phase& phase,
Newton& newton,
WorkVariables& work,
ComputeTime& com);
void MehrotraCorrector(InputData& inputData,
Solutions& currentPt, Phase& phase,
Switch& reduction, Newton& newton,
AverageComplementarity& mu,
RatioInitResCurrentRes& theta,
WorkVariables& work,
Parameter& param, ComputeTime& com);
void display(FILE* fpout = stdout);
};
class DirectionParameter
{
public:
double value;
DirectionParameter(double betaStar=0.0);
~DirectionParameter();
void initialize(double betaStar=0.0);
void MehrotraPredictor(Phase& phase, Switch& reduction,
Parameter& param);
void MehrotraCorrector(Phase& phase, StepLength& alpha,
Solutions& currentPt, Newton& newton,
AverageComplementarity& mu,
Parameter& param);
void display(FILE* fpout = stdout);
};
class Switch
{
public:
enum SwitchType {CENTERING,AFFINE};
SwitchType switchType;
Switch(SwitchType switchType=CENTERING);
~Switch();
void initialize(SwitchType switchType=CENTERING);
void MehrotraPredictor(Phase& phase);
void display(FILE* fpout = stdout);
};
class AverageComplementarity
{
public:
double initial;
double current;
AverageComplementarity(double lambdaStar = 0.0);
~AverageComplementarity();
void initialize(double lambdaStar = 0.0);
void initialize(Solutions& initPt);
void update(Solutions& currentPt);
void display(FILE* fpout = stdout);
};
class RatioInitResCurrentRes
{
public:
double primal;
double dual;
RatioInitResCurrentRes();
RatioInitResCurrentRes(Parameter& param, Residuals& initRes);
~RatioInitResCurrentRes();
void initialize(Parameter& param, Residuals& initRes);
void update(Switch& reduction, StepLength& alpha);
void update_exact(Residuals& initRes, Residuals& currentRes,
Parameter& param);
void display(FILE* fpout = stdout);
};
class SolveInfo
{
public:
enum phaseType { noINFO,pFEAS,dFEAS,pdFEAS,pdINF,pFEAS_dINF,
pINF_dFEAS,pdOPT,pUNBD,dUNBD};
double rho;
double etaPrimal;
double etaDual;
double objValPrimal;
double objValDual;
SolveInfo();
SolveInfo(InputData& inputData, Solutions& currentPt,
double mu0, double omegaStar);
~SolveInfo();
void initialize(InputData& inputData, Solutions& currentPt,
double mu0, double omegaStar);
void update(InputData& inputData,
DenseLinearSpace& initPt_xMat,
DenseLinearSpace& initPt_zMat,
Solutions& currentPt,
Residuals& currentRes,
AverageComplementarity& mu,
RatioInitResCurrentRes& theta,
Parameter& param);
void update(double& lambda,
InputData& inputData,
Solutions& currentPt,
Residuals& currentRes,
AverageComplementarity& mu,
RatioInitResCurrentRes& theta,
Parameter& param);
void check(InputData& inputData,
Solutions& currentPt,
Residuals& currentRes,
AverageComplementarity& mu,
RatioInitResCurrentRes& theta,
Parameter& param);
void display(FILE* fpout = stdout);
};
class Phase
{
public:
int nDim;
SolveInfo::phaseType value;
Phase();
Phase(Residuals& initRes, SolveInfo& solveInfo,
Parameter& param, int nDim);
~Phase();
bool initialize(Residuals& initRes,
SolveInfo& solveInfo,
Parameter& param, int nDim);
bool updateCheck(Residuals& currentRes,
SolveInfo& solveInfo,
Parameter& param);
void reverse();
void display(FILE* fpout = stdout);
};
}
#endif
|