00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef AbcSimplexDual_H
00012 #define AbcSimplexDual_H
00013
00014 #include "AbcSimplex.hpp"
00015 #if 0
00016 #undef ABC_PARALLEL
00017 #define ABC_PARALLEL 2
00018 #undef cilk_for
00019 #undef cilk_spawn
00020 #undef cilk_sync
00021 #include <cilk/cilk.h>
00022 #endif
00023 typedef struct {
00024 double theta;
00025 double totalThru;
00026 double useThru;
00027 double bestEverPivot;
00028 double increaseInObjective;
00029 double tentativeTheta;
00030 double lastPivotValue;
00031 double thisPivotValue;
00032 double thruThis;
00033 double increaseInThis;
00034 int lastSequence;
00035 int sequence;
00036 int block;
00037 int numberSwapped;
00038 int numberRemaining;
00039 int numberLastSwapped;
00040 bool modifyCosts;
00041 } dualColumnResult;
00049 class AbcSimplexDual : public AbcSimplex {
00050
00051 public:
00052
00144 int dual();
00153 int strongBranching(int numberVariables, const int * variables,
00154 double * newLower, double * newUpper,
00155 double ** outputSolution,
00156 int * outputStatus, int * outputIterations,
00157 bool stopOnFirstInfeasible = true,
00158 bool alwaysFinish = false,
00159 int startFinishOptions = 0);
00161 AbcSimplexFactorization * setupForStrongBranching(char * arrays, int numberRows,
00162 int numberColumns, bool solveLp = false);
00164 void cleanupAfterStrongBranching(AbcSimplexFactorization * factorization);
00166
00182 int whileIteratingSerial();
00183 #if ABC_PARALLEL==1
00184 int whileIteratingThread();
00185 #endif
00186 #if ABC_PARALLEL==2
00187 int whileIteratingCilk();
00188 #endif
00189 void whileIterating2();
00190 int whileIteratingParallel(int numberIterations);
00191 int whileIterating3();
00192 void updatePrimalSolution();
00193 int noPivotRow();
00194 int noPivotColumn();
00195 void dualPivotColumn();
00197 void createDualPricingVectorSerial();
00198 int getTableauColumnFlipAndStartReplaceSerial();
00199 void getTableauColumnPart1Serial();
00200 #if ABC_PARALLEL==1
00202 void createDualPricingVectorThread();
00203 int getTableauColumnFlipAndStartReplaceThread();
00204 void getTableauColumnPart1Thread();
00205 #endif
00206 #if ABC_PARALLEL==2
00208 void createDualPricingVectorCilk();
00209 int getTableauColumnFlipAndStartReplaceCilk();
00210 void getTableauColumnPart1Cilk();
00211 #endif
00212 void getTableauColumnPart2();
00213 int checkReplace();
00214 void replaceColumnPart3();
00215 void checkReplacePart1();
00216 void checkReplacePart1a();
00217 void checkReplacePart1b();
00219 void updateDualsInDual();
00223
00224
00229 int flipBounds();
00232 void flipBack(int number);
00239 void dualColumn1(bool doAll=false);
00245 double dualColumn1A();
00247 double dualColumn1B();
00253 void dualColumn2();
00254 void dualColumn2Most(dualColumnResult & result);
00255 void dualColumn2First(dualColumnResult & result);
00261 void dualColumn2(dualColumnResult & result);
00266 void checkPossibleCleanup(CoinIndexedVector * array);
00273 void dualPivotRow();
00281 int changeBounds(int initialize, double & changeCost);
00284 bool changeBound( int iSequence);
00286 void originalBound(int iSequence);
00289 int checkUnbounded(CoinIndexedVector & ray, double changeCost);
00299 void statusOfProblemInDual(int type);
00305
00306
00307 int whatNext();
00309 bool checkCutoff(bool computeObjective);
00311 int bounceTolerances(int type);
00313 void perturb(double factor);
00315 void perturbB(double factor,int type);
00317 int makeNonFreeVariablesDualFeasible(bool changeCosts=false);
00318 int fastDual(bool alwaysFinish = false);
00321 int numberAtFakeBound();
00322
00327 int pivotResultPart1();
00329 int nextSuperBasic();
00331 void startupSolve();
00333 void finishSolve();
00334 void gutsOfDual();
00335
00336 int resetFakeBounds(int type);
00337
00339 };
00340 #if ABC_PARALLEL==1
00341 void * abc_parallelManager(void * simplex);
00342 #endif
00343 #endif